Class: SpecNegativeOperatorMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/mspec/matchers/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(actual) ⇒ SpecNegativeOperatorMatcher

Returns a new instance of SpecNegativeOperatorMatcher.



50
51
52
# File 'lib/mspec/matchers/base.rb', line 50

def initialize(actual)
  @actual = actual
end

Instance Method Details

#<(expected) ⇒ Object



61
62
63
64
65
66
# File 'lib/mspec/matchers/base.rb', line 61

def <(expected)
  if @actual < expected
    SpecExpectation.fail_with("Expected #{@actual.pretty_inspect}",
                          "not to be less than #{expected.pretty_inspect}")
  end
end

#<=(expected) ⇒ Object



68
69
70
71
72
73
# File 'lib/mspec/matchers/base.rb', line 68

def <=(expected)
  if @actual <= expected
    SpecExpectation.fail_with("Expected #{@actual.pretty_inspect}",
                          "not to be less than or equal to #{expected.pretty_inspect}")
  end
end

#==(expected) ⇒ Object



54
55
56
57
58
59
# File 'lib/mspec/matchers/base.rb', line 54

def ==(expected)
  if @actual == expected
    SpecExpectation.fail_with("Expected #{@actual.pretty_inspect}",
                          "not to equal #{expected.pretty_inspect}")
  end
end

#=~(expected) ⇒ Object



89
90
91
92
93
94
# File 'lib/mspec/matchers/base.rb', line 89

def =~(expected)
  if @actual =~ expected
    SpecExpectation.fail_with("Expected #{@actual.pretty_inspect}",
                          "not to match #{expected.pretty_inspect}")
  end
end

#>(expected) ⇒ Object



75
76
77
78
79
80
# File 'lib/mspec/matchers/base.rb', line 75

def >(expected)
  if @actual > expected
    SpecExpectation.fail_with("Expected #{@actual.pretty_inspect}",
                          "not to be greater than #{expected.pretty_inspect}")
  end
end

#>=(expected) ⇒ Object



82
83
84
85
86
87
# File 'lib/mspec/matchers/base.rb', line 82

def >=(expected)
  if @actual >= expected
    SpecExpectation.fail_with("Expected #{@actual.pretty_inspect}",
                          "not to be greater than or equal to #{expected.pretty_inspect}")
  end
end