shoulda not working with rails3 and rspec2

19 views
Skip to first unread message

Nadal

unread,
Aug 11, 2010, 12:51:17 PM8/11/10
to shoulda
I posted this question on rspec forum.
http://groups.google.com/group/rspec/browse_thread/thread/24ff4a26a5f382d9

If there is work already underway then that's great. If not then let
me know and I will work on a patch.

Thanks

Dan Croak

unread,
Aug 11, 2010, 1:38:51 PM8/11/10
to sho...@googlegroups.com
I had to configure manually in Rails 3/RSpec 2 app to spec/spec_helper.rb:

RSpec.configure do |config|
config.include(Shoulda::ActiveRecord::Matchers)
end

Auto-loading matchers doesn't seem to be working right now, I think
for the same reason that we had to create Factory Girl on Rails:

http://robots.thoughtbot.com/post/722112946/factory-girl-rails3

> --
> Individuals over processes. Interactions over tools.
>
> Agile Rails training from thoughtbot, the makers of Clearance, Shoulda, & Factory Girl:
> http://thoughtbot.com/services/training
>
> The Shoulda group:
> http://groups.google.com/group/shoulda
>
> To post to this group, send email to
> sho...@googlegroups.com
>
> To unsubscribe from this group, send email to
> shoulda+u...@googlegroups.com
>

defn

unread,
Aug 23, 2010, 5:36:42 AM8/23/10
to shoulda
I've added the line you mention to my spec_helper.rb but still receive
errors:

Here is my code:

require 'spec_helper'

describe User do
should validate_presence_of(:name)
should validate_uniqueness_of(:name)
should validate_presence_of(:email)
should validate_uniqueness_of(:email)
end

On Aug 11, 12:38 pm, Dan Croak <dcr...@thoughtbot.com> wrote:
> I had to configure manually in Rails 3/RSpec 2 app to spec/spec_helper.rb:
>
> RSpec.configure do |config|
>   config.include(Shoulda::ActiveRecord::Matchers)
> end
>
> Auto-loading matchers doesn't seem to be working right now, I think
> for the same reason that we had to create Factory Girl on Rails:
>
> http://robots.thoughtbot.com/post/722112946/factory-girl-rails3
>
>
>
> On Wed, Aug 11, 2010 at 12:51 PM, Nadal <node.j...@gmail.com> wrote:
> > I posted this question on rspec forum.
> >http://groups.google.com/group/rspec/browse_thread/thread/24ff4a26a5f...
Reply all
Reply to author
Forward
0 new messages