[rspec-users] Lot of error when running all spec

David Chelimsky dchelimsky at gmail.com
Thu Oct 21 08:29:53 EDT 2010


On Oct 19, 2010, at 4:49 AM, Jbiolaz wrote:

> Hi,
> 
> I'm pretty new to rspec. I'm writing some spec for a Rails 3.0 app
> with Devise (branch omniauth), rspec 2.0.1 and factory_girl.
> 
> When I run spec file by file (ex: rspec spec/models/
> document_spec.rb) , it run sometimes withtout error and sometimes with
> some errors (duplicate entry in DB).

Make sure you've got config.use_transactional_fixtures = true in spec/spec_helper.rb and that you are not setting up any models in before(:all) blocks.

> That's the first I don't
> understand: Why it's sometimes working and sometimes not ? How can I
> do to make this work all the time (except of course if there is some
> change in the model that really break the test) ?.
> 
> I try also to run all my spec at once (rspec spec) but I have a lot of
> error with Devise:
> 
> here is my stack error:
> 
>     Failure/Error: @user = Factory(:user)
>     Could not find a valid mapping for #<User:0x10ceaf8a0>
>     # ./lock/ruby/1.8/bundler/gems/devise-31edd76369a8/lib/devise/
> mapping.rb:40:in `find_scope!'
>     # ./lock/ruby/1.8/bundler/gems/devise-31edd76369a8/app/mailers/
> devise/mailer.rb:26:in `initialize_from_record'
>     # ./lock/ruby/1.8/bundler/gems/devise-31edd76369a8/app/mailers/
> devise/mailer.rb:21:in `setup_mail'
>     # ./lock/ruby/1.8/bundler/gems/devise-31edd76369a8/app/mailers/
> devise/mailer.rb:6:in `confirmation_instructions'

<snip/>

> So, what can I do to avoid this error and make my test running ?
> 
> Thanks a lot for your help !
> Jonathan


Not sure about the Devise issue. I'd recommend checking http://groups.google.com/group/plataformatec-devise for that one.

Good luck,
David



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20101021/2fdf3e42/attachment.html>


More information about the rspec-users mailing list