[rspec-users] engines causing problems with mocks
David Smalley
david.smalley.lists at googlemail.com
Wed May 9 12:40:04 EDT 2007
As I delve further into using engines and rspec together I am
noticing more strange issues.
describe "Requesting /admin/collections using get" do
controller_name :admin_collections
before(:each) do
Collection.stub!(:paginate)
end
it "should return a collection of collection objects" do
get 'index'
response.should be_success
end
end
Gives me this error
undefined method `callback_events' for
#<Class:Spec::Runner::Specification>
/Users/davidsmalley/Development/incutio/skeleton/config/../vendor/
plugins/engines/lib/engines/rails_extensions/dependencies.rb:139 :in
`require_or_load'
./vendor/plugins/sor_core/spec/controllers/
admin_collections_controller_spec.rb:7
137 # if we managed to load a file, return true. If not, default
to the original method.
138 # Note that this relies on the RHS of a boolean || not to be
evaluated if the LHS is true.
139 file_loaded || require_or_load_without_engine_additions
(file_name, const_path)
140 end
141 end
This looks like its coming from engines - but it could just be that
engines has assumed responsibility for loading dependencies and that
the error is really from rspec.
Any ideas?
I'm very keen to work on a project to create some rspec tasks that
cater for people wanting to use it in conjunction with engines if
anyone else has a similar problem.
Something along the lines of being able to say:
rake spec:engines:an_engine
rake spec:engines:an_engine:controllers
rake spec:engines:an_engine:models
...
Cheers,
David
More information about the rspec-users
mailing list