Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the guide to use shoulda-matchers gem for the model validations. #238

Open
sameera207 opened this issue Nov 30, 2018 · 0 comments
Open

Comments

@sameera207
Copy link
Contributor

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
RachelleOnRails added a commit that referenced this issue Dec 22, 2018
…rs_docs

#238 Adding shoulda-matchers for testing models
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant