https://github.com/westonganger/minitest_change_assertions
Provides assertions for your Minitest suite to determine if an object has been changed
https://github.com/westonganger/minitest_change_assertions
assertions minitest minitest-assertions ruby test-suite testing
Last synced: about 1 year ago
JSON representation
Provides assertions for your Minitest suite to determine if an object has been changed
- Host: GitHub
- URL: https://github.com/westonganger/minitest_change_assertions
- Owner: westonganger
- License: mit
- Created: 2018-07-11T19:51:58.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-12-31T08:16:29.000Z (over 1 year ago)
- Last Synced: 2025-04-15T05:57:30.823Z (about 1 year ago)
- Topics: assertions, minitest, minitest-assertions, ruby, test-suite, testing
- Language: Ruby
- Size: 12.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Minitest Change Assertions
Provides assertions for your Minitest suite to determine if an object has been changed.
# Install
```ruby
gem 'minitest_change_assertions'
```
# Usage
## `assert_changed`
```ruby
assert_changed 'user.name' do
user.name = 'Bob'
end
assert_changed -> { user.name } do
user.name = 'Bob'
end
### OR with optional :to argument
assert_changed 'user.name', to: 'Bob' do
user.name = 'Bob'
end
assert_changed -> { user.name }, to: 'Bob' do
user.name = 'Bob'
end
```
## `assert_not_changed`
```ruby
assert_not_changed 'user.name' do
user.update(attrs)
end
assert_not_changed -> { user.name } do
user.update(attrs)
end
### OR with optional :to argument
assert_not_changed 'user.name', to: 'Allen' do
user.name = 'Bob'
end
assert_not_changed -> { user.name }, to: 'Allen' do
user.name = 'Bob'
end
```
# Credits
Created by [Weston Ganger](https://westonganger.com) - [@westonganger](https://github.com/westonganger)