Skip to content

Commit

Permalink
Add assert_equal_ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldrapper committed Jan 23, 2025
1 parent 6e349a3 commit a13f31e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/quickdraw/assertions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ def assert_equal_html(actual, expected)
end
end

def assert_equal_ruby(actual, expected)
unless String === actual && String === expected
raise ArgumentError.new("expected both actual and expected to be strings")
end

assert(actual == expected) do
diff = DIFFER.diff_ruby(actual, expected)

"Expected Ruby strings to be equal (compared with `==`):\n\n#{diff}"
end
end

def refute_equal(actual, expected)
refute(actual == expected) do
<<~MESSAGE
Expand Down

0 comments on commit a13f31e

Please sign in to comment.