Sha256: 0eaea34b79396ff52caf1d77dba5d9bc7e77ef961c56aa3a7f6fd1592bd07b7c
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
begin require 'padrino-gen' Padrino::Generators.load_paths << Dir[File.dirname(__FILE__) + '/lazy-head-gen/{bootstrapped_admin_app,admin_controller_test,scaffold}.rb'] rescue LoadError # Fail silently end module LazyHeadGen # Allows testing as a logged in admin user # # param [Account] account - The account to attempt login with def login_as_admin(account) post "/admin/sessions/create", { :email => account.email, :password => "password" } follow_redirect! end # Standard assertions to test when an admin user is not logged in # and trys to view an admin page # def assert_admin_not_logged_in assert !ok? assert_equal 302, status assert_equal "http://example.org/admin/sessions/new", location end # Some shorthands for last_request and last_response varibles # def path last_request.path end def session last_request.env['rack.session'] end def body last_response.body end def status last_response.status end def location last_response.original_headers["Location"] end def ok? last_response.ok? end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lazy-head-gen-0.4.3 | lib/lazy-head-gen.rb |