Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

minitest-lint

Lint your minitest assertions.

  • Scans assertions for common patterns.
  • Provides multiple rewrites until it can’t be improved anymore.
  • Uses pattern matching to be as flexible as possible.
% assert_scanner my_test.rb

my_test.rb:10:
  assert(([1, 2, 3].include?(b) == true), "is b in 1..3?") # original
  assert(([1, 2, 3].include?(b) == true))   # redundant message?
  assert_equal([1, 2, 3].include?(b), true) # assert_equal exp, act
  assert_equal(true, [1, 2, 3].include?(b)) # assert_equal lit, act
  assert_operator([1, 2, 3], :include?, b)  # assert_operator obj, :msg, val
  assert_includes([1, 2, 3], b)             # assert_includes obj, val

my_test.rb:20:
  [1, 2, 3].include?(b).must_equal(true) # original
  _([1, 2, 3].include?(b)).must_equal(true) # _(obj).must_<something> val
  _([1, 2, 3]).must_be(:include?, b)        # _(obj).must_be :msg, val
  _([1, 2, 3]).must_include(b)              # _(obj).must_include val

Get The Code

If you just want to use minitest-lint, you can install it via RubyGems:
gem install minitest-lint
Fork me on GitHub If you want to hack on minitest-lint, clone it from GitHub:
git clone git://github.com/zenspider/minitest-lint

Latest Activity