Class: SpecPositiveOperatorMatcher

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

Instance Method Summary collapse

Constructor Details

#initialize(actual) ⇒ SpecPositiveOperatorMatcher

Returns a new instance of SpecPositiveOperatorMatcher


2
3
4
# File 'lib/mspec/matchers/base.rb', line 2

def initialize(actual)
  @actual = actual
end

Instance Method Details

#<(expected) ⇒ Object


13
14
15
16
17
18
# File 'lib/mspec/matchers/base.rb', line 13

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

#<=(expected) ⇒ Object


20
21
22
23
24
25
# File 'lib/mspec/matchers/base.rb', line 20

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

#==(expected) ⇒ Object


6
7
8
9
10
11
# File 'lib/mspec/matchers/base.rb', line 6

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

#=~(expected) ⇒ Object


41
42
43
44
45
46
# File 'lib/mspec/matchers/base.rb', line 41

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

#>(expected) ⇒ Object


27
28
29
30
31
32
# File 'lib/mspec/matchers/base.rb', line 27

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

#>=(expected) ⇒ Object


34
35
36
37
38
39
# File 'lib/mspec/matchers/base.rb', line 34

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