Using shoulda-matchers for model validations will be easier to understand over the current example.
it { should validate_presence_of(:title) }
instead of
[:title, :body].each do |attribute|
it "should validate presence of #{attribute}" do
expect(post.errors[attribute].size).to be >= 1
expect(post.errors.messages[attribute]).to include "can't be blank"
end
end
Using
shoulda-matchers
for model validations will be easier to understand over the current example.instead of