[rspec-devel] [ rspec-Bugs-10747 ] Helper methods defined in shared specs are not visible when shared spec is used
noreply at rubyforge.org
noreply at rubyforge.org
Thu May 10 13:48:56 EDT 2007
Bugs item #10747, was opened at 2007-05-10 10:48
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=10747&group_id=797
Category: runner module
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Greg Spurrier (gregspurrier)
Assigned to: Nobody (None)
Summary: Helper methods defined in shared specs are not visible when shared spec is used
Initial Comment:
Helper methods that are defined in shared descriptions are not visible to the description's examples when the are instantiated in a non-shared description:
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
---
% spec -v
RSpec-0.9.3 (r1916) - BDD for Ruby
http://rspec.rubyforge.org/
/tmp % 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.364168 seconds
1 example, 1 failure
If the definition of foobar is moved into "not shared", it works.
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=10747&group_id=797
More information about the rspec-devel
mailing list