Sha256: b3379b21c0656d82e220fc7eb11e03200ae7e52f388b396f60bb20c371ece7aa
Contents?: true
Size: 1.21 KB
Versions: 13
Compression:
Stored size: 1.21 KB
Contents
require 'test_helper' class UserSessionsControllerTest < Zena::Controller::TestCase context "Controller actions" do should "get login page" do get :new assert_not_nil assigns(:node) end should "create a session" do post 'create', :login=>'ant', :password=>'ant' assert assigns(:user_session).persisting? assert_response 302 end should "redirect to login page if login failed" do post 'create', :login=>'ant', :password=>'boom' assert !assigns(:user_session).persisting? assert_redirected_to login_path end end context "with login Test Case" do setup do login('lion') end should "visitor be accessible" do assert_equal 'lion', visitor.login end should "site be accessible" do assert_equal 'zena', $_test_site end should "check if visitor is admin" do assert visitor.is_admin? end end context 'a visitor on the wrong site' do setup do @request.host = 'ocean.host' end should 'not be allowed to login' do post 'create', :login => 'ant', :password => 'ant' assert !assigns(:user_session).persisting? assert_redirected_to login_path end end end
Version data entries
13 entries across 13 versions & 1 rubygems