Ruby 1.9.2 confusion

I’m wondering if someone could shed a little light on something for me.
I’m trying to get a Rails 2.3.11 project running on Ruby 1.9.2-p180, and
the same specs that pass on 1.8.7-p302 don’t pass on 1.9.2-p180 if I run
them one way, but do if I run them another way.

If I run a particular view spec via script/spec, it passes:

$ script/spec spec/views/admin/media/new.html.haml_spec.rb

Finished in 1.121665 seconds

10 examples, 0 failures

If I run it via spec, it fails:

$ spec spec/views/admin/media/new.html.haml_spec.rb
…FF…

MiniTest::Assertion in ‘admin/media/new.html.haml without errors should
not have a mime type select list’
Expected at least 1 element matching “select#medium_mime_type_id”, found
0.
/Users/phillip/.rvm/gems/[email protected]/gems/actionpack-2.3.11/lib/action_controller/assertions/selector_assertions.rb:307:in
assert_select' spec/views/admin/media/new.html.haml_spec.rb:40:inblock (3 levels) in
<top (required)>’

MiniTest::Assertion in ‘admin/media/new.html.haml without errors should
not have a medium type select list’
Expected at least 1 element matching “select#medium_type”, found 0.
/Users/phillip/.rvm/gems/[email protected]/gems/actionpack-2.3.11/lib/action_controller/assertions/selector_assertions.rb:307:in
assert_select' spec/views/admin/media/new.html.haml_spec.rb:44:inblock (3 levels) in
<top (required)>’

Finished in 1.020134 seconds

10 examples, 2 failures

Here is some system information:

$ which ruby
/Users/phillip/.rvm/rubies/ruby-1.9.2-p180/bin/ruby

$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0]

$ which spec
/Users/phillip/.rvm/gems/[email protected]/bin/spec

$ spec -v
rspec 1.3.1

$ script/spec -v
rspec 1.3.1

rspec-rails 1.3.3 is installed in both gemsets for 1.8.7 and 1.9.2.

Thanks for any help,
Phillip

On 2011-04-03 2:45 PM, Phillip K. wrote:

Finished in 1.121665 seconds
should not have a mime type select list’
Expected at least 1 element matching “select#medium_type”, found 0.

rspec 1.3.1

$ script/spec -v
rspec 1.3.1

rspec-rails 1.3.3 is installed in both gemsets for 1.8.7 and 1.9.2.

Thanks for any help,
Phillip

Well, I “solved” my problem. I added

gem ‘test-unit’, ‘1.2.3’ if RUBY_VERSION.to_f >= 1.9

to the top of bin/spec of the rspec 1.3.1 gem and now both spec and rake
spec work. It’s a mystery to me that test-unit 1.2.3 is required in
lib/tasks/spec.rake, but it doesn’t seem to make a difference.

Does anyone have an idea of how to resolve this without actually
changing one of the gem’s files?

Phillip

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs