Skip to content

Commit

Permalink
Fix rubocop issues in built_in matcher be.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
zsyed91 committed Nov 20, 2015
1 parent 0606927 commit d45aa31
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/rspec/matchers/built_in/be.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ class BeComparedTo < BaseMatcher
include BeHelpers

def initialize(operand, operator)
@expected, @operator = operand, operator
@expected = operand
@operator = operator
@args = []
end

Expand All @@ -151,13 +152,15 @@ def matches?(actual)
# @api private
# @return [String]
def failure_message
"expected: #{@operator} #{expected_formatted}\n got: #{@operator.to_s.gsub(/./, ' ')} #{actual_formatted}"
"expected: #{@operator} #{expected_formatted}\n" \
" got: #{@operator.to_s.gsub(/./, ' ')} #{actual_formatted}"
end

# @api private
# @return [String]
def failure_message_when_negated
message = "`expect(#{actual_formatted}).not_to be #{@operator} #{expected_formatted}`"
message = "`expect(#{actual_formatted}).not_to " \
"be #{@operator} #{expected_formatted}`"
if [:<, :>, :<=, :>=].include?(@operator)
message + " not only FAILED, it is a bit confusing."
else
Expand Down

0 comments on commit d45aa31

Please sign in to comment.