Greg Spurrier
2007-May-10 17:02 UTC
[rspec-users] shared descriptions -- a couple of issues
Hello All, I''ve just upgraded to rspec/rspec_on_rails 0.9.3 and am very excited about shared descriptions. They couldn''t have come at a better time: I just finished refactoring some REST controllers so that the bulk of the actions are inherited from a superclass. Now I can write the specs once, too. :) I''ve hit a couple of snags, though. I thought I''d mention them here before logging bugs or attempting to fix them myself, to make sure that I''m not missing the point somewhere. Issue 1 -- multiple inclusion of shared behaviors ======I''ve put the shared descriptions in their own file and am requiring it into the files that use it. This is no problem when I run spec on an individual file, but when I do ''rake spec'' or run spec on a directory, I get the error: Shared Behaviour ''foo'' already exists (ArgumentError) It appears that there are no protections against pulling in the file multiple times. I''ve worked around this in rails for now by naming the shared file XXX_shared.rb instead of XXX_spec.rb so that the rake task doesn''t pick it up, but it seems like something that should be fixed. To reproduce, create the following files: a_spec.rb --------- describe "shared", :shared => true do it "should do something" do end end b_spec.rb --------- require ''a_spec'' describe "not shared" do it_should_behave_like "shared" end Now, try it out: % spec b_spec.rb . Finished in 0.018853 seconds 1 example, 0 failures % spec *_spec.rb /usr/local/lib/ruby/gems/1.8/gems/rspec-0.9.3/lib/spec/dsl/ behaviour.rb:9:in `add_shared_behaviour'': Shared Behaviour ''shared'' already exists (ArgumentError) from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.9.3/lib/spec/ runner/extensions/kernel.rb:16:in `register_behaviour'' from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.9.3/lib/spec/ runner/extensions/kernel.rb:4:in `describe'' from ./a_spec.rb:1 from /usr/local/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:21:in `require'' from ./b_spec.rb:1 from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.9.3/lib/spec/ runner/behaviour_runner.rb:85:in `load_specs'' from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.9.3/lib/spec/ runner/behaviour_runner.rb:84:in `load_specs'' from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.9.3/lib/spec/ runner/behaviour_runner.rb:22:in `run'' from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.9.3/lib/spec/ runner/command_line.rb:17:in `run'' from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.9.3/bin/spec:3 from /usr/local/bin/spec:18 Issue 2 -- Helper functions declared in shared behaviors don''t work ======I''ve declared a helper function in the shared behavior, but it isn''t found when the shared behavior is invoked with it_should_behave_like. For example: a_spec.rb --------- describe "shared", :shared => true do def foobar 37 end it "foobar should be 37" do foobar.should == 37 end end describe "not shared" do it_should_behave_like "shared" end yields: % spec a_spec.rb F 1) NameError in ''not shared foobar should be 37'' undefined local variable or method `foobar'' for #<#<Class:0x106555c>: 0x1065188> ./a_spec.rb:7: Finished in 0.006112 seconds 1 example, 1 failure In order to get this to work, I have to declare the foobar method in the non-shared description. I imagine I can work around this by putting that method in a module and doing something like: describe "non-shared" do include SharedHelpers it_should_behave_like "shared" end but it''s be much better if it would work as I''d expected it to work in the failing example. Thoughts? Comments? Am I approaching this the wrong way, or is it that shared descriptions are still a little rough around the edges? Thanks, Greg
David Chelimsky
2007-May-10 17:27 UTC
[rspec-users] shared descriptions -- a couple of issues
On 5/10/07, Greg Spurrier <greg at mydigitallife.com> wrote:> Hello All, > > I''ve just upgraded to rspec/rspec_on_rails 0.9.3 and am very excited > about shared descriptions. They couldn''t have come at a better time: I > just finished refactoring some REST controllers so that the bulk of > the actions are inherited from a superclass. Now I can write the > specs once, too. :) > > I''ve hit a couple of snags, though. I thought I''d mention them here > before logging bugs or attempting to fix them myself, to make sure > that I''m not missing the point somewhere. > > > Issue 1 -- multiple inclusion of shared behaviors > ======> I''ve put the shared descriptions in their own file and am requiring it > into the files that use it. This is no problem when I run spec on an > individual file, but when I do ''rake spec'' or run spec on a directory, > I get the error: > > Shared Behaviour ''foo'' already exists (ArgumentError) > > It appears that there are no protections against pulling in the file > multiple times. I''ve worked around this in rails for now by naming > the shared file XXX_shared.rb instead of XXX_spec.rb so that the rake > task doesn''t pick it up, but it seems like something that should be > fixed. > > To reproduce, create the following files: > > a_spec.rb > --------- > describe "shared", :shared => true do > it "should do something" do > end > end > > b_spec.rb > --------- > require ''a_spec'' > > describe "not shared" do > it_should_behave_like "shared" > end > > Now, try it out: > > % spec b_spec.rb > . > > Finished in 0.018853 seconds > > 1 example, 0 failures > % spec *_spec.rb > /usr/local/lib/ruby/gems/1.8/gems/rspec-0.9.3/lib/spec/dsl/ > behaviour.rb:9:in `add_shared_behaviour'': Shared Behaviour ''shared'' > already exists (ArgumentError) > from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.9.3/lib/spec/ > runner/extensions/kernel.rb:16:in `register_behaviour'' > from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.9.3/lib/spec/ > runner/extensions/kernel.rb:4:in `describe'' > from ./a_spec.rb:1 > from /usr/local/lib/ruby/site_ruby/1.8/rubygems/ > custom_require.rb:21:in `require'' > from ./b_spec.rb:1 > from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.9.3/lib/spec/ > runner/behaviour_runner.rb:85:in `load_specs'' > from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.9.3/lib/spec/ > runner/behaviour_runner.rb:84:in `load_specs'' > from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.9.3/lib/spec/ > runner/behaviour_runner.rb:22:in `run'' > from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.9.3/lib/spec/ > runner/command_line.rb:17:in `run'' > from /usr/local/lib/ruby/gems/1.8/gems/rspec-0.9.3/bin/spec:3 > from /usr/local/bin/spec:18 > > > Issue 2 -- Helper functions declared in shared behaviors don''t work > ======> I''ve declared a helper function in the shared behavior, but it isn''t > found when the shared behavior is invoked with it_should_behave_like. > For example: > > a_spec.rb > --------- > describe "shared", :shared => true do > def foobar > 37 > end > > it "foobar should be 37" do > foobar.should == 37 > end > end > > describe "not shared" do > it_should_behave_like "shared" > end > > > yields: > > % spec a_spec.rb > F > > 1) > NameError in ''not shared foobar should be 37'' > undefined local variable or method `foobar'' for #<#<Class:0x106555c>: > 0x1065188> > ./a_spec.rb:7: > > Finished in 0.006112 seconds > > 1 example, 1 failure > > In order to get this to work, I have to declare the foobar method in > the non-shared description. I imagine I can work around this by > putting that method in a module and doing something like: > > describe "non-shared" do > include SharedHelpers > it_should_behave_like "shared" > end > > but it''s be much better if it would work as I''d expected it to work in > the failing example. > > > Thoughts? Comments? Am I approaching this the wrong way, or is it > that shared descriptions are still a little rough around the edges?You''ve got it right. Shared descriptions are brand new, so yes, still rough around the edges. Please submit RFEs for both issues (separate please). Thanks, David> > Thanks, > Greg > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Greg Spurrier
2007-May-10 17:37 UTC
[rspec-users] shared descriptions -- a couple of issues
> > You''ve got it right. Shared descriptions are brand new, so yes, still > rough around the edges. Please submit RFEs for both issues (separate > please). > > Thanks, > DavidPerfectly understandable. Will do. Greg
François Beausoleil
2007-Jun-04 15:55 UTC
[rspec-users] shared descriptions -- a couple of issues
Hi ! 2007/5/10, Greg Spurrier <greg at mydigitallife.com>:> > > > You''ve got it right. Shared descriptions are brand new, so yes, still > > rough around the edges. Please submit RFEs for both issues (separate > > please). > > Perfectly understandable. Will do.Greg, did you end up creating the RFEs ? I can''t find them, and I just got hit by the duplicate shared behaviour problem. Thanks ! -- Fran?ois Beausoleil http://blog.teksol.info/ http://piston.rubyforge.org/
David Chelimsky
2007-Jun-04 16:04 UTC
[rspec-users] shared descriptions -- a couple of issues
On 6/4/07, Fran?ois Beausoleil <francois.beausoleil at gmail.com> wrote:> Hi ! > > 2007/5/10, Greg Spurrier <greg at mydigitallife.com>: > > > > > > You''ve got it right. Shared descriptions are brand new, so yes, still > > > rough around the edges. Please submit RFEs for both issues (separate > > > please). > > > > Perfectly understandable. Will do. > > Greg, did you end up creating the RFEs ? I can''t find them, and I > just got hit by the duplicate shared behaviour problem.This is all resolved in the current trunk.> > 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
François Beausoleil
2007-Jun-04 19:09 UTC
[rspec-users] shared descriptions -- a couple of issues
Hello David, 2007/6/4, David Chelimsky <dchelimsky at gmail.com>:> This is all resolved in the current trunk.Was 1.0.4 cut from the current trunk ? Because I get the same errors as Greg: $ rake spec (in /home/francois/src/xlsuite.com) /home/francois/src/xlsuite.com/vendor/plugins/rspec/lib/spec/dsl/behaviour.rb:10:in `add_shared_behaviour'': Shared Behaviour ''All controllers'' already exists (ArgumentError) from /home/francois/src/xlsuite.com/vendor/plugins/rspec/lib/spec/runner/extensions/kernel.rb:36:in `register_behaviour'' from /home/francois/src/xlsuite.com/vendor/plugins/rspec/lib/spec/runner/extensions/kernel.rb:24:in `describe'' from ./spec/controllers/../xl_suite/spec_helpers.rb:94 from /home/francois/src/xlsuite.com/vendor/plugins/plugin_dependencies/lib/plugin_dependencies/extensions/kernel.rb:14:in `gem_original_require_without_plugins'' from /home/francois/src/xlsuite.com/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/xlsuite.com/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:495:in `require'' from /home/francois/src/xlsuite.com/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:342:in `new_constants_in'' ... 29 levels... from /home/francois/src/xlsuite.com/vendor/plugins/rspec/lib/spec/runner/option_parser.rb:154:in `parse'' from /home/francois/src/xlsuite.com/vendor/plugins/rspec/lib/spec/runner/option_parser.rb:88:in `create_behaviour_runner'' from /home/francois/src/xlsuite.com/vendor/plugins/rspec/lib/spec/runner/command_line.rb:14:in `run'' from /home/francois/src/xlsuite.com/vendor/plugins/rspec/bin/spec:3 rake aborted! Command ruby -I"/home/francois/src/xlsuite.com/vendor/plugins/rspec/lib" "/home/francois/src/xlsuite.com/vendor/plugins/rspec/bin/spec" "spec/views/futures/show_spec.rb" "spec/views/rets/index_view_spec.rb" "spec/views/rets/import_view_spec.rb" "spec/views/rets/search_view_spec.rb" "spec/views/rets/results_view_spec.rb" "spec/views/rets/done_view_spec.rb" "spec/views/forum_categories/index_spec.rb" "spec/controllers/forum_categories_spec.rb" "spec/controllers/posts_controller_spec.rb" "spec/controllers/listings_controller_spec.rb" "spec/controllers/futures_controller_spec.rb" "spec/controllers/rets_controller_spec.rb" "spec/models/future_spec.rb" "spec/models/recurring_future_spec.rb" "spec/helpers/futures_helper_spec.rb" "spec/helpers/rets_helper_spec.rb" --options "/home/francois/src/xlsuite.com/config/../spec/spec.opts" failed (See full trace by running task with --trace) $ spec spec/ /usr/local/lib/ruby/gems/1.8/gems/rspec-1.0.4/lib/spec/dsl/behaviour.rb:10:in `add_shared_behaviour'': Shared Behaviour ''All controllers'' already exists (ArgumentError) from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.0.4/lib/spec/runner/extensions/kernel.rb:36:in `register_behaviour'' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.0.4/lib/spec/runner/extensions/kernel.rb:24:in `describe'' from ./spec//controllers/../xl_suite/spec_helpers.rb:94 from /home/francois/src/xlsuite.com/vendor/plugins/plugin_dependencies/lib/plugin_dependencies/extensions/kernel.rb:14:in `gem_original_require_without_plugins'' from /home/francois/src/xlsuite.com/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/xlsuite.com/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:495:in `require'' from /home/francois/src/xlsuite.com/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:342:in `new_constants_in'' ... 31 levels... from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.0.4/lib/spec/runner/command_line.rb:14:in `run'' from /usr/local/lib/ruby/gems/1.8/gems/rspec-1.0.4/bin/spec:3 from /usr/local/bin/spec:16:in `load'' from /usr/local/bin/spec:16 $ spec spec/models/ .................................. Finished in 1.899439 seconds 34 examples, 0 failures My shared behaviors are specified in file spec/xl_suite/spec_helpers.rb, module XlSuite::SpecHelpers. Thanks ! -- Fran?ois Beausoleil http://blog.teksol.info/ http://piston.rubyforge.org/
David Chelimsky
2007-Jun-05 11:42 UTC
[rspec-users] shared descriptions -- a couple of issues
On 6/4/07, Fran?ois Beausoleil <francois.beausoleil at gmail.com> wrote:> Hello David, > > 2007/6/4, David Chelimsky <dchelimsky at gmail.com>: > > This is all resolved in the current trunk. > > Was 1.0.4 cut from the current trunk?Nope. 1.0.4 was tagged at 2054 on 5/29. We''re up to 2077 now. Grab the trunk and you should be OK. If you don''t like using trunk, you''ll have to wait for 1.0.5, but that will be coming soon.
François Beausoleil
2007-Jun-05 14:38 UTC
[rspec-users] shared descriptions -- a couple of issues
2007/6/5, David Chelimsky <dchelimsky at gmail.com>:> > Was 1.0.4 cut from the current trunk? > > Nope. 1.0.4 was tagged at 2054 on 5/29. We''re up to 2077 now. > > Grab the trunk and you should be OK. If you don''t like using trunk, > you''ll have to wait for 1.0.5, but that will be coming soon.Thank you, David. I''ll wait for 1.0.5. Thanks ! -- Fran?ois Beausoleil http://blog.teksol.info/ http://piston.rubyforge.org/
David Chelimsky
2007-Jun-05 23:39 UTC
[rspec-users] shared descriptions -- a couple of issues
On 6/5/07, Fran?ois Beausoleil <francois.beausoleil at gmail.com> wrote:> 2007/6/5, David Chelimsky <dchelimsky at gmail.com>: > > > Was 1.0.4 cut from the current trunk? > > > > Nope. 1.0.4 was tagged at 2054 on 5/29. We''re up to 2077 now. > > > > Grab the trunk and you should be OK. If you don''t like using trunk, > > you''ll have to wait for 1.0.5, but that will be coming soon. > > Thank you, David. I''ll wait for 1.0.5.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. 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
François Beausoleil
2007-Jun-16 01:35 UTC
[rspec-users] shared descriptions -- a couple of issues
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 ? Thanks ! -- Fran?ois Beausoleil http://blog.teksol.info/ http://piston.rubyforge.org/
David Chelimsky
2007-Jun-17 16:09 UTC
[rspec-users] shared descriptions -- a couple of issues
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
David Chelimsky
2007-Jun-18 03:59 UTC
[rspec-users] shared descriptions -- a couple of issues
On 6/17/07, David Chelimsky <dchelimsky at gmail.com> wrote:> 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])I committed a fix for this to r2097, so it will be in the next release.> > 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 >
Ashley Moran
2007-Jun-27 14:10 UTC
[rspec-users] shared descriptions -- a couple of issues
On 10 May 2007, at 18:02, Greg Spurrier wrote:> a_spec.rb > --------- > describe "shared", :shared => true do > def foobar > 37 > end > > it "foobar should be 37" do > foobar.should == 37 > end > end > > describe "not shared" do > it_should_behave_like "shared" > end > > > yields: > > % spec a_spec.rb > F > > 1) > NameError in ''not shared foobar should be 37'' > undefined local variable or method `foobar'' for #<#<Class:0x106555c>: > 0x1065188>Hi Just wondered if this issue is fixed in trunk? I can''t find an RFE and not sure how to interpret the replies to this post (they appear to be before 1.0.4 and we''re on 1.0.5 now, but this behaviour is the same) Ashley