[rspec-users] shared descriptions -- a couple of issues

David Chelimsky dchelimsky at gmail.com
Sun Jun 17 12:09:16 EDT 2007


On 6/15/07, François Beausoleil <francois.beausoleil at gmail.com> wrote:
> Hello David,
>
> 2007/6/5, David Chelimsky <dchelimsky at gmail.com>:
> > Your wait is over. I just released it. Might take a couple of hours
> > for mirrors to get resolved, but you should be able to get it later
> > today.
>
> Okay, I upgraded to 1.0.5, and I still get the error:
>
> $ script/spec spec/
> /home/francois/src/vendor/plugins/rspec/lib/spec/dsl/behaviour.rb:11:in
> `add_shared_behaviour': Shared Behaviour 'All controllers' already
> exists (ArgumentError)
>         from /home/francois/src/vendor/plugins/rspec/lib/spec/runner/extensions/kernel.rb:36:in
> `register_behaviour'
>         from /home/francois/src/vendor/plugins/rspec/lib/spec/runner/extensions/kernel.rb:24:in
> `describe'
>         from ./spec//views/assets/../../xl_suite/spec_helpers.rb:96
>         from /home/francois/src/vendor/plugins/plugin_dependencies/lib/plugin_dependencies/extensions/kernel.rb:14:in
> `gem_original_require_without_plugins'
>         from /home/francois/src/vendor/plugins/plugin_dependencies/lib/plugin_dependencies/extensions/kernel.rb:14:in
> `gem_original_require'
>         from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> `require'
>         from /home/francois/src/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:495:in
> `require'
>         from /home/francois/src/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:342:in
> `new_constants_in'
>          ... 15 levels...
>         from /home/francois/src/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:84:in
> `load_specs'
>         from /home/francois/src/vendor/plugins/rspec/lib/spec/runner/behaviour_runner.rb:22:in
> `run'
>         from /home/francois/src/vendor/plugins/rspec/lib/spec/runner/command_line.rb:17:in
> `run'
>         from script/spec:4
>
> I tried to use trunk at 2097 and I get the same error.  rspec and
> rspec_on_rails are installed as plugins in vendor/plugins, and I
> removed the rspec gem from my system.  rake spec reports the same
> problem.
>
> In summary:
>
> $ script/spec spec/models/asset_spec.rb => Works
> $ script/spec spec/models/ => Works
> $ script/spec spec/views/assets/ => Works
> $ script/spec spec/views => Fails
> $ rake spec => Fails
>
> Am I doing something wrong ?

No - you're OK. There's a bug. I can tell you how to patch it to get
it to work - I'll be getting a better version committed to svn today
or tomorrow:

Change line 10 in behaviour.rb (in vendor/plugins/rspec/lib/spec/dsl) from this:

return if found_behaviour and behaviour.description[:spec_path] ==
found_behaviour.description[:spec_path]

to this:

return if found_behaviour and
File.expand_path(behaviour.description[:spec_path]) ==
File.expand_path(found_behaviour.description[:spec_path])

Cheers,
David

>
> Thanks !
> --
> François Beausoleil
> http://blog.teksol.info/
> http://piston.rubyforge.org/
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list