Skip to content

Commit e34b0f6

Browse files
committed
Remove some deprecated rspec usage
1 parent 78bc656 commit e34b0f6

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/spec/ruby/action_controller/session/java_servlet_store_spec.rb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
@session.stub(:synchronized).and_yield
2929
@request = double "servlet request"
3030
@app = double "app"
31+
@app.stub(:call).and_return [200, {}, ["body"]]
3132
@env = {"java.servlet_request" => @request, "rack.errors" => $stderr}
3233
@session_store = ActionController::Session::JavaServletStore.new(@app)
3334
end
@@ -41,13 +42,13 @@
4142
@app.should_receive(:call)
4243
@session_store.call(@env)
4344
session = @env['rack.session']
44-
@session_store.send(:loaded_session?, session).should == false
45+
expect(@session_store.send(:loaded_session?, session)).to eq false
4546
end
4647

4748
it "should pass the application response untouched" do
4849
response = [200, {}, ["body"]]
4950
@app.should_receive(:call).and_return response
50-
@session_store.call(@env).should == response
51+
expect(@session_store.call(@env)).to eq response
5152
end
5253

5354
it "should load the session when accessed" do
@@ -74,7 +75,7 @@
7475
end
7576
@session_store.call(@env)
7677
session = @env['rack.session']
77-
@session_store.send(:loaded_session?, session).should == true
78+
expect(@session_store.send(:loaded_session?, session)).to eq true
7879
end
7980

8081
it "should use custom session hash when loading session" do
@@ -103,8 +104,8 @@
103104
@session.should_receive(:getAttribute).with(session_key).and_return marshal_data.to_java_bytes
104105
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
105106
@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
108109
end
109110
@session_store.call(@env)
110111
end
@@ -117,8 +118,8 @@
117118
@session.should_receive(:getAttribute).with("bar").and_return hash["bar"]
118119
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
119120
@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"]
122123
end
123124
@session_store.call(@env)
124125
end
@@ -257,7 +258,7 @@
257258
@session.should_receive(:getLastAccessedTime).and_return time
258259
@session.stub(:setAttribute)
259260
@app.should_receive(:call) do |env|
260-
env['rack.session'].getLastAccessedTime.should == time
261+
expect(env['rack.session'].getLastAccessedTime).to eq time
261262
lambda { env['rack.session'].blah_blah }.should raise_error(NoMethodError)
262263
end
263264
@session_store.call(@env)

0 commit comments

Comments
 (0)