Migration from RSpec 1.3 to RSpec 2.x

Vít Ondruch vondruch at redhat.com
Fri Feb 10 09:25:40 UTC 2012


Dne 10.2.2012 07:55, Shawn Starr napsal(a):
> Hello everyone,
>
> Continuing on this topic..
>
> I am having severe trouble migrating this (and likely all of its other sub
> rubygem packages)
>
> Here is SRPM: http://fedorapeople.org/~spstarr/packages/rubygem-dm-
> core-1.1.0-1.fc17.src.rpm
>
> - I renamed all the _spec.rb files accordingly
> - i attempted to fix spec_helper.rb that helped a bit also
>
> It then started to run with 'rspec spec' but still reported more deprecated
>
> [spstarr at segfault dm-core-1.1.0]$ rspec spec/
> ........*****************************************************************
> DEPRECATION WARNING: you are using a deprecated constant that will
> be removed from a future version of RSpec.
>
> /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:435:in
> `instance_eval'
>
> * Spec is deprecated.
> * RSpec is the new top-level module in RSpec-2
> *****************************************************************
>
> .....
>
> .**.........*..*...................*....*.......*****************************************************************
> DEPRECATION WARNING: you are using a deprecated constant that will
> be removed from a future version of RSpec.
>
> /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/example_group.rb:435:in
> `instance_eval'
>
> * Spec is deprecated.
> * RSpec is the new top-level module in RSpec-2
> *****************************************************************
>
> Pending:
>    DataMapper::Query#intersection with default adapter with other matching
> everything should factor out the operation matching everything
>      # TODO: compress Query#conditions for proper comparison
>      #
>    DataMapper::Query#&  with default adapter with other matching everything
> should factor out the operation matching everything
>      # TODO: compress Query#conditions for proper comparison
>      #
>    DataMapper::Query#slice with a negative offset should update the offset to
> be relative to the original offset
>      # TODO: update Query#slice handle negative offset
>
> .....
>
> Failures:
>
>    1) DataMapper::Resource::State::Dirty#delete with default adapter it should
> behave like It resets resource state should reset the dirty m:1 relationship
>       Failure/Error: method(:subject).should change(@resource,
> :parent).from(@resource).to(nil)
>         parent should have been changed to nil, but is now #<Author @id=1
> @name="Jane Doe" @active=true @coding=true @parent_id=nil>
>       Shared Example Group: "It resets resource state" called from
>       # /usr/share/gems/gems/rspec-
> expectations-2.8.0/lib/rspec/expectations/fail_with.rb:32:in `fail_with'
>       # /usr/share/gems/gems/rspec-
> expectations-2.8.0/lib/rspec/expectations/handler.rb:21:in `handle_matcher'
>       # /usr/share/gems/gems/rspec-
> expectations-2.8.0/lib/rspec/expectations/extensions/kernel.rb:12:in `should'
>       # /home/spstarr/rpmbuild/BUILD/rubygem-dm-
> core-1.1.0/usr/share/gems/gems/dm-
> core-1.1.0/spec/semipublic/shared/resource_state_shared.rb:27:in `block (2
> levels) in<top (required)>'
>       # /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:80:in
> `instance_eval'
>       # /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:80:in
> `block in run'
>       # /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:173:in
> `with_around_hooks'
>       # /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:77:in
> `run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:355:in `block in run_examples'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:351:in `map'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:351:in `run_examples'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:337:in `run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `block in run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `map'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `block in run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `map'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `block in run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `map'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/command_line.rb:28:in `map'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/command_line.rb:28:in `block in run'
>       # /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/reporter.rb:34:in
> `report'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/command_line.rb:25:in `run'
>       # /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in
> `run_in_process'
>       # /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in
> `run'
>       # /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in
> `block in autorun'
>
>    2) DataMapper::Resource::State::Dirty#rollback with default adapter it
> should behave like It resets resource state should reset the dirty m:1
> relationship
>       Failure/Error: method(:subject).should change(@resource,
> :parent).from(@resource).to(nil)
>         parent should have been changed to nil, but is now #<Author @id=1
> @name="Jane Doe" @active=true @coding=true @parent_id=nil>
>       Shared Example Group: "It resets resource state" called from
>       # /usr/share/gems/gems/rspec-
> expectations-2.8.0/lib/rspec/expectations/fail_with.rb:32:in `fail_with'
>       # /usr/share/gems/gems/rspec-
> expectations-2.8.0/lib/rspec/expectations/handler.rb:21:in `handle_matcher'
>       # /usr/share/gems/gems/rspec-
> expectations-2.8.0/lib/rspec/expectations/extensions/kernel.rb:12:in `should'
>       # /home/spstarr/rpmbuild/BUILD/rubygem-dm-
> core-1.1.0/usr/share/gems/gems/dm-
> core-1.1.0/spec/semipublic/shared/resource_state_shared.rb:27:in `block (2
> levels) in<top (required)>'
>       # /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:80:in
> `instance_eval'
>       # /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:80:in
> `block in run'
>       # /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:173:in
> `with_around_hooks'
>       # /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/example.rb:77:in
> `run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:355:in `block in run_examples'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:351:in `map'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:351:in `run_examples'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:337:in `run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `block in run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `map'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `block in run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `map'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `block in run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `map'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/example_group.rb:338:in `run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/command_line.rb:28:in `block (2 levels) in run'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/command_line.rb:28:in `map'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/command_line.rb:28:in `block in run'
>       # /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/reporter.rb:34:in
> `report'
>       # /usr/share/gems/gems/rspec-
> core-2.8.0/lib/rspec/core/command_line.rb:25:in `run'
>       # /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in
> `run_in_process'
>       # /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in
> `run'
>       # /usr/share/gems/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in
> `block in autorun'
>
> .......
>
> This one is over my head, if someone can help that would be great, then i can
> replicate this knowledge to the other rubygems im working on also.
>
> Thanks,
>
> Shawn.

Have you tried newer version of dm-core? Although I don't believe it 
will help :/

This shared examples feature was substantially reworked between RSpec 1 
and 2. I consider it the biggest change and unfortunately hard to 
migrate, unless you are really familiar with the code and test suite.

I'm still not sure if we should not introduce some rspec compat package 
because of packages like this.

Anyway, I opened upstream issue regarding the RSpec 2.x support [1].


Vit



[1] https://github.com/datamapper/dm-core/issues/181




More information about the ruby-sig mailing list