I am learning TDD and trying to use shoulda_matchers to help with my testing but I get a very strange error. Here is my test:
spec/models/idea_spec.rb
require 'rails_helper'
describe Idea do
context 'Validations' do
describe 'title' do
it { should validate_presence_of(:title) }
end
end
end
The error on the test says:
Idea Validations title
Failure/Error: it { should validate_presence_of(:title) }
NoMethodError:
undefined method `validate_presence_of' for #<RSpec::ExampleGroups::Idea_3::Validations::Title:0x007f056f9fcdf8>
# ./spec/models/idea_spec.rb:7:in `block (4 levels) in <top (required)>'
require 'shoulda/matchers' is at the top of my rails_helper file as per the gem instructions.
Gems I'm using:
group :development, :test do
gem 'spring'
gem 'dotenv-rails'
gem 'rspec-rails', '~> 3.0'
gem 'factory_girl_rails'
end
group :test do
gem 'webmock', '~> 1.20.4'
gem 'shoulda-matchers', require: false
end
- ruby '2.1.2'
- rails', '4.1.9'