class BaconExpect::Expectation

Public Class Methods

new(subject, &subject_block) click to toggle source
# File lib/bacon-expect/expectation.rb, line 9
def initialize(subject, &subject_block)
  @subject = subject
  @subject_block = subject_block
end

Public Instance Methods

assert() click to toggle source
# File lib/bacon-expect/expectation.rb, line 33
def assert
  true.should == true
end
fail(matcher, negated) click to toggle source
# File lib/bacon-expect/expectation.rb, line 29
def fail(matcher, negated)
  raise matcher.fail!(@subject, negated, &@subject_block)
end
matcher_passes(matcher) click to toggle source
# File lib/bacon-expect/expectation.rb, line 25
def matcher_passes(matcher)
  matcher.matches?(@subject, &@subject_block)
end
not_to(matcher) click to toggle source
# File lib/bacon-expect/expectation.rb, line 19
def not_to(matcher)
  fail(matcher, true) if matcher_passes(matcher)
  assert
end
Also aliased as: to_not
to(matcher) click to toggle source
# File lib/bacon-expect/expectation.rb, line 14
def to(matcher)
  fail(matcher, false) unless matcher_passes(matcher)
  assert
end
to_not(matcher)
Alias for: not_to