Class: SharkOnLambda::RSpec::EnvBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/shark_on_lambda/rspec/env_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ EnvBuilder

Returns a new instance of EnvBuilder.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/shark_on_lambda/rspec/env_builder.rb', line 9

def initialize(options = {})
  @method = options.fetch(:method).to_s.upcase
  @controller = options.fetch(:controller)
  @action = options.fetch(:action)

  @headers = (options[:headers] || {}).deep_stringify_keys
  @headers.transform_keys!(&:downcase)
  @params = options[:params] || {}
  @path_parameters = options[:path_parameters] || {}

  initialize_env
  add_headers
  add_request_body
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



6
7
8
# File 'lib/shark_on_lambda/rspec/env_builder.rb', line 6

def action
  @action
end

#controllerObject (readonly)

Returns the value of attribute controller.



6
7
8
# File 'lib/shark_on_lambda/rspec/env_builder.rb', line 6

def controller
  @controller
end

#headersObject (readonly)

Returns the value of attribute headers.



6
7
8
# File 'lib/shark_on_lambda/rspec/env_builder.rb', line 6

def headers
  @headers
end

#methodObject (readonly)

Returns the value of attribute method.



6
7
8
# File 'lib/shark_on_lambda/rspec/env_builder.rb', line 6

def method
  @method
end

#paramsObject (readonly)

Returns the value of attribute params.



7
8
9
# File 'lib/shark_on_lambda/rspec/env_builder.rb', line 7

def params
  @params
end

#path_parametersObject (readonly)

Returns the value of attribute path_parameters.



7
8
9
# File 'lib/shark_on_lambda/rspec/env_builder.rb', line 7

def path_parameters
  @path_parameters
end

Instance Method Details

#buildObject



24
25
26
# File 'lib/shark_on_lambda/rspec/env_builder.rb', line 24

def build
  env.deep_stringify_keys
end