Module: RSpec::Rails::Swagger::Helpers::PathItem

Defined in:
lib/rspec/rails/swagger/helpers.rb

Constant Summary collapse

METHODS =
%w(get put post delete options head patch).freeze

Instance Method Summary collapse

Instance Method Details

#operation(method, attributes = {}, &block) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/rspec/rails/swagger/helpers.rb', line 59

def operation method, attributes = {}, &block
  attributes.symbolize_keys!

  method = method.to_s.downcase
  validate_method! method

  meta = {
    swagger_object: :operation,
    swagger_operation: attributes.merge(method: method.to_sym).reject{ |v| v.nil? }
  }
  describe(method.to_s, meta, &block)
end