spec.rb in rack-cerberus-0.2.0 vs spec.rb in rack-cerberus-0.3.0

- old
+ new

@@ -7,13 +7,13 @@ Bacon.summary_on_exit describe 'cerberus' do secret_app = lambda {|env| [200, {'Content-Type'=>'text/plain'}, env['rack.session'].inspect] } - app = Rack::Session::Cookie.new(Cerberus.new(secret_app, {}) {|login,pass| [login,pass]==['mario','bros']}) + app = Rack::Session::Cookie.new(Cerberus.new(secret_app, {}) {|login,pass| [login,pass]==['mario@nintendo.com','bros']}) req = Rack::MockRequest.new(app) - app_with_css = app = Rack::Session::Cookie.new(Cerberus.new(secret_app, {:css_location=>'/main.css'}) {|login,pass| [login,pass]==['mario','bros']}) + app_with_css = Rack::Session::Cookie.new(Cerberus.new(secret_app, {:css_location=>'/main.css'}) {|login,pass| [login,pass]==['mario','bros']}) req_with_css = Rack::MockRequest.new(app_with_css) cookie = '' should 'Raise if there is no session' do no_session_app = Cerberus.new(secret_app, {}) {|login,pass| [login,pass]==['mario','bros']} @@ -35,19 +35,19 @@ res.body.should.match(/name="cerberus_login" value="fake_login"/) res.body.should.match(/name="cerberus_pass" value="fake_pass"/) end should 'Give access with the appropriate login and pass' do - res = req.get('/', :params => {'cerberus_login' => 'mario', 'cerberus_pass' => 'bros'}) + res = req.get('/', :params => {'cerberus_login' => 'mario@nintendo.com', 'cerberus_pass' => 'bros'}) cookie = res["Set-Cookie"] res.status.should==200 end should 'Use session for persistent login' do res = req.get('/', "HTTP_COOKIE" => cookie) res.status.should==200 - res.body.should=='{"cerberus_user"=>"mario"}' + res.body.should=='{"cerberus_user"=>"mario@nintendo.com"}' cookie = res["Set-Cookie"] req.get('/', "HTTP_COOKIE" => cookie).status.should==200 end should 'Logout via /logout path' do @@ -57,15 +57,15 @@ res = req.get('/', "HTTP_COOKIE" => cookie) res.status.should==401 end should 'Not send not_found when logging after a logout (because the path is /logout)' do - res = req.get('/logout', :params => {'cerberus_login' => 'mario', 'cerberus_pass' => 'bros'}) + res = req.get('/logout', :params => {'cerberus_login' => 'mario@nintendo.com', 'cerberus_pass' => 'bros'}) res.status.should==302 res['Location'].should=='/' req = Rack::MockRequest.new(Rack::URLMap.new({'/backend' => app})) - res = req.get('/backend/logout', :params => {'cerberus_login' => 'mario', 'cerberus_pass' => 'bros'}) + res = req.get('/backend/logout', :params => {'cerberus_login' => 'mario@nintendo.com', 'cerberus_pass' => 'bros'}) res.status.should==302 res['Location'].should=='/backend' end should 'Use an external css file only if requested' do \ No newline at end of file