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(account, password = "password", path = "/admin/sessions/create") ⇒ Object
(also: #login_as_admin)
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
24 25 26 27 28 |
# File 'lib/lazy-head-gen.rb', line 24 def assert_admin_not_logged_in assert !last_response.ok? assert_equal 302, last_response.status assert last_response.original_headers["Location"].include?(Admin.url(:sessions, :new)) end |
#login_as(account, password = "password", path = "/admin/sessions/create") ⇒ Object Also known as: login_as_admin
Allows testing as a logged in admin user
param [Account] account - The account to attempt login with
12 13 14 15 16 17 |
# File 'lib/lazy-head-gen.rb', line 12 def login_as(account, password = "password", path = "/admin/sessions/create") post path, { :email => account.email, :password => password } follow_redirect! end |