Module: RSpec::Hanami::RequestHelpers

Defined in:
lib/rspec/hanami/request_helpers.rb

Defined Under Namespace

Classes: Request

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



43
44
45
46
47
# File 'lib/rspec/hanami/request_helpers.rb', line 43

def self.included(klass)
  klass.class_eval do
    attr_reader :response
  end
end

Instance Method Details

#delete(path, options = {}) ⇒ Object



69
70
71
# File 'lib/rspec/hanami/request_helpers.rb', line 69

def delete(path, options = {})
  request(Request.new('DELETE', path, options))
end

#get(path, options = {}) ⇒ Object



53
54
55
# File 'lib/rspec/hanami/request_helpers.rb', line 53

def get(path, options = {})
  request(Request.new('GET', path, options))
end

#patch(path, options = {}) ⇒ Object



61
62
63
# File 'lib/rspec/hanami/request_helpers.rb', line 61

def patch(path, options = {})
  request(Request.new('PATCH', path, options))
end

#post(path, options = {}) ⇒ Object



57
58
59
# File 'lib/rspec/hanami/request_helpers.rb', line 57

def post(path, options = {})
  request(Request.new('POST', path, options))
end

#put(path, options = {}) ⇒ Object



65
66
67
# File 'lib/rspec/hanami/request_helpers.rb', line 65

def put(path, options = {})
  request(Request.new('PUT', path, options))
end

#request(request) ⇒ Object



49
50
51
# File 'lib/rspec/hanami/request_helpers.rb', line 49

def request(request)
  @response = ::Hanami.app.call(request.env)
end