Module: LazyHeadGen
- Defined in:
- lib/lazy-head-gen.rb
Instance Method Summary collapse
-
#assert_admin_not_logged_in ⇒ Object
Standard assertions to test when an admin user is not logged in and trys to view an admin page.
-
#login_as_admin(account) ⇒ Object
Allows testing as a logged in admin user.
Instance Method Details
#assert_admin_not_logged_in ⇒ Object
Standard assertions to test when an admin user is not logged in and trys to view an admin page
23 24 25 26 27 |
# File 'lib/lazy-head-gen.rb', line 23 def assert_admin_not_logged_in assert !last_response.ok? assert_equal 302, last_response.status assert_equal "http://example.org/admin/sessions/new", last_response.original_headers["Location"] end |
#login_as_admin(account) ⇒ Object
Allows testing as a logged in admin user
param [Account] account - The account to attempt login with
13 14 15 16 17 18 |
# File 'lib/lazy-head-gen.rb', line 13 def login_as_admin(account) post "/admin/sessions/create", { :email => account.email, :password => "password" } follow_redirect! end |