Class: BeSameValueAs

Inherits:
Object
  • Object
show all
Includes:
AssertValueAssertion
Defined in:
lib/assert_value.rb

Overview

RSpec matcher for assert_value

Instance Method Summary collapse

Methods included from AssertValueAssertion

#assert_value, #be_same_value_as, #file_offsets

Constructor Details

#initialize(expected) ⇒ BeSameValueAs

Returns a new instance of BeSameValueAs.



460
461
462
463
# File 'lib/assert_value.rb', line 460

def initialize(expected)
    @expected = expected
    @rspec_matcher = true
end

Instance Method Details

#failure_messageObject



473
474
475
# File 'lib/assert_value.rb', line 473

def failure_message
    "expected to be the same"
end

#failure_message_when_negatedObject



477
478
479
# File 'lib/assert_value.rb', line 477

def failure_message_when_negated
    "expected not to be the same"
end

#matches?(target) ⇒ Boolean

Returns:

  • (Boolean)


465
466
467
468
469
470
471
# File 'lib/assert_value.rb', line 465

def matches?(target)
  if target.is_a? Proc
      assert_value @expected, &target
  else
      assert_value target, @expected
  end
end

#supports_block_expectations?Boolean

Returns:

  • (Boolean)


481
482
483
# File 'lib/assert_value.rb', line 481

def supports_block_expectations?
    true
end