[rspec-users] engines causing problems with mocks

David Chelimsky dchelimsky at gmail.com
Wed May 9 12:43:57 EDT 2007


Looks like you're using mixed versions of rspec and rspec_on_rails.
before(:each) didn't really show up until 0.9, but in 0.9 there is no
Spec::Runner::Specification.

Make sure to follow the install instructions on
http://rspec.rubyforge.org/documentation/rails/install.html, and
please let us know if that helps.

Cheers,
David

On 5/9/07, David Smalley <david.smalley.lists at googlemail.com> wrote:
> 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
>
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list