|
28 | 28 | @session.stub(:synchronized).and_yield
|
29 | 29 | @request = double "servlet request"
|
30 | 30 | @app = double "app"
|
| 31 | + @app.stub(:call).and_return [200, {}, ["body"]] |
31 | 32 | @env = {"java.servlet_request" => @request, "rack.errors" => $stderr}
|
32 | 33 | @session_store = ActionController::Session::JavaServletStore.new(@app)
|
33 | 34 | end
|
|
41 | 42 | @app.should_receive(:call)
|
42 | 43 | @session_store.call(@env)
|
43 | 44 | session = @env['rack.session']
|
44 |
| - @session_store.send(:loaded_session?, session).should == false |
| 45 | + expect(@session_store.send(:loaded_session?, session)).to eq false |
45 | 46 | end
|
46 | 47 |
|
47 | 48 | it "should pass the application response untouched" do
|
48 | 49 | response = [200, {}, ["body"]]
|
49 | 50 | @app.should_receive(:call).and_return response
|
50 |
| - @session_store.call(@env).should == response |
| 51 | + expect(@session_store.call(@env)).to eq response |
51 | 52 | end
|
52 | 53 |
|
53 | 54 | it "should load the session when accessed" do
|
|
74 | 75 | end
|
75 | 76 | @session_store.call(@env)
|
76 | 77 | session = @env['rack.session']
|
77 |
| - @session_store.send(:loaded_session?, session).should == true |
| 78 | + expect(@session_store.send(:loaded_session?, session)).to eq true |
78 | 79 | end
|
79 | 80 |
|
80 | 81 | it "should use custom session hash when loading session" do
|
|
103 | 104 | @session.should_receive(:getAttribute).with(session_key).and_return marshal_data.to_java_bytes
|
104 | 105 | @session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
|
105 | 106 | @app.should_receive(:call) do |env|
|
106 |
| - env['rack.session']["foo"].should == 1 |
107 |
| - env['rack.session']["bar"].should == true |
| 107 | + expect(env['rack.session']["foo"]).to eq 1 |
| 108 | + expect(env['rack.session']["bar"]).to eq true |
108 | 109 | end
|
109 | 110 | @session_store.call(@env)
|
110 | 111 | end
|
|
117 | 118 | @session.should_receive(:getAttribute).with("bar").and_return hash["bar"]
|
118 | 119 | @session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
|
119 | 120 | @app.should_receive(:call) do |env|
|
120 |
| - env['rack.session']["foo"].should == hash["foo"] |
121 |
| - env['rack.session']["bar"].should == hash["bar"] |
| 121 | + expect(env['rack.session']["foo"]).to eq hash["foo"] |
| 122 | + expect(env['rack.session']["bar"]).to eq hash["bar"] |
122 | 123 | end
|
123 | 124 | @session_store.call(@env)
|
124 | 125 | end
|
|
257 | 258 | @session.should_receive(:getLastAccessedTime).and_return time
|
258 | 259 | @session.stub(:setAttribute)
|
259 | 260 | @app.should_receive(:call) do |env|
|
260 |
| - env['rack.session'].getLastAccessedTime.should == time |
| 261 | + expect(env['rack.session'].getLastAccessedTime).to eq time |
261 | 262 | lambda { env['rack.session'].blah_blah }.should raise_error(NoMethodError)
|
262 | 263 | end
|
263 | 264 | @session_store.call(@env)
|
|
0 commit comments