8000 Add guide for better assertions by Tetramputechture · Pull Request #46 · ProctorU/guides · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add guide for better assertions #46

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

Merged
merged 2 commits into from
Jun 11, 2018
Merged

Conversation

Tetramputechture
Copy link
Contributor
@Tetramputechture Tetramputechture commented Jun 11, 2018

When using assertions, we should prefer to use more specific assertion functions for more meaningful tests, error messages, and easier debugging.

For example, using only assert gives us Expected false to be truthy on failure, but using something like assert_includes will give us Expected {string} to include {substring}.

@proctoru-bot
Copy link

@Tetramputechture, please add a Type label.


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.

👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0