Skip to content

Commit 1e9c996

Browse files
committed
Fixes for rspec and JRuby changes
These were not real failures; rather they are changes in how rspec or JRuby works since the specs were last green.
1 parent 784c81e commit 1e9c996

File tree

7 files changed

+78
-86
lines changed

7 files changed

+78
-86
lines changed

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

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
it "should load the session when accessed" do
5858
@request.should_receive(:getSession).with(false).and_return @session
5959
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
60-
@app.should_receive(:call).and_return do |env|
60+
@app.should_receive(:call) do |env|
6161
env['rack.session']['foo']
6262
end
6363
@session_store.call(@env)
@@ -73,7 +73,7 @@
7373
it "should report session loaded when accessed" do
7474
@request.should_receive(:getSession).with(false).and_return @session
7575
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
76-
@app.should_receive(:call).and_return do |env|
76+
@app.should_receive(:call) do |env|
7777
env['rack.session']['foo']
7878
end
7979
@session_store.call(@env)
@@ -84,7 +84,7 @@
8484
it "should use custom session hash when loading session" do
8585
@request.should_receive(:getSession).with(false).and_return @session
8686
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
87-
@app.should_receive(:call).and_return do |env|
87+
@app.should_receive(:call) do |env|
8888
env['rack.session']["foo"] = "bar"
8989
end
9090
@session_store.call(@env)
@@ -106,7 +106,7 @@
106106
@session.should_receive(:getAttributeNames).and_return [session_key]
107107
@session.should_receive(:getAttribute).with(session_key).and_return marshal_data.to_java_bytes
108108
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
109-
@app.should_receive(:call).and_return do |env|
109+
@app.should_receive(:call) do |env|
110110
env['rack.session']["foo"].should == 1
111111
env['rack.session']["bar"].should == true
112112
end
@@ -120,7 +120,7 @@
120120
@session.should_receive(:getAttribute).with("foo").and_return hash["foo"]
121121
@session.should_receive(:getAttribute).with("bar").and_return hash["bar"]
122122
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
123-
@app.should_receive(:call).and_return do |env|
123+
@app.should_receive(:call) do |env|
124124
env['rack.session']["foo"].should == hash["foo"]
125125
env['rack.session']["bar"].should == hash["bar"]
126126
end
@@ -132,7 +132,7 @@
132132
@session.should_receive(:getAttributeNames).and_return ["foo"]
133133
@session.should_receive(:getAttribute).with("foo").and_return java.lang.Object.new
134134
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
135-
@app.should_receive(:call).and_return do |env|
135+
@app.should_receive(:call) do |env|
136136
env['rack.session']["foo"].should be_kind_of(java.lang.Object)
137137
end
138138
@session_store.call(@env)
@@ -143,7 +143,7 @@
143143
@session.stub(:getAttribute).and_return nil; @session.stub(:getCreationTime).and_return 1
144144
@session.should_receive(:setAttribute).with(ActionController::Session::JavaServletStore::RAILS_SESSION_KEY,
145145
an_instance_of(Java::byte[]))
146-
@app.should_receive(:call).and_return do |env|
146+
@app.should_receive(:call) do |env|
147147
env['rack.session']['foo'] = Object.new
148148
end
149149
@session_store.call(@env)
@@ -154,7 +154,7 @@
154154
@request.should_receive(:getSession).with(true).ordered.and_return @session
155155
@session.should_receive(:setAttribute).with(ActionController::Session::JavaServletStore::RAILS_SESSION_KEY,
156156
an_instance_of(Java::byte[]))
157-
@app.should_receive(:call).and_return do |env|
157+
@app.should_receive(:call) do |env|
158158
env['rack.session']['foo'] = Object.new
159159
end
160160
@session_store.call(@env)
@@ -164,7 +164,7 @@
164164
@request.should_receive(:getSession).with(false).and_return @session
165165
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
166166
@session.should_receive(:setAttribute).with("foo", "bar")
167-
@app.should_receive(:call).and_return do |env|
167+
@app.should_receive(:call) do |env|
168168
env['rack.session']["foo"] = "bar"
169169
end
170170
@session_store.call(@env)
@@ -176,7 +176,7 @@
176176
@session.should_receive(:setAttribute).with("foo", true)
177177
@session.should_receive(:setAttribute).with("bar", 20)
178178
@session.should_receive(:setAttribute).with("baz", false)
179-
@app.should_receive(:call).and_return do |env|
179+
@app.should_receive(:call) do |env|
180180
env['rack.session']["foo"] = true
181181
env['rack.session']["bar"] = 20
182182
env['rack.session']["baz"] = false
@@ -188,7 +188,7 @@
188188
@request.should_receive(:getSession).with(false).and_return @session
189189
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
190190
@session.should_receive(:setAttribute).with("foo", an_instance_of(java.lang.Object))
191-
@app.should_receive(:call).and_return do |env|
191+
@app.should_receive(:call) do |env|
192192
env['rack.session']["foo"] = java.lang.Object.new
193193
end
194194
@session_store.call(@env)
@@ -200,7 +200,7 @@
200200
@session.stub(:setAttribute); @session.stub(:getCreationTime).and_return 1
201201
@session.should_receive(:removeAttribute).with("foo")
202202
@session.should_receive(:removeAttribute).with("baz")
203-
@app.should_receive(:call).and_return do |env|
203+
@app.should_receive(:call) do |env|
204204
env['rack.session'].delete('foo')
205205
env['rack.session']['baz'] = nil
206206
env['rack.session']['bar'] = 'x'
@@ -212,7 +212,7 @@
212212
@request.should_receive(:getSession).with(false).and_return @session
213213
@session.stub(:getId).and_return(nil)
214214
@session.should_receive(:invalidate).ordered
215-
@app.should_receive(:call).and_return do |env|
215+
@app.should_receive(:call) do |env|
216216
env['rack.session.options'].delete(:id)
217217
#env['rack.session'] = new_session_hash(env)
218218
env['rack.session'].send :load!
@@ -224,7 +224,7 @@
224224
session = double_http_session(nil); session.invalidate
225225
@request.should_receive(:getSession).with(false).and_return session
226226

