Bugs item #15637, was opened at 2007-11-15 07: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.
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=15637&group_id=797