[DRE-commits] [ruby-warden] 01/03: Port tests to RSpec3
Balasankar C
balasankarc-guest at moszumanska.debian.org
Wed Sep 2 07:00:34 UTC 2015
This is an automated email from the git hooks/post-receive script.
balasankarc-guest pushed a commit to branch master
in repository ruby-warden.
commit b59d65aac5ae1edb0013b4c8ef9ed9bded884552
Author: Balasankar C <balasankarc at autistici.org>
Date: Wed Sep 2 12:23:55 2015 +0530
Port tests to RSpec3
---
debian/patches/rspec3-port.patch | 2242 ++++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 2243 insertions(+)
diff --git a/debian/patches/rspec3-port.patch b/debian/patches/rspec3-port.patch
new file mode 100644
index 0000000..2193e7e
--- /dev/null
+++ b/debian/patches/rspec3-port.patch
@@ -0,0 +1,2242 @@
+Description: Port tests to follow RSpec3 syntax
+Author: Balasankar C <balasankarc at autistici.org>
+Last-Update: 2015-09-02
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/spec/warden/authenticated_data_store_spec.rb
++++ b/spec/warden/authenticated_data_store_spec.rb
+@@ -16,16 +16,16 @@
+ app = lambda do |e|
+ e['warden'].authenticate(:pass)
+ e['warden'].authenticate(:pass, :scope => :foo)
+- e['warden'].should be_authenticated
+- e['warden'].should be_authenticated(:foo)
++ expect(e['warden']).to be_authenticated
++ expect(e['warden']).to be_authenticated(:foo)
+
+ # Store the data for :default
+ e['warden'].session[:key] = "value"
+ valid_response
+ end
+ setup_rack(app).call(@env)
+- @env['rack.session']['warden.user.default.session'].should == {:key => "value"}
+- @env['rack.session']['warden.user.foo.session'].should be_nil
++ expect(@env['rack.session']['warden.user.default.session']).to eq({:key => "value"})
++ expect(@env['rack.session']['warden.user.foo.session']).to be_nil
+ end
+
+ it "should store data for the foo user" do
+@@ -34,7 +34,7 @@
+ valid_response
+ end
+ setup_rack(app).call(@env)
+- @env['rack.session']['warden.user.foo.session'].should == {:key => "value"}
++ expect(@env['rack.session']['warden.user.foo.session']).to eq({:key => "value"})
+ end
+
+ it "should store the data seperately" do
+@@ -44,8 +44,8 @@
+ valid_response
+ end
+ setup_rack(app).call(@env)
+- @env['rack.session']['warden.user.default.session'].should == {:key => "value"}
+- @env['rack.session']['warden.user.foo.session' ].should == {:key => "another value"}
++ expect(@env['rack.session']['warden.user.default.session']).to eq({:key => "value"})
++ expect(@env['rack.session']['warden.user.foo.session' ]).to eq({:key => "another value"})
+ end
+
+ it "should clear the foo scoped data when foo logs out" do
+@@ -56,8 +56,8 @@
+ valid_response
+ end
+ setup_rack(app).call(@env)
+- @env['rack.session']['warden.user.default.session'].should == {:key => "value"}
+- @env['rack.session']['warden.user.foo.session' ].should be_nil
++ expect(@env['rack.session']['warden.user.default.session']).to eq({:key => "value"})
++ expect(@env['rack.session']['warden.user.foo.session' ]).to be_nil
+ end
+
+ it "should clear out the default data when :default logs out" do
+@@ -68,8 +68,8 @@
+ valid_response
+ end
+ setup_rack(app).call(@env)
+- @env['rack.session']['warden.user.default.session'].should be_nil
+- @env['rack.session']['warden.user.foo.session' ].should == {:key => "another value"}
++ expect(@env['rack.session']['warden.user.default.session']).to be_nil
++ expect(@env['rack.session']['warden.user.foo.session' ]).to eq({:key => "another value"})
+ end
+
+ it "should clear out all data when a general logout is performed" do
+@@ -80,8 +80,8 @@
+ valid_response
+ end
+ setup_rack(app).call(@env)
+- @env['rack.session']['warden.user.default.session'].should be_nil
+- @env['rack.session']['warden.user.foo.session' ].should be_nil
++ expect(@env['rack.session']['warden.user.default.session']).to be_nil
++ expect(@env['rack.session']['warden.user.foo.session' ]).to be_nil
+ end
+
+ it "should logout multuiple personas at once" do
+@@ -95,9 +95,9 @@
+ valid_response
+ end
+ setup_rack(app).call(@env)
+- @env['rack.session']['warden.user.default.session'].should be_nil
+- @env['rack.session']['warden.user.foo.session' ].should == {:key => "another value"}
+- @env['rack.session']['warden.user.bar.session' ].should be_nil
++ expect(@env['rack.session']['warden.user.default.session']).to be_nil
++ expect(@env['rack.session']['warden.user.foo.session' ]).to eq({:key => "another value"})
++ expect(@env['rack.session']['warden.user.bar.session' ]).to be_nil
+ end
+
+ it "should not store data for a user who is not logged in" do
+@@ -107,8 +107,8 @@
+ valid_response
+ end
+
+- lambda do
++ expect do
+ setup_rack(app).call(@env)
+- end.should raise_error(Warden::NotAuthenticated)
++ end.to raise_error(Warden::NotAuthenticated)
+ end
+ end
+--- a/spec/warden/config_spec.rb
++++ b/spec/warden/config_spec.rb
+@@ -9,40 +9,40 @@
+
+ it "should behave like a hash" do
+ @config[:foo] = :bar
+- @config[:foo].should == :bar
++ expect(@config[:foo]).to eq(:bar)
+ end
+
+ it "should provide hash accessors" do
+ @config.failure_app = :foo
+- @config[:failure_app].should == :foo
++ expect(@config[:failure_app]).to eq(:foo)
+ @config[:failure_app] = :bar
+- @config.failure_app.should == :bar
++ expect(@config.failure_app).to eq(:bar)
+ end
+
+ it "should allow to read and set default strategies" do
+ @config.default_strategies :foo, :bar
+- @config.default_strategies.should == [:foo, :bar]
++ expect(@config.default_strategies).to eq([:foo, :bar])
+ end
+
+ it "should allow to silence missing strategies" do
+ @config.silence_missing_strategies!
+- @config.silence_missing_strategies?.should be_true
++ expect(@config.silence_missing_strategies?).to be_truthy
+ end
+
+ it "should set the default_scope" do
+- @config.default_scope.should == :default
++ expect(@config.default_scope).to eq(:default)
+ @config.default_scope = :foo
+- @config.default_scope.should == :foo
++ expect(@config.default_scope).to eq(:foo)
+ end
+
+ it "should merge given options on initialization" do
+- Warden::Config.new(:foo => :bar)[:foo].should == :bar
++ expect(Warden::Config.new(:foo => :bar)[:foo]).to eq(:bar)
+ end
+
+ it "should setup defaults with the scope_defaults method" do
+ c = Warden::Config.new
+ c.scope_defaults :foo, :strategies => [:foo, :bar], :store => false
+- c.default_strategies(:scope => :foo).should == [:foo, :bar]
+- c.scope_defaults(:foo).should == {:store => false}
++ expect(c.default_strategies(:scope => :foo)).to eq([:foo, :bar])
++ expect(c.scope_defaults(:foo)).to eq({:store => false})
+ end
+ end
+--- a/spec/warden/errors_spec.rb
++++ b/spec/warden/errors_spec.rb
+@@ -8,40 +8,40 @@
+ end
+
+ it "should report that it is empty on first creation" do
+- @errors.empty?.should == true
++ expect(@errors.empty?).to eq(true)
+ end
+
+ it "should continue to report that it is empty even after being checked" do
+ @errors.on(:foo)
+- @errors.empty?.should == true
++ expect(@errors.empty?).to eq(true)
+ end
+
+ it "should add an error" do
+ @errors.add(:login, "Login or password incorrect")
+- @errors[:login].should == ["Login or password incorrect"]
++ expect(@errors[:login]).to eq(["Login or password incorrect"])
+ end
+
+ it "should allow many errors to be added to the same field" do
+ @errors.add(:login, "bad 1")
+ @errors.add(:login, "bad 2")
+- @errors.on(:login).should == ["bad 1", "bad 2"]
++ expect(@errors.on(:login)).to eq(["bad 1", "bad 2"])
+ end
+
+ it "should give the full messages for an error" do
+ @errors.add(:login, "login wrong")
+ @errors.add(:password, "password wrong")
+ ["password wrong", "login wrong"].each do |msg|
+- @errors.full_messages.should include(msg)
++ expect(@errors.full_messages).to include(msg)
+ end
+ end
+
+ it "should return the error for a specific field / label" do
+ @errors.add(:login, "wrong")
+- @errors.on(:login).should == ["wrong"]
++ expect(@errors.on(:login)).to eq(["wrong"])
+ end
+
+ it "should return nil for a specific field if it's not been set" do
+- @errors.on(:not_there).should be_nil
++ expect(@errors.on(:not_there)).to be_nil
+ end
+
+ end
+--- a/spec/warden/hooks_spec.rb
++++ b/spec/warden/hooks_spec.rb
+@@ -21,13 +21,13 @@
+ RAM.after_set_user do |user, auth, opts|
+ "boo"
+ end
+- RAM._after_set_user.should have(1).item
++ expect(RAM._after_set_user.size).to eq(1)
+ end
+
+ it "should allow me to add multiple after_set_user hooks" do
+ RAM.after_set_user{|user, auth, opts| "foo"}
+ RAM.after_set_user{|u,a| "bar"}
+- RAM._after_set_user.should have(2).items
++ expect(RAM._after_set_user.size).to eq(2)
+ end
+
+ it "should run each after_set_user hook after the user is set" do
+@@ -40,9 +40,9 @@
+ end
+ env = env_with_params
+ setup_rack(app).call(env)
+- env['warden'].user.should be_nil
+- env['warden.spec.hook.foo'].should == "run foo"
+- env['warden.spec.hook.bar'].should == "run bar"
++ expect(env['warden'].user).to be_nil
++ expect(env['warden.spec.hook.foo']).to eq("run foo")
++ expect(env['warden.spec.hook.bar']).to eq("run bar")
+ end
+
+ it "should not run the event specified with except" do
+@@ -76,22 +76,22 @@
+ end
+ env = env_with_params
+ setup_rack(app).call(env)
+- env['warden.spec.order'].should == [1,2,3]
++ expect(env['warden.spec.order']).to eq([1,2,3])
+ end
+
+ context "after_authentication" do
+ it "should be a wrapper to after_set_user behavior" do
+ RAM.after_authentication{|u,a,o| a.env['warden.spec.hook.baz'] = "run baz"}
+ RAM.after_authentication{|u,a,o| a.env['warden.spec.hook.paz'] = "run paz"}
+- RAM.after_authentication{|u,a,o| o[:event].should == :authentication }
++ RAM.after_authentication{|u,a,o| expect(o[:event]).to eq(:authentication) }
+ app = lambda do |e|
+ e['warden'].authenticate(:pass)
+ valid_response
+ end
+ env = env_with_params
+ setup_rack(app).call(env)
+- env['warden.spec.hook.baz'].should == 'run baz'
+- env['warden.spec.hook.paz'].should == 'run paz'
++ expect(env['warden.spec.hook.baz']).to eq('run baz')
++ expect(env['warden.spec.hook.paz']).to eq('run paz')
+ end
+
+ it "should not be invoked on default after_set_user scenario" do
+@@ -115,7 +115,7 @@
+ end
+ env = env_with_params
+ setup_rack(app).call(env)
+- env['warden.spec.order'].should == [1,2,3]
++ expect(env['warden.spec.order']).to eq([1,2,3])
+ end
+
+ it "should allow me to log out a user in an after_set_user block" do
+@@ -127,7 +127,7 @@
+ end
+ env = env_with_params
+ setup_rack(app).call(env)
+- env['warden'].authenticated?.should be_false
++ expect(env['warden'].authenticated?).to be_falsey
+ end
+ end
+
+@@ -135,13 +135,13 @@
+ it "should be a wrapper to after_set_user behavior" do
+ RAM.after_fetch{|u,a,o| a.env['warden.spec.hook.baz'] = "run baz"}
+ RAM.after_fetch{|u,a,o| a.env['warden.spec.hook.paz'] = "run paz"}
+- RAM.after_fetch{|u,a,o| o[:event].should == :fetch }
++ RAM.after_fetch{|u,a,o| expect(o[:event]).to eq(:fetch) }
+ env = env_with_params
+ setup_rack(lambda { |e| valid_response }).call(env)
+ env['rack.session']['warden.user.default.key'] = "Foo"
+- env['warden'].user.should == "Foo"
+- env['warden.spec.hook.baz'].should == 'run baz'
+- env['warden.spec.hook.paz'].should == 'run paz'
++ expect(env['warden'].user).to eq("Foo")
++ expect(env['warden.spec.hook.baz']).to eq('run baz')
++ expect(env['warden.spec.hook.paz']).to eq('run paz')
+ end
+
+ it "should not be invoked on default after_set_user scenario" do
+@@ -159,7 +159,7 @@
+ env = env_with_params
+ setup_rack(lambda { |e| valid_response }).call(env)
+ env['rack.session']['warden.user.default.key'] = nil
+- env['warden'].user.should be_nil
++ expect(env['warden'].user).to be_nil
+ end
+
+ it "should run filters in the given order" do
+@@ -174,7 +174,7 @@
+ end
+ env = env_with_params
+ setup_rack(app).call(env)
+- env['warden.spec.order'].should == [1,2,3]
++ expect(env['warden.spec.order']).to eq([1,2,3])
+ end
+ end
+ end
+@@ -195,7 +195,7 @@
+ env = env_with_params
+ setup_rack(lambda { |e| valid_response }).call(env)
+ env['rack.session']['warden.user.default.key'] = "Foo"
+- env['warden'].user.should == "Foo"
++ expect(env['warden'].user).to eq("Foo")
+ end
+
+ it "should be called if fetched user is nil" do
+@@ -203,8 +203,8 @@
+ RAM.after_failed_fetch{|u,a,o| calls += 1 }
+ env = env_with_params
+ setup_rack(lambda { |e| valid_response }).call(env)
+- env['warden'].user.should be_nil
+- calls.should == 1
++ expect(env['warden'].user).to be_nil
++ expect(calls).to eq(1)
+ end
+ end
+
+@@ -220,13 +220,13 @@
+
+ it "should allow me to add a before_failure hook" do
+ RAM.before_failure{|env, opts| "foo"}
+- RAM._before_failure.should have(1).item
++ expect(RAM._before_failure.size).to eq(1)
+ end
+
+ it "should allow me to add multiple before_failure hooks" do
+ RAM.before_failure{|env, opts| "foo"}
+ RAM.before_failure{|env, opts| "bar"}
+- RAM._before_failure.should have(2).items
++ expect(RAM._before_failure.size).to eq(2)
+ end
+
+ it "should run each before_failure hooks before failing" do
+@@ -235,8 +235,8 @@
+ app = lambda{|e| e['warden'].authenticate!(:failz); valid_response}
+ env = env_with_params
+ setup_rack(app).call(env)
+- env['warden.spec.before_failure.foo'].should == "foo"
+- env['warden.spec.before_failure.bar'].should == "bar"
++ expect(env['warden.spec.before_failure.foo']).to eq("foo")
++ expect(env['warden.spec.before_failure.bar']).to eq("bar")
+ end
+
+ it "should run filters in the given order" do
+@@ -250,7 +250,7 @@
+ end
+ env = env_with_params
+ setup_rack(app).call(env)
+- env['warden.spec.order'].should == [1,2,3]
++ expect(env['warden.spec.order']).to eq([1,2,3])
+ end
+ end
+
+@@ -266,13 +266,13 @@
+
+ it "should allow me to add an before_logout hook" do
+ RAM.before_logout{|user, auth, scopes| "foo"}
+- RAM._before_logout.should have(1).item
++ expect(RAM._before_logout.size).to eq(1)
+ end
+
+ it "should allow me to add multiple after_authentication hooks" do
+ RAM.before_logout{|u,a,o| "bar"}
+ RAM.before_logout{|u,a,o| "baz"}
+- RAM._before_logout.should have(2).items
++ expect(RAM._before_logout.size).to eq(2)
+ end
+
+ it "should run each before_logout hook before logout is run" do
+@@ -282,8 +282,8 @@
+ env = env_with_params
+ setup_rack(app).call(env)
+ env['warden'].logout
+- env['warden.spec.hook.lorem'].should == 'run lorem'
+- env['warden.spec.hook.ipsum'].should == 'run ipsum'
++ expect(env['warden.spec.hook.lorem']).to eq('run lorem')
++ expect(env['warden.spec.hook.ipsum']).to eq('run ipsum')
+ end
+
+ it "should run before_logout hook for a specified scope" do
+@@ -301,12 +301,12 @@
+ setup_rack(app).call(env)
+
+ env['warden'].logout(:scope1)
+- env['warden.spec.hook.a'].should == [:scope1]
+- env['warden.spec.hook.b'].should == []
++ expect(env['warden.spec.hook.a']).to eq([:scope1])
++ expect(env['warden.spec.hook.b']).to eq([])
+
+ env['warden'].logout(:scope2)
+- env['warden.spec.hook.a'].should == [:scope1]
+- env['warden.spec.hook.b'].should == [:scope2]
++ expect(env['warden.spec.hook.a']).to eq([:scope1])
++ expect(env['warden.spec.hook.b']).to eq([:scope2])
+ end
+
+ it "should run filters in the given order" do
+@@ -321,7 +321,7 @@
+ end
+ env = env_with_params
+ setup_rack(app).call(env)
+- env['warden.spec.order'].should == [1,2,3]
++ expect(env['warden.spec.order']).to eq([1,2,3])
+ end
+ end
+
+@@ -339,13 +339,13 @@
+
+ it "should allow me to add an on_request hook" do
+ RAM.on_request{|proxy| "foo"}
+- RAM._on_request.should have(1).item
++ expect(RAM._on_request.size).to eq(1)
+ end
+
+ it "should allow me to add multiple on_request hooks" do
+ RAM.on_request{|proxy| "foo"}
+ RAM.on_request{|proxy| "bar"}
+- RAM._on_request.should have(2).items
++ expect(RAM._on_request.size).to eq(2)
+ end
+
+ it "should run each on_request hooks when initializing" do
+@@ -354,8 +354,8 @@
+ app = lambda{|e| valid_response}
+ env = env_with_params
+ setup_rack(app).call(env)
+- env['warden.spec.on_request.foo'].should == "foo"
+- env['warden.spec.on_request.bar'].should == "bar"
++ expect(env['warden.spec.on_request.foo']).to eq("foo")
++ expect(env['warden.spec.on_request.bar']).to eq("bar")
+ end
+
+ it "should run filters in the given order" do
+@@ -367,7 +367,7 @@
+ end
+ env = Rack::MockRequest.env_for("/", "warden.spec.order" => [])
+ setup_rack(app).call(env)
+- env['warden.spec.order'].should == [1,2,3]
++ expect(env['warden.spec.order']).to eq([1,2,3])
+ end
+ end
+ end
+--- a/spec/warden/manager_spec.rb
++++ b/spec/warden/manager_spec.rb
+@@ -10,7 +10,7 @@
+ it "should insert a Proxy object into the rack env" do
+ env = env_with_params
+ setup_rack(success_app).call(env)
+- env["warden"].should be_an_instance_of(Warden::Proxy)
++ expect(env["warden"]).to be_an_instance_of(Warden::Proxy)
+ end
+
+ describe "thrown auth" do
+@@ -35,7 +35,7 @@
+ throw(:warden, :action => :unauthenticated)
+ end
+ result = setup_rack(app, :failure_app => @fail_app).call(env)
+- result.first.should == 401
++ expect(result.first).to eq(401)
+ end
+
+ it "should use the failure message given to the failure method" do
+@@ -45,7 +45,7 @@
+ throw(:warden)
+ end
+ result = setup_rack(app, :failure_app => @fail_app).call(env)
+- result.last.should == ["You Fail!"]
++ expect(result.last).to eq(["You Fail!"])
+ end
+
+ it "should render the failure app when there's a failure" do
+@@ -56,7 +56,7 @@
+ [401, {"Content-Type" => "text/plain"}, ["Failure App"]]
+ end
+ result = setup_rack(app, :failure_app => fail_app).call(env_with_params)
+- result.last.should == ["Failure App"]
++ expect(result.last).to eq(["Failure App"])
+ end
+
+ it "should call failure app if warden is thrown even after successful authentication" do
+@@ -66,8 +66,8 @@
+ throw(:warden)
+ end
+ result = setup_rack(app, :failure_app => @fail_app).call(env)
+- result.first.should == 401
+- result.last.should == ["You Fail!"]
++ expect(result.first).to eq(401)
++ expect(result.last).to eq(["You Fail!"])
+ end
+
+ it "should set the attempted url in warden.options hash" do
+@@ -77,8 +77,8 @@
+ throw(:warden)
+ end
+ result = setup_rack(app, :failure_app => @fail_app).call(env)
+- result.first.should == 401
+- env["warden.options"][:attempted_path].should == "/access/path"
++ expect(result.first).to eq(401)
++ expect(env["warden.options"][:attempted_path]).to eq("/access/path")
+ end
+
+ it "should catch a resubmitted request" do
+@@ -122,9 +122,9 @@
+ end
+
+ result = builder.to_app.call(env)
+- result[0].should == 401
+- result[2].body.should == ["Bad"]
+- $throw_count.should == 2
++ expect(result[0]).to eq(401)
++ expect(result[2].body).to eq(["Bad"])
++ expect($throw_count).to eq(2)
+ end
+
+ it "should use the default scopes action when a bare throw is used" do
+@@ -144,8 +144,8 @@
+ :configurator => lambda{ |c| c.scope_defaults(:default, :action => 'my_action', :strategies => [:password]) }
+ ).call(env)
+
+- action.should == "/my_action"
+- result.first.should == 401
++ expect(action).to eq("/my_action")
++ expect(result.first).to eq(401)
+ end
+ end # failure
+ end
+@@ -169,9 +169,9 @@
+ end
+ end
+ result = @app.call(env_with_params)
+- result[0].should == 302
+- result[1]["Location"].should == "/foo/bar?foo=bar"
+- result[2].should == ["custom redirection message"]
++ expect(result[0]).to eq(302)
++ expect(result[1]["Location"]).to eq("/foo/bar?foo=bar")
++ expect(result[2]).to eq(["custom redirection message"])
+ end
+
+ it "should redirect with a default message" do
+@@ -181,9 +181,9 @@
+ end
+ end
+ result = @app.call(env_with_params)
+- result[0].should == 302
+- result[1]['Location'].should == "/foo/bar?foo=bar"
+- result[2].should == ["You are being redirected to /foo/bar?foo=bar"]
++ expect(result[0]).to eq(302)
++ expect(result[1]['Location']).to eq("/foo/bar?foo=bar")
++ expect(result[2]).to eq(["You are being redirected to /foo/bar?foo=bar"])
+ end
+
+ it "should redirect with a permanent redirect" do
+@@ -193,7 +193,7 @@
+ end
+ end
+ result = @app.call(env_with_params)
+- result[0].should == 301
++ expect(result[0]).to eq(301)
+ end
+
+ it "should redirect with a content type" do
+@@ -203,9 +203,9 @@
+ end
+ end
+ result = @app.call(env_with_params)
+- result[0].should == 302
+- result[1]["Location"].should == "/foo/bar?foo=bar"
+- result[1]["Content-Type"].should == "text/xml"
++ expect(result[0]).to eq(302)
++ expect(result[1]["Location"]).to eq("/foo/bar?foo=bar")
++ expect(result[1]["Content-Type"]).to eq("text/xml")
+ end
+
+ it "should redirect with a default content type" do
+@@ -215,9 +215,9 @@
+ end
+ end
+ result = @app.call(env_with_params)
+- result[0].should == 302
+- result[1]["Location"].should == "/foo/bar?foo=bar"
+- result[1]["Content-Type"].should == "text/plain"
++ expect(result[0]).to eq(302)
++ expect(result[1]["Location"]).to eq("/foo/bar?foo=bar")
++ expect(result[1]["Content-Type"]).to eq("text/plain")
+ end
+ end
+
+@@ -230,9 +230,9 @@
+ end
+ env = env_with_params
+ result = @app.call(env)
+- result[0].should == 401
+- result[2].should == ["You Fail!"]
+- env['PATH_INFO'].should == "/unauthenticated"
++ expect(result[0]).to eq(401)
++ expect(result[2]).to eq(["You Fail!"])
++ expect(env['PATH_INFO']).to eq("/unauthenticated")
+ end
+
+ it "should allow you to customize the response" do
+@@ -242,8 +242,8 @@
+ end
+ env = env_with_params
+ result = setup_rack(app).call(env)
+- result[0].should == 401
+- result[2].should == ["Fail From The App"]
++ expect(result[0]).to eq(401)
++ expect(result[2]).to eq(["Fail From The App"])
+ end
+
+ it "should allow you to customize the response without the explicit call to custom_failure! if not intercepting 401" do
+@@ -252,8 +252,8 @@
+ end
+ env = env_with_params
+ result = setup_rack(app, :intercept_401 => false).call(env)
+- result[0].should == 401
+- result[2].should == ["Fail From The App"]
++ expect(result[0]).to eq(401)
++ expect(result[2]).to eq(["Fail From The App"])
+ end
+
+ it "should render the failure application for a 401 if no custom_failure flag is set" do
+@@ -261,8 +261,8 @@
+ [401,{'Content-Type' => 'text/plain'},["Fail From The App"]]
+ end
+ result = setup_rack(app).call(env_with_params)
+- result[0].should == 401
+- result[2].should == ["You Fail!"]
++ expect(result[0]).to eq(401)
++ expect(result[2]).to eq(["You Fail!"])
+ end
+
+ end # failing
+@@ -275,9 +275,9 @@
+ end
+ end
+ result = @app.call(env_with_params)
+- result[0].should == 523
+- result[1]["Custom-Header"].should == "foo"
+- result[2].should == ["Custom Stuff"]
++ expect(result[0]).to eq(523)
++ expect(result[1]["Custom-Header"]).to eq("foo")
++ expect(result[2]).to eq(["Custom Stuff"])
+ end
+ end
+
+@@ -290,8 +290,8 @@
+ end
+ env = env_with_params
+ result = @app.call(env)
+- result[0].should == 200
+- result[2].should == ["Foo Is A Winna"]
++ expect(result[0]).to eq(200)
++ expect(result[2]).to eq(["Foo Is A Winna"])
+ end
+ end
+ end # integrated strategies
+@@ -299,9 +299,9 @@
+ it "should allow me to set a different default scope for warden" do
+ Rack::Builder.new do
+ use Warden::Manager, :default_scope => :default do |manager|
+- manager.default_scope.should == :default
++ expect(manager.default_scope).to eq(:default)
+ manager.default_scope = :other
+- manager.default_scope.should == :other
++ expect(manager.default_scope).to eq(:other)
+ end
+ end
+ end
+@@ -309,7 +309,7 @@
+ it "should allow me to access strategies through manager" do
+ Rack::Builder.new do
+ use Warden::Manager do |manager|
+- manager.strategies.should == Warden::Strategies
++ expect(manager.strategies).to eq(Warden::Strategies)
+ end
+ end
+ end
+--- a/spec/warden/proxy_spec.rb
++++ b/spec/warden/proxy_spec.rb
+@@ -23,34 +23,34 @@
+
+ it "should not check the authentication if it is not checked" do
+ app = setup_rack(@basic_app)
+- app.call(@env).first.should == 200
++ expect(app.call(@env).first).to eq(200)
+ end
+
+ it "should check the authentication if it is explicity checked" do
+ app = setup_rack(@authd_app)
+- app.call(@env).first.should == 401
++ expect(app.call(@env).first).to eq(401)
+ end
+
+ it "should not allow the request if incorrect conditions are supplied" do
+ env = env_with_params("/", :foo => "bar")
+ app = setup_rack(@authd_app)
+ response = app.call(env)
+- response.first.should == 401
++ expect(response.first).to eq(401)
+ end
+
+ it "should allow the request if the correct conditions are supplied" do
+ env = env_with_params("/", :username => "fred", :password => "sekrit")
+ app = setup_rack(@authd_app)
+ resp = app.call(env)
+- resp.first.should == 200
++ expect(resp.first).to eq(200)
+ end
+
+ it "should allow authentication in my application" do
+ env = env_with_params('/', :username => "fred", :password => "sekrit")
+ app = lambda do |env|
+ env['warden'].authenticate
+- env['warden'].should be_authenticated
+- env['warden.spec.strategies'].should == [:password]
++ expect(env['warden']).to be_authenticated
++ expect(env['warden.spec.strategies']).to eq([:password])
+ valid_response
+ end
+ setup_rack(app).call(env)
+@@ -60,8 +60,8 @@
+ env = env_with_params("/", :foo => "bar")
+ app = lambda do |env|
+ env['warden'].authenticate(:failz)
+- env['warden'].should_not be_authenticated
+- env['warden.spec.strategies'].should == [:failz]
++ expect(env['warden']).not_to be_authenticated
++ expect(env['warden.spec.strategies']).to eq([:failz])
+ valid_response
+ end
+ setup_rack(app).call(env)
+@@ -71,9 +71,9 @@
+ app = lambda do |env|
+ env['warden'].authenticate(:unknown)
+ end
+- lambda {
++ expect {
+ setup_rack(app).call(@env)
+- }.should raise_error(RuntimeError, "Invalid strategy unknown")
++ }.to raise_error(RuntimeError, "Invalid strategy unknown")
+ end
+
+ it "should not raise error on missing strategies if silencing" do
+@@ -81,16 +81,16 @@
+ env['warden'].authenticate
+ valid_response
+ end
+- lambda {
++ expect {
+ setup_rack(app, :silence_missing_strategies => true, :default_strategies => [:unknown]).call(@env)
+- }.should_not raise_error
++ }.not_to raise_error
+ end
+
+ it "should allow me to get access to the user at warden.user." do
+ app = lambda do |env|
+ env['warden'].authenticate(:pass)
+- env['warden'].should be_authenticated
+- env['warden.spec.strategies'].should == [:pass]
++ expect(env['warden']).to be_authenticated
++ expect(env['warden.spec.strategies']).to eq([:pass])
+ valid_response
+ end
+ setup_rack(app).call(@env)
+@@ -98,10 +98,10 @@
+
+ it "should run strategies when authenticate? is asked" do
+ app = lambda do |env|
+- env['warden'].should_not be_authenticated
++ expect(env['warden']).not_to be_authenticated
+ env['warden'].authenticate?(:pass)
+- env['warden'].should be_authenticated
+- env['warden.spec.strategies'].should == [:pass]
++ expect(env['warden']).to be_authenticated
++ expect(env['warden.spec.strategies']).to eq([:pass])
+ valid_response
+ end
+ setup_rack(app).call(@env)
+@@ -110,8 +110,8 @@
+ it "should properly send the scope to the strategy" do
+ app = lambda do |env|
+ env['warden'].authenticate(:pass, :scope => :failz)
+- env['warden'].should_not be_authenticated
+- env['warden.spec.strategies'].should == [:pass]
++ expect(env['warden']).not_to be_authenticated
++ expect(env['warden.spec.strategies']).to eq([:pass])
+ valid_response
+ end
+ setup_rack(app).call(@env)
+@@ -120,8 +120,8 @@
+ it "should try multiple authentication strategies" do
+ app = lambda do |env|
+ env['warden'].authenticate(:password,:pass)
+- env['warden'].should be_authenticated
+- env['warden.spec.strategies'].should == [:password, :pass]
++ expect(env['warden']).to be_authenticated
++ expect(env['warden.spec.strategies']).to eq([:password, :pass])
+ valid_response
+ end
+ setup_rack(app).call(@env)
+@@ -134,7 +134,7 @@
+ valid_response
+ end
+ setup_rack(app).call(@env)
+- @env['warden'].user.should == "foo as a user"
++ expect(@env['warden'].user).to eq("foo as a user")
+ end
+
+ it "should look for an active user in the session with authenticate?" do
+@@ -144,7 +144,7 @@
+ valid_response
+ end
+ setup_rack(app).call(@env)
+- @env['warden'].user(:foo_scope).should == "a foo user"
++ expect(@env['warden'].user(:foo_scope)).to eq("a foo user")
+ end
+
+ it "should look for an active user in the session with authenticate!" do
+@@ -154,7 +154,7 @@
+ valid_response
+ end
+ setup_rack(app).call(@env)
+- @env['warden'].user(:foo_scope).should == "a foo user"
++ expect(@env['warden'].user(:foo_scope)).to eq("a foo user")
+ end
+
+ it "should throw an error when authenticate!" do
+@@ -169,23 +169,23 @@
+ app = lambda do |env|
+ env['rack.session']['warden.user.foo.key'] = 'foo user'
+ env['rack.session']['warden.user.bar.key'] = 'bar user'
+- env['warden'].should be_authenticated(:foo)
+- env['warden'].should be_authenticated(:bar)
+- env['warden'].should_not be_authenticated # default scope
++ expect(env['warden']).to be_authenticated(:foo)
++ expect(env['warden']).to be_authenticated(:bar)
++ expect(env['warden']).not_to be_authenticated # default scope
+ valid_response
+ end
+ setup_rack(app).call(@env)
+- @env['warden'].user(:foo).should == 'foo user'
+- @env['warden'].user(:bar).should == 'bar user'
+- @env['warden'].user.should be_nil
++ expect(@env['warden'].user(:foo)).to eq('foo user')
++ expect(@env['warden'].user(:bar)).to eq('bar user')
++ expect(@env['warden'].user).to be_nil
+ end
+
+ it "should not authenticate other scopes just because the first is authenticated" do
+ app = lambda do |env|
+ env['warden'].authenticate(:pass, :scope => :foo)
+ env['warden'].authenticate(:invalid, :scope => :bar)
+- env['warden'].should be_authenticated(:foo)
+- env['warden'].should_not be_authenticated(:bar)
++ expect(env['warden']).to be_authenticated(:foo)
++ expect(env['warden']).not_to be_authenticated(:bar)
+ valid_response
+ end
+ setup_rack(app).call(@env)
+@@ -199,7 +199,7 @@
+ env["rack.session"]["counter"] += 1
+ if env["warden.on"]
+ env["warden"].authenticate!(:pass)
+- env["warden"].should be_authenticated
++ expect(env["warden"]).to be_authenticated
+ end
+ valid_response
+ end
+@@ -207,29 +207,29 @@
+ # Setup a rack app with Pool session.
+ app = setup_rack(app, :session => Rack::Session::Pool).to_app
+ response = app.call(@env)
+- @env["rack.session"]["counter"].should == 1
++ expect(@env["rack.session"]["counter"]).to eq(1)
+
+ # Ensure a cookie was given back
+ cookie = response[1]["Set-Cookie"]
+- cookie.should_not be_nil
++ expect(cookie).not_to be_nil
+
+ # Ensure a session id was given
+ sid = cookie.match(SID_REGEXP)[1]
+- sid.should_not be_nil
++ expect(sid).not_to be_nil
+
+ # Do another request, giving a cookie but turning on warden authentication
+ env = env_with_params("/", {}, 'rack.session' => @env['rack.session'], "HTTP_COOKIE" => cookie, "warden.on" => true)
+ response = app.call(env)
+- env["rack.session"]["counter"].should == 2
++ expect(env["rack.session"]["counter"]).to eq(2)
+
+ # Regardless of rack version, a cookie should be sent back
+ new_cookie = response[1]["Set-Cookie"]
+- new_cookie.should_not be_nil
++ expect(new_cookie).not_to be_nil
+
+ # And the session id in this cookie should not be the same as the previous one
+ new_sid = new_cookie.match(SID_REGEXP)[1]
+- new_sid.should_not be_nil
+- new_sid.should_not == sid
++ expect(new_sid).not_to be_nil
++ expect(new_sid).not_to eq(sid)
+ end
+
+ it "should not renew session when user is fetch" do
+@@ -237,27 +237,27 @@
+ env["rack.session"]["counter"] ||= 0
+ env["rack.session"]["counter"] += 1
+ env["warden"].authenticate!(:pass)
+- env["warden"].should be_authenticated
++ expect(env["warden"]).to be_authenticated
+ valid_response
+ end
+
+ # Setup a rack app with Pool session.
+ app = setup_rack(app, :session => Rack::Session::Pool).to_app
+ response = app.call(@env)
+- @env["rack.session"]["counter"].should == 1
++ expect(@env["rack.session"]["counter"]).to eq(1)
+
+ # Ensure a cookie was given back
+ cookie = response[1]["Set-Cookie"]
+- cookie.should_not be_nil
++ expect(cookie).not_to be_nil
+
+ # Ensure a session id was given
+ sid = cookie.match(SID_REGEXP)[1]
+- sid.should_not be_nil
++ expect(sid).not_to be_nil
+
+ # Do another request, passing the cookie. The user should be fetched from cookie.
+ env = env_with_params("/", {}, "HTTP_COOKIE" => cookie)
+ response = app.call(env)
+- env["rack.session"]["counter"].should == 2
++ expect(env["rack.session"]["counter"]).to eq(2)
+
+ # Depending on rack version, a cookie will be returned with the
+ # same session id or no cookie is given back (becase it did not change).
+@@ -274,10 +274,10 @@
+ it "should run strategies just once for a given scope" do
+ app = lambda do |env|
+ env['warden'].authenticate(:password, :pass, :scope => :failz)
+- env['warden'].should_not be_authenticated(:failz)
++ expect(env['warden']).not_to be_authenticated(:failz)
+ env['warden'].authenticate(:password, :pass, :scope => :failz)
+- env['warden'].should_not be_authenticated(:failz)
+- env['warden.spec.strategies'].should == [:password, :pass]
++ expect(env['warden']).not_to be_authenticated(:failz)
++ expect(env['warden.spec.strategies']).to eq([:password, :pass])
+ valid_response
+ end
+ setup_rack(app).call(@env)
+@@ -288,7 +288,7 @@
+ env['warden'].authenticate(:password, :pass, :scope => :failz)
+ env['warden'].clear_strategies_cache!(:scope => :failz)
+ env['warden'].authenticate(:password, :pass, :scope => :failz)
+- env['warden.spec.strategies'].should == [:password, :pass, :password, :pass]
++ expect(env['warden.spec.strategies']).to eq([:password, :pass, :password, :pass])
+ valid_response
+ end
+ setup_rack(app).call(@env)
+@@ -299,7 +299,7 @@
+ env['warden'].authenticate(:password, :pass, :scope => :failz)
+ env['warden'].clear_strategies_cache!(:password, :scope => :failz)
+ env['warden'].authenticate(:password, :pass, :scope => :failz)
+- env['warden.spec.strategies'].should == [:password, :pass, :password]
++ expect(env['warden.spec.strategies']).to eq([:password, :pass, :password])
+ valid_response
+ end
+ setup_rack(app).call(@env)
+@@ -308,10 +308,10 @@
+ it "should run the strategies several times for different scopes" do
+ app = lambda do |env|
+ env['warden'].authenticate(:password, :pass, :scope => :failz)
+- env['warden'].should_not be_authenticated(:failz)
++ expect(env['warden']).not_to be_authenticated(:failz)
+ env['warden'].authenticate(:password, :pass)
+- env['warden'].should be_authenticated
+- env['warden.spec.strategies'].should == [:password, :pass, :password, :pass]
++ expect(env['warden']).to be_authenticated
++ expect(env['warden.spec.strategies']).to eq([:password, :pass, :password, :pass])
+ valid_response
+ end
+ setup_rack(app).call(@env)
+@@ -320,9 +320,9 @@
+ it "should not run strategies until cache is cleaned if latest winning strategy halted" do
+ app = lambda do |env|
+ env['warden'].authenticate(:failz)
+- env['warden'].should_not be_authenticated
++ expect(env['warden']).not_to be_authenticated
+ env['warden'].authenticate(:pass)
+- env['warden'].winning_strategy.message.should == "The Fails Strategy Has Failed You"
++ expect(env['warden'].winning_strategy.message).to eq("The Fails Strategy Has Failed You")
+ valid_response
+ end
+ setup_rack(app).call(@env)
+@@ -332,9 +332,9 @@
+ session = Warden::SessionSerializer.new(@env)
+ app = lambda do |env|
+ env['warden'].authenticate(:single)
+- env['warden'].should be_authenticated
+- env['warden'].user.should == "Valid User"
+- session.should_not be_stored(:default)
++ expect(env['warden']).to be_authenticated
++ expect(env['warden'].user).to eq("Valid User")
++ expect(session).not_to be_stored(:default)
+ valid_response
+ end
+ setup_rack(app).call(@env)
+@@ -345,9 +345,9 @@
+ it "should store the user into the session" do
+ app = lambda do |env|
+ env['warden'].authenticate(:pass)
+- env['warden'].should be_authenticated
+- env['warden'].user.should == "Valid User"
+- env['rack.session']["warden.user.default.key"].should == "Valid User"
++ expect(env['warden']).to be_authenticated
++ expect(env['warden'].user).to eq("Valid User")
++ expect(env['rack.session']["warden.user.default.key"]).to eq("Valid User")
+ valid_response
+ end
+ setup_rack(app).call(@env)
+@@ -356,9 +356,9 @@
+ it "should not store the user if the :store option is set to false" do
+ app = lambda do |env|
+ env['warden'].authenticate(:pass, :store => false)
+- env['warden'].should be_authenticated
+- env['warden'].user.should == "Valid User"
+- env['rack.session']['warden.user.default.key'].should be_nil
++ expect(env['warden']).to be_authenticated
++ expect(env['warden'].user).to eq("Valid User")
++ expect(env['rack.session']['warden.user.default.key']).to be_nil
+ valid_response
+ end
+ setup_rack(app).call(@env)
+@@ -368,8 +368,8 @@
+ app = lambda do |env|
+ env['rack.session'] = nil
+ env['warden'].authenticate(:pass, :store => false)
+- env['warden'].should be_authenticated
+- env['warden'].user.should == "Valid User"
++ expect(env['warden']).to be_authenticated
++ expect(env['warden'].user).to eq("Valid User")
+ valid_response
+ end
+ setup_rack(app).call(@env)
+@@ -377,7 +377,7 @@
+
+ it "should not run the callbacks when :run_callbacks is false" do
+ app = lambda do |env|
+- env['warden'].manager.should_not_receive(:_run_callbacks)
++ expect(env['warden'].manager).not_to receive(:_run_callbacks)
+ env['warden'].authenticate(:run_callbacks => false, :scope => :pass)
+ valid_response
+ end
+@@ -386,7 +386,7 @@
+
+ it "should run the callbacks when :run_callbacks is true" do
+ app = lambda do |env|
+- env['warden'].manager.should_receive(:_run_callbacks).at_least(:once)
++ expect(env['warden'].manager).to receive(:_run_callbacks).at_least(:once)
+ env['warden'].authenticate(:pass)
+ valid_response
+ end
+@@ -395,7 +395,7 @@
+
+ it "should run the callbacks by default" do
+ app = lambda do |env|
+- env['warden'].manager.should_receive(:_run_callbacks).at_least(:once)
++ expect(env['warden'].manager).to receive(:_run_callbacks).at_least(:once)
+ env['warden'].authenticate(:pass)
+ valid_response
+ end
+@@ -408,7 +408,7 @@
+ app = lambda do |env|
+ env['warden'].lock!
+ env['warden'].authenticate(:pass)
+- env['warden'].user.should be_nil
++ expect(env['warden'].user).to be_nil
+ valid_response
+ end
+ end
+@@ -417,7 +417,7 @@
+ app = lambda do |env|
+ env['warden'].authenticate(:pass)
+ env['warden'].lock!
+- env['warden'].user.should be
++ expect(env['warden'].user).to be
+ valid_response
+ end
+ end
+@@ -431,7 +431,7 @@
+
+ it "should return nil when not logged in" do
+ app = lambda do |env|
+- env['warden'].user.should be_nil
++ expect(env['warden'].user).to be_nil
+ valid_response
+ end
+ setup_rack(app).call(@env)
+@@ -439,18 +439,18 @@
+
+ it "should not run strategies when not logged in" do
+ app = lambda do |env|
+- env['warden'].user.should be_nil
+- env['warden.spec.strategies'].should be_nil
++ expect(env['warden'].user).to be_nil
++ expect(env['warden.spec.strategies']).to be_nil
+ valid_response
+ end
+ setup_rack(app).call(@env)
+ end
+
+ it "should cache unfound user" do
+- Warden::SessionSerializer.any_instance.should_receive(:fetch).once
++ expect_any_instance_of(Warden::SessionSerializer).to receive(:fetch).once
+ app = lambda do |env|
+- env['warden'].user.should be_nil
+- env['warden'].user.should be_nil
++ expect(env['warden'].user).to be_nil
++ expect(env['warden'].user).to be_nil
+ valid_response
+ end
+ setup_rack(app).call(@env)
+@@ -464,17 +464,17 @@
+
+ it "should take the user from the session when logged in" do
+ app = lambda do |env|
+- env['warden'].user.should == "A Previous User"
++ expect(env['warden'].user).to eq("A Previous User")
+ valid_response
+ end
+ setup_rack(app).call(@env)
+ end
+
+ it "should cache found user" do
+- Warden::SessionSerializer.any_instance.should_receive(:fetch).once.and_return "A Previous User"
++ expect_any_instance_of(Warden::SessionSerializer).to receive(:fetch).once.and_return "A Previous User"
+ app = lambda do |env|
+- env['warden'].user.should == "A Previous User"
+- env['warden'].user.should == "A Previous User"
++ expect(env['warden'].user).to eq("A Previous User")
++ expect(env['warden'].user).to eq("A Previous User")
+ valid_response
+ end
+ setup_rack(app).call(@env)
+@@ -486,13 +486,13 @@
+ valid_response
+ end
+ setup_rack(app).call(@env)
+- @env['warden.spec.strategies'].should_not include(:pass)
++ expect(@env['warden.spec.strategies']).not_to include(:pass)
+ end
+
+ describe "run callback option" do
+ it "should not call run_callbacks when we pass a :run_callback => false" do
+ app = lambda do |env|
+- env['warden'].manager.should_not_receive(:_run_callbacks)
++ expect(env['warden'].manager).not_to receive(:_run_callbacks)
+ env['warden'].user(:run_callbacks => false)
+ valid_response
+ end
+@@ -501,7 +501,7 @@
+
+ it "should call run_callbacks when we pass a :run_callback => true" do
+ app = lambda do |env|
+- env['warden'].manager.should_receive(:_run_callbacks).at_least(:once)
++ expect(env['warden'].manager).to receive(:_run_callbacks).at_least(:once)
+ env['warden'].user(:run_callbacks => true)
+ valid_response
+ end
+@@ -510,7 +510,7 @@
+
+ it "should call run_callbacks by default" do
+ app = lambda do |env|
+- env['warden'].manager.should_receive(:_run_callbacks).at_least(:once)
++ expect(env['warden'].manager).to receive(:_run_callbacks).at_least(:once)
+ env['warden'].user
+ valid_response
+ end
+@@ -533,54 +533,54 @@
+ @app = setup_rack(@app)
+ @env['warden.spec.which_logout'] = :foo
+ @app.call(@env)
+- @env['rack.session']['warden.user.default.key'].should == "default key"
+- @env['rack.session']['warden.user.foo.key'].should be_nil
+- @env['rack.session'][:foo].should == "bar"
++ expect(@env['rack.session']['warden.user.default.key']).to eq("default key")
++ expect(@env['rack.session']['warden.user.foo.key']).to be_nil
++ expect(@env['rack.session'][:foo]).to eq("bar")
+ end
+
+ it "should logout only the scoped default user" do
+ @app = setup_rack(@app)
+ @env['warden.spec.which_logout'] = :default
+ @app.call(@env)
+- @env['rack.session']['warden.user.default.key'].should be_nil
+- @env['rack.session']['warden.user.foo.key'].should == "foo key"
+- @env['rack.session'][:foo].should == "bar"
++ expect(@env['rack.session']['warden.user.default.key']).to be_nil
++ expect(@env['rack.session']['warden.user.foo.key']).to eq("foo key")
++ expect(@env['rack.session'][:foo]).to eq("bar")
+ end
+
+ it "should clear the session when no argument is given to logout" do
+- @env['rack.session'].should_not be_nil
++ expect(@env['rack.session']).not_to be_nil
+ app = lambda do |e|
+ e['warden'].logout
+ valid_response
+ end
+ setup_rack(app).call(@env)
+- @env['rack.session'].should be_empty
++ expect(@env['rack.session']).to be_empty
+ end
+
+ it "should not raise exception if raw_session is nil" do
+ @app = setup_rack(@app, { nil_session: true })
+ @env['rack.session'] = nil
+ @env['warden.spec.which_logout'] = :foo
+- expect { @app.call(@env) }.to_not raise_error(NoMethodError)
++ expect { @app.call(@env) }.to_not raise_error
+ end
+
+ it "should clear the user when logging out" do
+- @env['rack.session'].should_not be_nil
++ expect(@env['rack.session']).not_to be_nil
+ app = lambda do |e|
+- e['warden'].user.should_not be_nil
++ expect(e['warden'].user).not_to be_nil
+ e['warden'].logout
+- e['warden'].should_not be_authenticated
+- e['warden'].user.should be_nil
++ expect(e['warden']).not_to be_authenticated
++ expect(e['warden'].user).to be_nil
+ valid_response
+ end
+ setup_rack(app).call(@env)
+- @env['warden'].user.should be_nil
++ expect(@env['warden'].user).to be_nil
+ end
+
+ it "should clear the session data when logging out" do
+- @env['rack.session'].should_not be_nil
++ expect(@env['rack.session']).not_to be_nil
+ app = lambda do |e|
+- e['warden'].user.should_not be_nil
++ expect(e['warden'].user).not_to be_nil
+ e['warden'].session[:foo] = :bar
+ e['warden'].logout
+ valid_response
+@@ -589,10 +589,10 @@
+ end
+
+ it "should clear out the session by calling reset_session! so that plugins can setup their own session clearing" do
+- @env['rack.session'].should_not be_nil
++ expect(@env['rack.session']).not_to be_nil
+ app = lambda do |e|
+- e['warden'].user.should_not be_nil
+- e['warden'].should_receive(:reset_session!)
++ expect(e['warden'].user).not_to be_nil
++ expect(e['warden']).to receive(:reset_session!)
+ e['warden'].logout
+ valid_response
+ end
+@@ -609,7 +609,7 @@
+ e['warden'].authenticate! :failz
+ end
+ result = setup_rack(app, :failure_app => failure).call(@env)
+- result.last.should == ["The Fails Strategy Has Failed You"]
++ expect(result.last).to eq(["The Fails Strategy Has Failed You"])
+ end
+
+ it "should allow access to the success message" do
+@@ -621,7 +621,7 @@
+ success.call(e)
+ end
+ result = setup_rack(app).call(@env)
+- result.last.should == ["The Success Strategy Has Accepted You"]
++ expect(result.last).to eq(["The Success Strategy Has Accepted You"])
+ end
+
+ it "should not die when accessing a message from a source where no authentication has occured" do
+@@ -629,7 +629,7 @@
+ [200, {"Content-Type" => "text/plain"}, [e['warden'].message]]
+ end
+ result = setup_rack(app).call(@env)
+- result[2].should == [nil]
++ expect(result[2]).to eq([nil])
+ end
+ end
+
+@@ -637,8 +637,8 @@
+ it "should return false for authenticated? when there are no valid? strategies" do
+ @env['rack.session'] = {}
+ app = lambda do |e|
+- e['warden'].authenticate(:invalid).should be_nil
+- e['warden'].should_not be_authenticated
++ expect(e['warden'].authenticate(:invalid)).to be_nil
++ expect(e['warden']).not_to be_authenticated
+ end
+ setup_rack(app).call(@env)
+ end
+@@ -646,7 +646,7 @@
+ it "should return nil for authenticate when there are no valid strategies" do
+ @env['rack.session'] = {}
+ app = lambda do |e|
+- e['warden'].authenticate(:invalid).should be_nil
++ expect(e['warden'].authenticate(:invalid)).to be_nil
+ end
+ setup_rack(app).call(@env)
+ end
+@@ -654,7 +654,7 @@
+ it "should return false for authenticate? when there are no valid strategies" do
+ @env['rack.session'] = {}
+ app = lambda do |e|
+- e['warden'].authenticate?(:invalid).should be_false
++ expect(e['warden'].authenticate?(:invalid)).to be_falsey
+ end
+ setup_rack(app).call(@env)
+ end
+@@ -665,7 +665,7 @@
+ e['warden'].authenticate!(:invalid)
+ end
+ result = setup_rack(app).call(@env)
+- result.first.should == 401
++ expect(result.first).to eq(401)
+ end
+ end
+
+@@ -678,7 +678,7 @@
+
+ it "should return true when authenticated in the session" do
+ app = lambda do |e|
+- e['warden'].should be_authenticated
++ expect(e['warden']).to be_authenticated
+ end
+ setup_rack(app).call(@env)
+ end
+@@ -690,7 +690,7 @@
+ end
+ end
+ setup_rack(app).call(@env)
+- $captures.should == [:in_the_block]
++ expect($captures).to eq([:in_the_block])
+ end
+
+ it "should authenticate for a user in a different scope" do
+@@ -701,7 +701,7 @@
+ end
+ end
+ setup_rack(app).call(@env)
+- $captures.should == [:in_the_foo_block]
++ expect($captures).to eq([:in_the_foo_block])
+ end
+ end
+
+@@ -713,7 +713,7 @@
+
+ it "should return false when authenticated in the session" do
+ app = lambda do |e|
+- e['warden'].should_not be_authenticated
++ expect(e['warden']).not_to be_authenticated
+ end
+ setup_rack(app).call(@env)
+ end
+@@ -727,7 +727,7 @@
+ valid_response
+ end
+ setup_rack(app).call(@env)
+- @env['warden'].user(:foo_scope).should be_nil
++ expect(@env['warden'].user(:foo_scope)).to be_nil
+ ensure
+ Warden::Manager.serialize_from_session { |k| k }
+ end
+@@ -740,7 +740,7 @@
+ end
+ end
+ setup_rack(app).call(@env)
+- $captures.should == []
++ expect($captures).to eq([])
+ end
+
+ it "should not yield for a user in a different scope" do
+@@ -750,7 +750,7 @@
+ end
+ end
+ setup_rack(app).call(@env)
+- $captures.should == []
++ expect($captures).to eq([])
+ end
+ end
+ end
+@@ -764,7 +764,7 @@
+
+ it "should return false when authenticated in the session" do
+ app = lambda do |e|
+- e['warden'].should_not be_unauthenticated
++ expect(e['warden']).not_to be_unauthenticated
+ end
+ result = setup_rack(app).call(@env)
+ end
+@@ -776,7 +776,7 @@
+ end
+ end
+ setup_rack(app).call(@env)
+- $captures.should == []
++ expect($captures).to eq([])
+ end
+
+ it "should not yield to the block for a user in a different scope" do
+@@ -787,7 +787,7 @@
+ end
+ end
+ setup_rack(app).call(@env)
+- $captures.should == []
++ expect($captures).to eq([])
+ end
+ end
+
+@@ -799,7 +799,7 @@
+
+ it "should return false when unauthenticated in the session" do
+ app = lambda do |e|
+- e['warden'].should be_unauthenticated
++ expect(e['warden']).to be_unauthenticated
+ end
+ setup_rack(app).call(@env)
+ end
+@@ -811,7 +811,7 @@
+ end
+ end
+ setup_rack(app).call(@env)
+- $captures.should == [:in_the_block]
++ expect($captures).to eq([:in_the_block])
+ end
+
+ it "should yield for a user in a different scope" do
+@@ -821,7 +821,7 @@
+ end
+ end
+ setup_rack(app).call(@env)
+- $captures.should == [:in_the_bar_block]
++ expect($captures).to eq([:in_the_bar_block])
+ end
+ end
+ end
+@@ -833,7 +833,7 @@
+
+ it "should have a config attribute" do
+ app = def_app do |e|
+- e['warden'].config.should be_a_kind_of(Hash)
++ expect(e['warden'].config).to be_a_kind_of(Hash)
+ valid_response
+ end
+ app.call(@env)
+@@ -881,27 +881,27 @@
+
+ it "should allow me to change the default strategies on the fly" do
+ app = wrap_app(@app) do |e|
+- e['warden'].default_strategies.should == [:password]
+- e['warden'].config.default_strategies.should == [:password]
++ expect(e['warden'].default_strategies).to eq([:password])
++ expect(e['warden'].config.default_strategies).to eq([:password])
+ e['warden'].default_strategies :one
+ e['warden'].authenticate!
+ Rack::Response.new("OK").finish
+ end
+ setup_rack(app).call(@env)
+
+- $captures.should == [:one]
++ expect($captures).to eq([:one])
+ end
+
+ it "should allow me to append to the default strategies on the fly" do
+ app = wrap_app(@app) do |e|
+ e['warden'].default_strategies << :one
+- e['warden'].default_strategies.should == [:password, :one]
++ expect(e['warden'].default_strategies).to eq([:password, :one])
+ e['warden'].authenticate!
+ Rack::Response.new("OK").finish
+ end
+ setup_rack(app).call(@env)
+
+- $captures.should == [:one]
++ expect($captures).to eq([:one])
+ end
+
+ it "should allow me to set the default strategies on a per scope basis" do
+@@ -909,15 +909,15 @@
+ w = e['warden']
+ w.default_strategies(:two, :one, :scope => :foo)
+ w.default_strategies(:two, :scope => :default)
+- w.default_strategies(:scope => :foo).should == [:two, :one]
++ expect(w.default_strategies(:scope => :foo)).to eq([:two, :one])
+ w.authenticate(:scope => :foo)
+- $captures.should == [:two, :one]
++ expect($captures).to eq([:two, :one])
+ $captures.clear
+ w.authenticate
+- $captures.should == [:two]
++ expect($captures).to eq([:two])
+ end
+ setup_rack(app).call(@env)
+- $captures.should == [:two]
++ expect($captures).to eq([:two])
+ end
+
+ it "should allow me to setup default strategies for each scope on the manager" do
+@@ -939,20 +939,20 @@
+ end)
+ end
+ builder.to_app.call(@env)
+- $captures.should include(:complete)
++ expect($captures).to include(:complete)
+ end
+
+ it "should not change the master configurations strategies when I change them" do
+ app = wrap_app(@app) do |e|
+ e['warden'].default_strategies << :one
+- e['warden'].default_strategies.should == [:password, :one]
+- e['warden'].manager.config.default_strategies.should == [:password]
++ expect(e['warden'].default_strategies).to eq([:password, :one])
++ expect(e['warden'].manager.config.default_strategies).to eq([:password])
+ e['warden'].authenticate!
+ Rack::Response.new("OK").finish
+ end
+ setup_rack(app).call(@env)
+
+- $captures.should == [:one]
++ expect($captures).to eq([:one])
+ end
+
+ describe "default scope options" do
+@@ -974,7 +974,7 @@
+ env["rack.session"] = {}
+ builder.to_app.call(env)
+ request = Rack::Request.new(env)
+- request.path.should == "/some_bad_action"
++ expect(request.path).to eq("/some_bad_action")
+ end
+
+ it "should allow me to set store, false on a given scope" do
+@@ -1005,12 +1005,12 @@
+ end
+ session = @env["rack.session"] = {}
+ builder.to_app.call(@env)
+- $captures.should include(:complete)
+- session['warden.user.default.key'].should == "User"
+- session['warden.user.foo.key'].should == "User"
+- session.key?('warden.user.bar.key').should be_false
+- session['warden.user.bar.key'].should be_nil
+- session['warden.user.baz.key'].should == "User"
++ expect($captures).to include(:complete)
++ expect(session['warden.user.default.key']).to eq("User")
++ expect(session['warden.user.foo.key']).to eq("User")
++ expect(session.key?('warden.user.bar.key')).to be_falsey
++ expect(session['warden.user.bar.key']).to be_nil
++ expect(session['warden.user.baz.key']).to eq("User")
+ end
+ end
+
+@@ -1025,8 +1025,8 @@
+ setup_rack(success_app).call(env)
+ proxy = env["warden"]
+
+- proxy.env['PATH_INFO'].should match(@asset_regex)
+- proxy.should be_asset_request
++ expect(proxy.env['PATH_INFO']).to match(@asset_regex)
++ expect(proxy).to be_asset_request
+ end
+
+ it "should return false if PATH_INFO is not in asset list" do
+@@ -1034,8 +1034,8 @@
+ setup_rack(success_app).call(env)
+ proxy = env["warden"]
+
+- proxy.env['PATH_INFO'].should_not match(@asset_regex)
+- proxy.should_not be_asset_request
++ expect(proxy.env['PATH_INFO']).not_to match(@asset_regex)
++ expect(proxy).not_to be_asset_request
+ end
+ end
+ end
+--- a/spec/warden/scoped_session_serializer.rb
++++ b/spec/warden/scoped_session_serializer.rb
+@@ -31,25 +31,25 @@
+ end
+
+ it "should respond to :serialize" do
+- serializer_respond_to?(:serialize).should == true
++ expect(serializer_respond_to?(:serialize)).to eq(true)
+ end
+
+ it "should respond to :deserialize" do
+- serializer_respond_to?(:deserialize).should == true
++ expect(serializer_respond_to?(:deserialize)).to eq(true)
+ end
+
+ it "should respond to {scope}_deserialize if Manager.serialize_from_session is called with scope" do
+ Rack::Builder.new do
+ Warden::Manager.serialize_from_session ( :admin ) { |n| n }
+ end
+- serializer_respond_to?(:admin_deserialize).should == true
++ expect(serializer_respond_to?(:admin_deserialize)).to eq(true)
+ end
+
+ it "should respond to {scope}_serialize if Manager.serialize_into_session is called with scope" do
+ Rack::Builder.new do
+ Warden::Manager.serialize_into_session(:admin) { |n| n }
+ end
+- serializer_respond_to?(:admin_serialize).should == true
++ expect(serializer_respond_to?(:admin_serialize)).to eq(true)
+ end
+
+ def initialize_with_scope(scope, &block)
+@@ -66,11 +66,11 @@
+ end
+ serializer = Warden::SessionSerializer.new(@env)
+ serializer.store("user", :admin)
+- serialized_object.should == "user"
++ expect(serialized_object).to eq("user")
+ end
+
+ it "should not have a {scope}_serialize by default" do
+- serializer_respond_to?(:admin_serialize).should == false
++ expect(serializer_respond_to?(:admin_serialize)).to eq(false)
+ end
+
+ it "should execute {scope}_serialize when calling store with a scope" do
+@@ -82,7 +82,7 @@
+
+ serializer = Warden::SessionSerializer.new(@env)
+ serializer.store("user", :admin)
+- serialized_object.should == "user"
++ expect(serialized_object).to eq("user")
+ end
+
+
+@@ -100,7 +100,7 @@
+ @env['rack.session'][serializer.key_for(:admin)] = "test"
+ serializer.fetch(:admin)
+
+- serialized_object.should == "test"
++ expect(serialized_object).to eq("test")
+ end
+
+ it "should execute deserialize if {scope}_deserialize is not present" do
+@@ -117,7 +117,7 @@
+ @env['rack.session'][serializer.key_for(:admin)] = "test"
+ serializer.fetch(:admin)
+
+- serialized_object.should == "test"
++ expect(serialized_object).to eq("test")
+ end
+
+ end
+--- a/spec/warden/session_serializer_spec.rb
++++ b/spec/warden/session_serializer_spec.rb
+@@ -10,44 +10,44 @@
+
+ it "should store data for the default scope" do
+ @session.store("user", :default)
+- @env['rack.session'].should == { "warden.user.default.key"=>"user" }
++ expect(@env['rack.session']).to eq({ "warden.user.default.key"=>"user" })
+ end
+
+ it "should check if a data is stored or not" do
+- @session.should_not be_stored(:default)
++ expect(@session).not_to be_stored(:default)
+ @session.store("user", :default)
+- @session.should be_stored(:default)
++ expect(@session).to be_stored(:default)
+ end
+
+ it "should load an user from store" do
+- @session.fetch(:default).should be_nil
++ expect(@session.fetch(:default)).to be_nil
+ @session.store("user", :default)
+- @session.fetch(:default).should == "user"
++ expect(@session.fetch(:default)).to eq("user")
+ end
+
+ it "should store data based on the scope" do
+ @session.store("user", :default)
+- @session.fetch(:default).should == "user"
+- @session.fetch(:another).should be_nil
++ expect(@session.fetch(:default)).to eq("user")
++ expect(@session.fetch(:another)).to be_nil
+ end
+
+ it "should delete data from store" do
+ @session.store("user", :default)
+- @session.fetch(:default).should == "user"
++ expect(@session.fetch(:default)).to eq("user")
+ @session.delete(:default)
+- @session.fetch(:default).should be_nil
++ expect(@session.fetch(:default)).to be_nil
+ end
+
+ it "should delete information from store if user cannot be retrieved" do
+ @session.store("user", :default)
+- @env['rack.session'].should have_key("warden.user.default.key")
++ expect(@env['rack.session']).to have_key("warden.user.default.key")
+ @session.instance_eval "def deserialize(key); nil; end"
+ @session.fetch(:default)
+- @env['rack.session'].should_not have_key("warden.user.default.key")
++ expect(@env['rack.session']).not_to have_key("warden.user.default.key")
+ end
+
+ it "should support a nil session store" do
+ @env['rack.session'] = nil
+- @session.fetch(:default).should be_nil
++ expect(@session.fetch(:default)).to be_nil
+ end
+ end
+--- a/spec/warden/strategies/base_spec.rb
++++ b/spec/warden/strategies/base_spec.rb
+@@ -17,7 +17,7 @@
+ end
+ strategy = Warden::Strategies[:foo].new(env_with_params)
+ strategy._run!
+- strategy.headers["foo"].should == "bar"
++ expect(strategy.headers["foo"]).to eq("bar")
+ end
+
+ it "should allow us to clear the headers" do
+@@ -28,9 +28,9 @@
+ end
+ strategy = Warden::Strategies[:foo].new(env_with_params)
+ strategy._run!
+- strategy.headers["foo"].should == "bar"
++ expect(strategy.headers["foo"]).to eq("bar")
+ strategy.headers.clear
+- strategy.headers.should be_empty
++ expect(strategy.headers).to be_empty
+ end
+ end
+
+@@ -42,7 +42,7 @@
+ end
+ strategy = RAS[:foobar].new(env_with_params)
+ strategy._run!
+- strategy.user.should == "foo"
++ expect(strategy.user).to eq("foo")
+ end
+
+ it "should be performed after run" do
+@@ -50,11 +50,11 @@
+ def authenticate!; end
+ end
+ strategy = RAS[:foobar].new(env_with_params)
+- strategy.should_not be_performed
++ expect(strategy).not_to be_performed
+ strategy._run!
+- strategy.should be_performed
++ expect(strategy).to be_performed
+ strategy.clear!
+- strategy.should_not be_performed
++ expect(strategy).not_to be_performed
+ end
+
+ it "should set the scope" do
+@@ -74,7 +74,7 @@
+ end
+ strategy = RAS[:foobar].new(env_with_params)
+ strategy._run!
+- strategy.message.should == "foo message"
++ expect(strategy.message).to eq("foo message")
+ end
+
+ it "should provide access to the errors" do
+@@ -87,7 +87,7 @@
+ env['warden'] = Warden::Proxy.new(env, Warden::Manager.new({}))
+ strategy = RAS[:foobar].new(env)
+ strategy._run!
+- strategy.errors.on(:foo).should == ["foo has an error"]
++ expect(strategy.errors.on(:foo)).to eq(["foo has an error"])
+ end
+
+ describe "halting" do
+@@ -99,7 +99,7 @@
+ end
+ str = RAS[:foobar].new(env_with_params)
+ str._run!
+- str.should be_halted
++ expect(str).to be_halted
+ end
+
+ it "should not be halted if halt was not called" do
+@@ -110,7 +110,7 @@
+ end
+ str = RAS[:foobar].new(env_with_params)
+ str._run!
+- str.should_not be_halted
++ expect(str).not_to be_halted
+ end
+
+ end
+@@ -124,8 +124,8 @@
+ end
+ str = RAS[:foobar].new(env_with_params)
+ str._run!
+- str.should_not be_halted
+- str.user.should be_nil
++ expect(str).not_to be_halted
++ expect(str.user).to be_nil
+ end
+ end
+
+@@ -138,7 +138,7 @@
+ end
+ str = RAS[:foobar].new(env_with_params)
+ str._run!
+- str.user.should be_nil
++ expect(str.user).to be_nil
+ end
+
+ it "should mark the strategy as halted when redirecting" do
+@@ -149,7 +149,7 @@
+ end
+ str = RAS[:foobar].new(env_with_params)
+ str._run!
+- str.should be_halted
++ expect(str).to be_halted
+ end
+
+ it "should escape redirected url parameters" do
+@@ -160,7 +160,7 @@
+ end
+ str = RAS[:foobar].new(env_with_params)
+ str._run!
+- str.headers["Location"].should == "/foo/bar?foo=bar"
++ expect(str.headers["Location"]).to eq("/foo/bar?foo=bar")
+ end
+
+ it "should allow you to set a message" do
+@@ -171,8 +171,8 @@
+ end
+ str = RAS[:foobar].new(env_with_params)
+ str._run!
+- str.headers["Location"].should == "/foo/bar?foo=bar"
+- str.message.should == "You are being redirected foo"
++ expect(str.headers["Location"]).to eq("/foo/bar?foo=bar")
++ expect(str.message).to eq("You are being redirected foo")
+ end
+
+ it "should set the action as :redirect" do
+@@ -183,7 +183,7 @@
+ end
+ str = RAS[:foobar].new(env_with_params)
+ str._run!
+- str.result.should == :redirect
++ expect(str.result).to eq(:redirect)
+ end
+ end
+
+@@ -207,42 +207,42 @@
+
+ it "should allow you to fail hard" do
+ @hard._run!
+- @hard.user.should be_nil
++ expect(@hard.user).to be_nil
+ end
+
+ it "should halt the strategies when failing hard" do
+ @hard._run!
+- @hard.should be_halted
++ expect(@hard).to be_halted
+ end
+
+ it "should allow you to set a message when failing hard" do
+ @hard._run!
+- @hard.message.should == "You are not cool enough"
++ expect(@hard.message).to eq("You are not cool enough")
+ end
+
+ it "should set the action as :failure when failing hard" do
+ @hard._run!
+- @hard.result.should == :failure
++ expect(@hard.result).to eq(:failure)
+ end
+
+ it "should allow you to fail soft" do
+ @soft._run!
+- @soft.user.should be_nil
++ expect(@soft.user).to be_nil
+ end
+
+ it "should not halt the strategies when failing soft" do
+ @soft._run!
+- @soft.should_not be_halted
++ expect(@soft).not_to be_halted
+ end
+
+ it "should allow you to set a message when failing soft" do
+ @soft._run!
+- @soft.message.should == "You are too soft"
++ expect(@soft.message).to eq("You are too soft")
+ end
+
+ it "should set the action as :failure when failing soft" do
+ @soft._run!
+- @soft.result.should == :failure
++ expect(@soft.result).to eq(:failure)
+ end
+ end
+
+@@ -262,22 +262,22 @@
+
+ it "should be authenticated after success" do
+ @str._run!
+- @str.user.should_not be_nil
++ expect(@str.user).not_to be_nil
+ end
+
+ it "should allow you to set a message when succeeding" do
+ @str._run!
+- @str.message.should == "Welcome to the club!"
++ expect(@str.message).to eq("Welcome to the club!")
+ end
+
+ it "should store the user" do
+ @str._run!
+- @str.user.should == "Foo User"
++ expect(@str.user).to eq("Foo User")
+ end
+
+ it "should set the action as :success" do
+ @str._run!
+- @str.result.should == :success
++ expect(@str.result).to eq(:success)
+ end
+ end
+
+@@ -293,20 +293,20 @@
+ end
+
+ it "should allow me to set a custom rack response" do
+- @str.user.should be_nil
++ expect(@str.user).to be_nil
+ end
+
+ it "should halt the strategy" do
+- @str.should be_halted
++ expect(@str).to be_halted
+ end
+
+ it "should provide access to the custom rack response" do
+- @str.custom_response.should == [521, {"foo" => "bar"}, ["BAD"]]
++ expect(@str.custom_response).to eq([521, {"foo" => "bar"}, ["BAD"]])
+ end
+
+ it "should set the action as :custom" do
+ @str._run!
+- @str.result.should == :custom
++ expect(@str.result).to eq(:custom)
+ end
+ end
+
+--- a/spec/warden/strategies_spec.rb
++++ b/spec/warden/strategies_spec.rb
+@@ -8,14 +8,14 @@
+ success("foo")
+ end
+ end
+- Warden::Strategies[:strategy1].ancestors.should include(Warden::Strategies::Base)
++ expect(Warden::Strategies[:strategy1].ancestors).to include(Warden::Strategies::Base)
+ end
+
+ it "should raise an error if I add a strategy via a block, that does not have an authenticate! method" do
+- lambda do
++ expect do
+ Warden::Strategies.add(:strategy2) do
+ end
+- end.should raise_error
++ end.to raise_error
+ end
+
+ it "should raise an error if I add a strategy that does not extend Warden::Strategies::Base" do
+@@ -33,25 +33,25 @@
+ def authenticate!; end
+ end
+ strategy = Warden::Strategies[:strategy3]
+- strategy.should_not be_nil
+- strategy.ancestors.should include(Warden::Strategies::Base)
++ expect(strategy).not_to be_nil
++ expect(strategy.ancestors).to include(Warden::Strategies::Base)
+ end
+
+ it "should allow me to add a strategy with the required methods" do
+ class MyStrategy < Warden::Strategies::Base
+ def authenticate!; end
+ end
+- lambda do
++ expect do
+ Warden::Strategies.add(:strategy4, MyStrategy)
+- end.should_not raise_error
++ end.not_to raise_error
+ end
+
+ it "should not allow a strategy that does not have an authenticate! method" do
+ class MyOtherStrategy
+ end
+- lambda do
++ expect do
+ Warden::Strategies.add(:strategy5, MyOtherStrategy)
+- end.should raise_error
++ end.to raise_error
+ end
+
+ it "should allow me to change a class when providing a block and class" do
+@@ -62,7 +62,7 @@
+ def authenticate!; end
+ end
+
+- Warden::Strategies[:foo].ancestors.should include(MyStrategy)
++ expect(Warden::Strategies[:foo].ancestors).to include(MyStrategy)
+ end
+
+ it "should allow me to update a previously given strategy" do
+@@ -77,7 +77,7 @@
+ include new_module
+ end
+
+- Warden::Strategies[:strategy6].ancestors.should include(new_module)
++ expect(Warden::Strategies[:strategy6].ancestors).to include(new_module)
+ end
+
+ it "should allow me to clear the strategies" do
+@@ -86,8 +86,8 @@
+ :foo
+ end
+ end
+- Warden::Strategies[:foobar].should_not be_nil
++ expect(Warden::Strategies[:foobar]).not_to be_nil
+ Warden::Strategies.clear!
+- Warden::Strategies[:foobar].should be_nil
++ expect(Warden::Strategies[:foobar]).to be_nil
+ end
+ end
+--- a/spec/warden/test/helpers_spec.rb
++++ b/spec/warden/test/helpers_spec.rb
+@@ -10,12 +10,12 @@
+ login_as user
+ app = lambda{|e|
+ $captures << :run
+- e['warden'].should be_authenticated
+- e['warden'].user.should == "A User"
++ expect(e['warden']).to be_authenticated
++ expect(e['warden'].user).to eq("A User")
+ valid_response
+ }
+ setup_rack(app).call(env_with_params)
+- $captures.should == [:run]
++ expect($captures).to eq([:run])
+ end
+
+ it "should log me in as a user of a given scope" do
+@@ -24,11 +24,11 @@
+ app = lambda{|e|
+ $captures << :run
+ w = e['warden']
+- w.should be_authenticated(:foo_scope)
+- w.user(:foo_scope).should == {:some => "user"}
++ expect(w).to be_authenticated(:foo_scope)
++ expect(w.user(:foo_scope)).to eq({:some => "user"})
+ }
+ setup_rack(app).call(env_with_params)
+- $captures.should == [:run]
++ expect($captures).to eq([:run])
+ end
+
+ it "should login multiple users with different scopes" do
+@@ -39,13 +39,13 @@
+ app = lambda{|e|
+ $captures << :run
+ w = e['warden']
+- w.user.should == "A user"
+- w.user(:foo).should == "A foo user"
+- w.should be_authenticated
+- w.should be_authenticated(:foo)
++ expect(w.user).to eq("A user")
++ expect(w.user(:foo)).to eq("A foo user")
++ expect(w).to be_authenticated
++ expect(w).to be_authenticated(:foo)
+ }
+ setup_rack(app).call(env_with_params)
+- $captures.should == [:run]
++ expect($captures).to eq([:run])
+ end
+
+ it "should log out all users" do
+@@ -56,16 +56,16 @@
+ app = lambda{|e|
+ $captures << :run
+ w = e['warden']
+- w.user.should == "A user"
+- w.user(:foo).should == "Foo"
++ expect(w.user).to eq("A user")
++ expect(w.user(:foo)).to eq("Foo")
+ w.logout
+- w.user.should be_nil
+- w.user(:foo).should be_nil
+- w.should_not be_authenticated
+- w.should_not be_authenticated(:foo)
++ expect(w.user).to be_nil
++ expect(w.user(:foo)).to be_nil
++ expect(w).not_to be_authenticated
++ expect(w).not_to be_authenticated(:foo)
+ }
+ setup_rack(app).call(env_with_params)
+- $captures.should == [:run]
++ expect($captures).to eq([:run])
+ end
+
+ it "should logout a specific user" do
+@@ -77,17 +77,17 @@
+ $captures << :run
+ w = e['warden']
+ w.logout :foo
+- w.user.should == "A User"
+- w.user(:foo).should be_nil
+- w.should_not be_authenticated(:foo)
++ expect(w.user).to eq("A User")
++ expect(w.user(:foo)).to be_nil
++ expect(w).not_to be_authenticated(:foo)
+ }
+ setup_rack(app).call(env_with_params)
+- $captures.should == [:run]
++ expect($captures).to eq([:run])
+ end
+
+ describe "#asset_paths" do
+ it "should default asset_paths to anything asset path regex" do
+- Warden.asset_paths.should == [/^\/assets\//]
++ expect(Warden.asset_paths).to eq([/^\/assets\//])
+ end
+ end
+ end
+--- a/spec/warden/test/test_mode_spec.rb
++++ b/spec/warden/test/test_mode_spec.rb
+@@ -15,9 +15,9 @@
+ Warden.test_reset!
+ end
+
+- it{ Warden.should respond_to(:test_mode!) }
+- it{ Warden.should respond_to(:on_next_request) }
+- it{ Warden.should respond_to(:test_reset!) }
++ it{ expect(Warden).to respond_to(:test_mode!) }
++ it{ expect(Warden).to respond_to(:on_next_request) }
++ it{ expect(Warden).to respond_to(:test_reset!) }
+
+ it "should execute the on_next_request block on the next request" do
+ Warden.on_next_request do |warden|
+@@ -25,36 +25,36 @@
+ end
+
+ setup_rack(@app).call(env_with_params)
+- $captures.should have(1).item
+- $captures.first.should be_an_instance_of(Warden::Proxy)
++ expect($captures.size).to eq(1)
++ expect($captures.first).to be_an_instance_of(Warden::Proxy)
+ end
+
+ it "should execute many on_next_request blocks on the next request" do
+ Warden.on_next_request{|w| $captures << :first }
+ Warden.on_next_request{|w| $captures << :second }
+ setup_rack(@app).call(env_with_params)
+- $captures.should have(2).items
+- $captures.should == [:first, :second]
++ expect($captures.size).to eq(2)
++ expect($captures).to eq([:first, :second])
+ end
+
+ it "should not execute on_next_request blocks on subsequent requests" do
+ app = setup_rack(@app)
+ Warden.on_next_request{|w| $captures << :first }
+ app.call(env_with_params)
+- $captures.should == [:first]
++ expect($captures).to eq([:first])
+ $captures.clear
+ app.call(env_with_params)
+- $captures.should be_empty
++ expect($captures).to be_empty
+ end
+
+ it "should allow me to set new_on_next_request items to execute in the same test" do
+ app = setup_rack(@app)
+ Warden.on_next_request{|w| $captures << :first }
+ app.call(env_with_params)
+- $captures.should == [:first]
++ expect($captures).to eq([:first])
+ Warden.on_next_request{|w| $captures << :second }
+ app.call(env_with_params)
+- $captures.should == [:first, :second]
++ expect($captures).to eq([:first, :second])
+ end
+
+ it "should remove the on_next_request items when test is reset" do
+@@ -62,7 +62,7 @@
+ Warden.on_next_request{|w| $captures << :first }
+ Warden.test_reset!
+ app.call(env_with_params)
+- $captures.should == []
++ expect($captures).to eq([])
+ end
+
+ context "asset requests" do
+@@ -70,7 +70,7 @@
+ app = setup_rack(@app)
+ Warden.on_next_request{|w| $captures << :first }
+ app.call(env_with_params("/assets/fun.gif"))
+- $captures.should == []
++ expect($captures).to eq([])
+ end
+ end
+ end
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..4a6c93e
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+rspec3-port.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-warden.git
More information about the Pkg-ruby-extras-commits
mailing list