[rspec-users] rspec2 not working with shoulda

David Chelimsky dchelimsky at gmail.com
Wed Aug 11 10:38:25 EDT 2010


On Aug 11, 2010, at 9:36 AM, David Chelimsky wrote:

> 
> On Aug 11, 2010, at 2:31 AM, Nadal wrote:
> 
>> I am using rails edge. I am using gem "rspec-rails", "= 2.0.0.beta.
>> 19" .
>> 
>> I have following code at spec/models/user_spec.rb
>> 
>> require 'spec_helper'
>> 
>> describe User do
>> 
>> it { should validate_presence_of(:email) }
>> 
>> it { should validate_presence_of(:name) }
>> 
>> end
>> 
>> 
>> Here is my gemfile
>> 
>> group :development, :test do
>> gem 'factory_girl_rails', :git => 'git://github.com/thoughtbot/
>> factory_girl_rails'
>> gem 'shoulda'
>> gem "rspec-rails", "= 2.0.0.beta.19"
>> gem "cucumber-rails", "= 0.3.2"
>> gem "capybara"
>> gem "launchy"
>> end
>> 
>> I am getting following error message.
>> 
>> 
>> Failure/Error: it { should validate_presence_of(:email) }
>>   undefined method `validate_presence_of' for
>> #<RSpec::Core::ExampleGroup::Nested_2:0x10a63e3a8 @__memoized={}>
>>   # ./spec/models/user_spec.rb:5
> 
> Sounds like shoulda is not registering itself properly with rspec-2. I'd check with the should list: http://groups.google.com/group/shoulda.

Also - the subject line is backwards - it shoulda been "shoulda not working with rspec-2" ;)

> 
> HTH,
> David
> 
> 
> 



More information about the rspec-users mailing list