Ticket #376 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

ruby2ruby 1.1.8 breaks stuff in specs, starting server

Reported by: mi..@manicdev.com Assigned to:
Priority: major Milestone: 0.5.0
Component: Rspec Harness Keywords:
Cc:

Description (Last modified by coda.ha..@gmail.com)

Looks like the newest version of ruby2ruby (1.1.8) breaks some stuff in specs. The errors seem to be stemming from calls to 'session', 'flash', etc.

The errors look like:

1)
NoMethodError in 'Spec name goes here'
undefined method `[]=' for nil:NilClass
<line in which controller references session object>
/opt/local/lib/ruby/gems/1.8/gems/merb-0.5.0/lib/merb/abstract_controller.rb:87:in `send'
/opt/local/lib/ruby/gems/1.8/gems/merb-0.5.0/lib/merb/abstract_controller.rb:87:in `call_action'
/opt/local/lib/ruby/gems/1.8/gems/merb-0.5.0/lib/merb/abstract_controller.rb:43:in `dispatch'
/opt/local/lib/ruby/gems/1.8/gems/merb-0.5.0/lib/merb/controller.rb:112:in `dispatch'
./spec/controllers/dingo_spec.rb:6:
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_methods.rb:47:in `instance_eval'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_methods.rb:47:in `eval_each_fail_fast'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_methods.rb:46:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_methods.rb:46:in `eval_each_fail_fast'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:249:in `run_before_each'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:343:in `execute_in_class_hierarchy'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:342:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:342:in `execute_in_class_hierarchy'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:248:in `run_before_each'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_methods.rb:90:in `before_example'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_methods.rb:18:in `execute'
/opt/local/lib/ruby/1.8/timeout.rb:48:in `timeout'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_methods.rb:16:in `execute'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:286:in `execute_examples'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:285:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:285:in `execute_examples'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:120:in `run'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/runner/example_group_runner.rb:22:in `run'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/runner/example_group_runner.rb:21:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/runner/example_group_runner.rb:21:in `run'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/runner/options.rb:87:in `run_examples'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/runner/command_line.rb:19:in `run'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/bin/spec:3:
/opt/local/bin/spec:19:in `load'
/opt/local/bin/spec:19:

Change History

12/25/07 02:01:30 changed by coda.ha..@gmail.com

  • status changed from new to closed.
  • resolution set to worksforme.

I can't duplicate this on either 0.4.2 or r1131.

$ rake specs
...specs run blah...
811 examples, 0 failures, 1 pending

12/25/07 02:12:53 changed by coda.ha..@gmail.com

  • status changed from closed to reopened.
  • resolution deleted.

I spoke too soon. I found one exception in "MerbHandler#process? should ask the Dispatcher for the controller and action" which was silently logged instead of raising an exception. Working on a fix.

12/25/07 02:15:39 changed by coda.ha..@gmail.com

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [1132]) Fixed a silent exception in the MerbHandler? specs due to a lack of return value on a mocked method.

Closes #376. (Probably.)

12/25/07 06:49:35 changed by mi..@manicdev.com

  • status changed from closed to reopened.
  • resolution deleted.

Still an issue. It seems session and flash (from merb_has_flash plugin) are the culprits. Not sure what the issue is yet, but downgrading ruby2ruby to 1.1.7 stops the errors.

(follow-up: ↓ 7 ) 12/25/07 13:34:53 changed by coda.ha..@gmail.com

Mike, it would help a lot if you could give us an actual spec failure dump. I can't reproduce this on trunk with ruby2ruby 1.1.8, and it's not for lack of trying.

(follow-up: ↓ 9 ) 12/27/07 07:33:03 changed by dcpark..@gmail.com

  • summary changed from ruby2ruby 1.1.8 breaks stuff in specs to ruby2ruby 1.1.8 breaks stuff in specs, starting server.

I don't know if this is the same issue, or very similar -- it might have the same root cause, at least. This is also caused directly by ruby2ruby 1.1.8 over 1.1.7.

