Module: Rots::Test::RackTestHelpers

Defined in:
lib/rots/test/rack_test_helpers.rb

Instance Method Summary collapse

Instance Method Details

#follow_openid_redirect!(app) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/rots/test/rack_test_helpers.rb', line 9

def follow_openid_redirect!(app)
  assert(@response)
  assert_equal(303, @response.status)

  env = Rack::MockRequest.env_for(@response.headers["Location"])
  _status, headers, _body = Rots::Mocks::RotsServer.new.call(env)

  uri = URI(headers["Location"])
  mock_openid_request(app, "#{uri.path}?#{uri.query}")
end

#mock_openid_request(app, *args) ⇒ Object



4
5
6
7
# File 'lib/rots/test/rack_test_helpers.rb', line 4

def mock_openid_request(app, *args)
  env = Rack::MockRequest.env_for(*args)
  @response = Rack::MockResponse.new(*app.call(env))
end