[rspec-devel] [ rspec-Bugs-15637 ] modules that use included hook don't work any more in Spec::Runner.configure
noreply at rubyforge.org
noreply at rubyforge.org
Thu Nov 15 02:34:00 EST 2007
Bugs item #15637, was opened at 2007-11-15 01:05
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=15637&group_id=797
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: David Chelimsky (dchelimsky)
Assigned to: Nobody (None)
Summary: modules that use included hook don't work any more in Spec::Runner.configure
Initial Comment:
We made a change recently in trunk in which modules that get included using config, like this:
Spec::Runner.configure do |config|
config.include(SomeModule)
end
get included directly into the ExampleGroup base class. When ExampleGroup gets subclassed and instantiated, the instances have all the methods defined in the module.
Unfortunately, this is breaking specs for people who exploit the included hook in Ruby modules:
module ControllerSpecHelper
def self.included(klass)
klass.extend(ClassMethods)
end
module ClassMethods
def it_should_behave_like_an_admin_action(method)
it 'should require a login' do
should_require_login do
eval method.to_s
end
end
it 'should require the admin role' do
should_require_role_of('admin') do
eval method.to_s
end
end
end
end
...
end
What used to happen is that since the module was included directly in the instance in which the examples ran, that instance got extended with ClassMethods.
Now, the base class is getting extended instead, rendering these helpers ... helpless.
----------------------------------------------------------------------
Comment By: Nathan Sutton (fowlduck)
Date: 2007-11-15 01:33
Message:
It's in revision 2889 as well.
My rails edge revision 8146.
----------------------------------------------------------------------
Comment By: David Chelimsky (dchelimsky)
Date: 2007-11-15 01:06
Message:
This is as of rev 2887.
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=15637&group_id=797
More information about the rspec-devel
mailing list