class Minitest::MustWonted::Matcher::Awesome

Provides the awesome, pure logick like matchers

smth.must == smth
smth.must =~ /re/
smth.must > smth
...

Attributes

assertions[RW]
flipped[RW]
subject[RW]

Public Class Methods

new(subject, flipped) click to toggle source
# File lib/minitest/mustwonted/matcher/awesome.rb, line 14
def initialize(subject, flipped)
  @subject    = subject
  @flipped    = flipped
  @assertions = 0
end

Public Instance Methods

!=(value) click to toggle source
# File lib/minitest/mustwonted/matcher/awesome.rb, line 24
def !=(value)
  __call 'equal', true, value, @subject
end
<(value) click to toggle source
# File lib/minitest/mustwonted/matcher/awesome.rb, line 36
def < (value)
  __call 'operator', false, @subject, :<, value
end
<=(value) click to toggle source
# File lib/minitest/mustwonted/matcher/awesome.rb, line 44
def <= (value)
  __call 'operator', false, @subject, :<=, value
end
==(value) click to toggle source
# File lib/minitest/mustwonted/matcher/awesome.rb, line 20
def ==(value)
  __call 'equal', false, value, @subject
end
=~(regexp) click to toggle source
# File lib/minitest/mustwonted/matcher/awesome.rb, line 28
def =~(regexp)
  __call 'match', false, regexp, @subject
end
>(value) click to toggle source
# File lib/minitest/mustwonted/matcher/awesome.rb, line 32
def > (value)
  __call 'operator', false, @subject, :>, value
end
>=(value) click to toggle source
# File lib/minitest/mustwonted/matcher/awesome.rb, line 40
def >= (value)
  __call 'operator', false, @subject, :>=, value
end

Private Instance Methods

__call(name, flip, *args) click to toggle source
# File lib/minitest/mustwonted/matcher/awesome.rb, line 50
def __call(name, flip, *args)
  __send__ "#{@flipped == flip ? 'assert' : 'refute'}_#{name}", *args
end