Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions style/ruby/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,24 @@ https://github.com/hanmoi-choi/reek-emacs
end
```

- Use [specific assertion functions](http://guides.rubyonrails.org/testing.html#available-assertions)
over `assert`. Using these functions gives much more meaningful results when tests fail.

```ruby

# good

assert_predicate @user, :valid? # on error: expected @user to be valid?

assert_includes response['message'], 'must be a valid email' # on error: expected response['message'] to include 'must be a valid email`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏


# bad

assert @user.valid? # on error: expected false to be truthy

assert response['message'].include?('must be a valid email') # on error: expect false to be truthy
```

### System Tests

##### Organization
Expand Down