No release in over 3 years
Low commit activity in last 3 years
Provides assertions for your Minitest suite to determine if an object has been changed.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

Minitest Change Assertions

Gem Version CI Status RubyGems Downloads Buy Me a Coffee

Provides assertions for your Minitest suite to determine if an object has been changed.

Install

gem 'minitest_change_assertions'

Usage

assert_changed

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

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 - @westonganger