lib/rubocop/cop/rspec/rails/minitest_assertions.rb in rubocop-rspec-2.19.0 vs lib/rubocop/cop/rspec/rails/minitest_assertions.rb in rubocop-rspec-2.20.0
- old
+ new
@@ -11,13 +11,13 @@
# assert_equal(a, b)
# assert_equal a, b, "must be equal"
# refute_equal(a, b)
#
# # good
- # expect(a).to eq(b)
- # expect(a).to(eq(b), "must be equal")
- # expect(a).not_to eq(b)
+ # expect(b).to eq(a)
+ # expect(b).to(eq(a), "must be equal")
+ # expect(b).not_to eq(a)
#
class MinitestAssertions < Base
extend AutoCorrector
MSG = 'Use `%<prefer>s`.'
@@ -41,12 +41,12 @@
private
def replacement(node, expected, actual, failure_message)
runner = node.method?(:assert_equal) ? 'to' : 'not_to'
if failure_message.nil?
- "expect(#{expected.source}).#{runner} eq(#{actual.source})"
+ "expect(#{actual.source}).#{runner} eq(#{expected.source})"
else
- "expect(#{expected.source}).#{runner}(eq(#{actual.source}), " \
+ "expect(#{actual.source}).#{runner}(eq(#{expected.source}), " \
"#{failure_message.source})"
end
end
def message(prefer)