Started merb_init.rb ...
Connecting to database...
Thu, 27 Dec 2007 15:20:18 GMT: loading gem 'merb_datamapper' from config/dependencies.rb:13 ...
Thu, 27 Dec 2007 15:20:18 GMT: loading gem 'validatable' from config/dependencies.rb:36 ...
Thu, 27 Dec 2007 15:20:18 GMT: loading gem 'haml' from config/dependencies.rb:37 ...
Thu, 27 Dec 2007 15:20:18 GMT: loading gem 'RedCloth' from config/dependencies.rb:39 ...
Loading Application...
Compiling routes..
/Library/Ruby/Gems/1.8/gems/merb-0.4.2/lib/merb/server.rb:292:in `load_action_arguments': undefined method `action_arguments=' for "Application":String (NoMethodError)
	from /Library/Ruby/Gems/1.8/gems/merb-0.4.2/lib/merb/server.rb:292:in `each'
	from /Library/Ruby/Gems/1.8/gems/merb-0.4.2/lib/merb/server.rb:292:in `load_action_arguments'
	from /Library/Ruby/Gems/1.8/gems/merb-0.4.2/lib/merb/server.rb:332:in `load_application'
	from /Users/daniel/Sites/testcon/trunk/config/merb_init.rb:13
	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
	from /Library/Ruby/Gems/1.8/gems/merb-0.4.2/lib/merb/server.rb:269:in `initialize_merb'
	from /Library/Ruby/Gems/1.8/gems/merb-0.4.2/lib/merb/server.rb:612:in `mongrel_start'
	from /Library/Ruby/Gems/1.8/gems/merb-0.4.2/lib/merb/server.rb:548:in `run'
	from /Library/Ruby/Gems/1.8/gems/merb-0.4.2/bin/merb:6
	from /usr/bin/merb:16:in `load'
	from /usr/bin/merb:16

(in reply to: ↑ 5 ; follow-up: ↓ 8 ) 12/27/07 08:23:57 changed by mi..@manicdev.com

Replying to coda.ha..@gmail.com:

Mike, it would help a lot if you could give us an actual spec failure dump. I can't reproduce this on trunk with ruby2ruby 1.1.8, and it's not for lack of trying.

The spec failure dumps don't reveal anything. The easiest way I can tell you to replicate this error is to start a new merb app, add a controller, use the session hash in an action, write a spec for the action and run it. It should give the same error I reported.

(in reply to: ↑ 7 ) 12/27/07 16:16:21 changed by coda.ha..@gmail.com

  • description changed.

Thanks for the steps to repeat, Mike. In the future, a full backtrace is immensely helpful in debugging errors because it tells us where in the framework this exception is being raised. To generate a full backtrace when running a spec, use the -b option:

spec spec/controllers/stuff_spec.rb -b

Here's what I managed to produce.

1)
NoMethodError in 'Dingo Controller index action should explode, session-wise'
undefined method `[]=' for nil:NilClass
/Users/coda/Projects/crapticle/app/controllers/dingo.rb:4:in `index'
/opt/local/lib/ruby/gems/1.8/gems/merb-0.5.0/lib/merb/abstract_controller.rb:87:in `send'
/opt/local/lib/ruby/gems/1.8/gems/merb-0.5.0/lib/merb/abstract_controller.rb:87:in `call_action'
/opt/local/lib/ruby/gems/1.8/gems/merb-0.5.0/lib/merb/abstract_controller.rb:43:in `dispatch'
/opt/local/lib/ruby/gems/1.8/gems/merb-0.5.0/lib/merb/controller.rb:112:in `dispatch'
./spec/controllers/dingo_spec.rb:6:
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_methods.rb:47:in `instance_eval'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_methods.rb:47:in `eval_each_fail_fast'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_methods.rb:46:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_methods.rb:46:in `eval_each_fail_fast'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:249:in `run_before_each'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:343:in `execute_in_class_hierarchy'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:342:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:342:in `execute_in_class_hierarchy'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:248:in `run_before_each'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_methods.rb:90:in `before_example'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_methods.rb:18:in `execute'
/opt/local/lib/ruby/1.8/timeout.rb:48:in `timeout'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_methods.rb:16:in `execute'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:286:in `execute_examples'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:285:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:285:in `execute_examples'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/example/example_group_methods.rb:120:in `run'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/runner/example_group_runner.rb:22:in `run'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/runner/example_group_runner.rb:21:in `each'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/runner/example_group_runner.rb:21:in `run'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/runner/options.rb:87:in `run_examples'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/lib/spec/runner/command_line.rb:19:in `run'
/opt/local/lib/ruby/gems/1.8/gems/rspec-1.1.1/bin/spec:3:
/opt/local/bin/spec:19:in `load'
/opt/local/bin/spec:19:

It looks like the session object isn't being created inside the spec context. This problem wasn't created by a change in ruby2ruby as much as it was masked by ruby2ruby's insane pre-1.1.8 extension of NilClass?.

(in reply to: ↑ 6 ) 12/27/07 16:17:17 changed by coda.ha..@gmail.com

Replying to dcpark..@gmail.com:

I don't know if this is the same issue, or very similar -- it might have the same root cause, at least. This is also caused directly by ruby2ruby 1.1.8 over 1.1.7.

dcparker, that looks like a separate issue. Would you mind opening another ticket on that? Thanks!

12/27/07 16:37:49 changed by coda.ha..@gmail.com

  • status changed from reopened to closed.
  • resolution set to fixed.

(In [1134]) Added fake session to Merb::Test::FakeRequest?. Closes #376.