class Tengu::Expectation

Public Class Methods

new(object) click to toggle source
# File lib/tengu/expectation.rb, line 3
def initialize(object)
  @object = object
  @success = false
  @positive = true
  @matcher = nil
end

Public Instance Methods

message() click to toggle source
# File lib/tengu/expectation.rb, line 25
def message
  if @positive
    "expected #{@object.inspect} to #{@matcher.description}"
  else
    "expected #{@object.inspect} not to #{@matcher.description}"
  end
end
not_to(matcher) click to toggle source
# File lib/tengu/expectation.rb, line 19
def not_to(matcher)
  @positive = false
  @matcher = matcher
  @success = !@matcher.matches?(@object)
end
success?() click to toggle source
# File lib/tengu/expectation.rb, line 10
def success?
  @success
end
to(matcher) click to toggle source
# File lib/tengu/expectation.rb, line 14
def to(matcher)
  @matcher = matcher
  @success = @matcher.matches?(@object)
end