227-
@app.should_receive(:call).and_return do |env|
227+
@app.should_receive(:call) do |env|
228228
env['rack.session.options'].delete(:id)
229229
env['rack.session'].send :load!
230230
end
@@ -240,15 +240,15 @@
240240
@request.should_receive(:getSession).ordered.
241241
with(true).and_return new_session = double_http_session
242242

243-
@app.should_receive(:call).and_return do |env|
243+
@app.should_receive(:call) do |env|
244244
env['rack.session']['foo'] = 'bar'
245245
end
246246
@session_store.call(@env)
247247
end
248248

249249
it "should do nothing on session reset if no session is established" do
250250
@request.should_receive(:getSession).with(false).and_return nil
251-
@app.should_receive(:call).and_return do |env|
251+
@app.should_receive(:call) do |env|
252252
env['rack.session.options'].delete(:id)
253253
env['rack.session'] = new_session_hash(env) # not loaded?
254254
end
@@ -260,7 +260,7 @@
260260
@request.should_receive(:getSession).and_return @session
261261
@session.should_receive(:getLastAccessedTime).and_return time
262262
@session.stub(:setAttribute)
263-
@app.should_receive(:call).and_return do |env|
263+
@app.should_receive(:call) do |env|
264264
env['rack.session'].getLastAccessedTime.should == time
265265
lambda { env['rack.session'].blah_blah }.should raise_error(NoMethodError)
266266
end
@@ -274,7 +274,7 @@
274274
new_session = double_http_session
275275
@request.should_receive(:getSession).ordered.with(true).and_return(new_session)
276276

277-
@app.should_receive(:call).and_return do |env|
277+
@app.should_receive(:call) do |env|
278278
env['rack.session.options'] = { :id => sid, :renew => true, :defer => true }
279279
env['rack.session']['_csrf_token'] = 'v3PrzsdkWug9Q3xCthKkEzUMbZSzgQ9Bt+43lH0bEF8='
280280
end
@@ -292,7 +292,7 @@
292292
it "handles the skip session option" do
293293
@request.should_receive(:getSession).with(false).and_return @session
294294
@session.should_not_receive(:setAttribute)
295-
@app.should_receive(:call).and_return do |env|
295+
@app.should_receive(:call) do |env|
296296
env['rack.session.options'][:skip] = true
297297
env['rack.session']['foo'] = 'bar'
298298
end

src/spec/ruby/jruby/rack/queues_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def mock_message(text)
175175
it "should unmarshal the message if the marshal payload property is set" do
176176
@message.should_receive(:getBooleanProperty).with(JRuby::Rack::Queues::MARSHAL_PAYLOAD).and_return true
177177
first = false
178-
@message.should_receive(:readBytes).twice.and_return do |byte_array|
178+
@message.should_receive(:readBytes).twice do |byte_array|
179179
if first
180180
-1
181181
else

src/spec/ruby/jruby/rack/response_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class << value; undef_method :each; end if value.respond_to?(:each)
181181
response.write_headers(response_environment)
182182

183183
times = 0
184-
stream.should_receive(:write).exactly(6).times.with do |bytes|
184+
stream.should_receive(:write).exactly(6).times.with no_args do |bytes|
185185
str = String.from_java_bytes(bytes)
186186
str = str.force_encoding('UTF-8') if str.respond_to?(:force_encoding)
187187
case times += 1
@@ -223,7 +223,7 @@ class << value; undef_method :each; end if value.respond_to?(:each)
223223
response.write_headers(response_environment)
224224

225225
times = 0
226-
stream.should_receive(:write).exactly(3).times.with do |bytes|
226+
stream.should_receive(:write).exactly(3).times.with no_args do |bytes|
227227
str = String.from_java_bytes(bytes)
228228
case times += 1
229229
when 1 then str.should == "1\r\n1\r\n"
@@ -258,7 +258,7 @@ class << value; undef_method :each; end if value.respond_to?(:each)
258258
response.write_headers(response_environment)
259259

260260
times = 0
261-
stream.should_receive(:write).exactly(5).times.with do |bytes|
261+
stream.should_receive(:write).exactly(5).times.with no_args do |bytes|
262262
str = String.from_java_bytes(bytes)
263263
case times += 1
264264
when 1 then str.should == "1"
@@ -404,7 +404,7 @@ def wrap_file_body(path) # Rails style when doing #send_file
404404
path = File.expand_path('../../files/image.jpg', File.dirname(__FILE__))
405405

406406
response = JRuby::Rack::Response.new [ 200, {}, FileBody.new(path) ]
407-
response.should_receive(:send_file).with do |path, response|
407+
response.should_receive(:send_file).with no_args do |path, response|
408408
expect( path ).to eql path
409409
expect( response).to be response_environment
410410
end

0 commit comments

Comments
 (0)