Sha256: 9c3365cf762b9a4febf74317957666ce8b93b804ae0db3bdd66a795da515339f
Contents?: true
Size: 1.64 KB
Versions: 1
Compression:
Stored size: 1.64 KB
Contents
assert_difference ================= A nice assert_difference method similar to the one provided by Rails but with some improvements. For example: assert_difference "Company.count" => +1, "User.count" => +5, "Slot.count" => -1 do post :something end will assert that a company and 5 users were create (the plus sign is only for the visual aid) and a slot was removed. [Rails' assert_difference](http://api.rubyonrails.org/classes/ActiveSupport/Testing/Assertions.html#method-i-assert_difference) would require a more verbose syntax: assert_difference "Company.count" do assert_difference "User.count", +5 do assert_difference "Article.count", -1 do post :something end end end To use it with Test::Unit add this code (untested, please [let me know](mailto:pupeno@pupeno.com) if it works): class Test::Unit::TestCase include Factory::Syntax::Methods end and to use it with RSpec: RSpec.configure do |config| config.include Factory::Syntax::Methods end For more information read http://pupeno.com/blog/better-assert-difference Note on Patches/Pull Requests ----------------------------- * Fork the project. * Make your feature addition or bug fix. * Add tests for it. This is important so I don't break it in a future version unintentionally. * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) * Send me a pull request. Bonus points for topic branches. Copyright --------- Copyright (c) 2010, 2011, José Pablo Fernández. See LICENSE for details.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
assert_difference-0.3.0 | README.md |