Skip to content

Commit

Permalink
Remove duplicated code (probably result of merge)
Browse files Browse the repository at this point in the history
e2290d5 (Skip diffing, Diff::LCS heavily uses String#<<)
elia committed Jul 27, 2015
1 parent 18a0237 commit 62119f7
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions opal/opal/rspec/fixes.rb
Original file line number Diff line number Diff line change
@@ -96,25 +96,6 @@ def too_many_warnings_message
end
end

def (RSpec::Expectations).fail_with(message, expected=nil, actual=nil)
if !message
raise ArgumentError, "Failure message is nil. Does your matcher define the " +
"appropriate failure_message_for_* method to return a string?"
end

if actual && expected
if all_strings?(actual, expected)
if any_multiline_strings?(actual, expected)
message # + "\nDiff:" + differ.diff_as_string(coerce_to_string(actual), coerce_to_string(expected))
end
elsif no_procs?(actual, expected) && no_numbers?(actual, expected)
message # + "\nDiff:" + differ.diff_as_object(actual, expected)
end
end

raise(RSpec::Expectations::ExpectationNotMetError.new(message))
end

class RSpec::Core::Reporter
# https://github.com/opal/opal/issues/858
# The problem is not directly related to the Reporter class (it has more to do with Formatter's call in add using a splat in the args list and right now, Opal does not run a to_a on a splat before the callee method takes over)
@@ -241,9 +222,16 @@ def (RSpec::Expectations).fail_with(message, expected=nil, actual=nil)
raise ArgumentError, "Failure message is nil. Does your matcher define the " +
"appropriate failure_message_for_* method to return a string?"
end

# diff = differ.diff(actual, expected)
# message = "#{message}\nDiff:#{diff}" unless diff.empty?

if actual && expected
if all_strings?(actual, expected)
if any_multiline_strings?(actual, expected)
message # + "\nDiff:" + differ.diff_as_string(coerce_to_string(actual), coerce_to_string(expected))
end
elsif no_procs?(actual, expected) && no_numbers?(actual, expected)
message # + "\nDiff:" + differ.diff_as_object(actual, expected)
end
end

raise(RSpec::Expectations::ExpectationNotMetError.new(message))
end

0 comments on commit 62119f7

Please sign in to comment.