class MotionSpec::Expectation

Public Class Methods

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

Public Instance Methods

assert() click to toggle source
# File lib/motion-spec/expectation.rb, line 27
def assert
  true.should == true
end
fail(matcher, negated) click to toggle source
# File lib/motion-spec/expectation.rb, line 23
def fail(matcher, negated)
  fail matcher.fail!(@subject, negated, &@subject_block)
end
matcher_passes(matcher) click to toggle source
# File lib/motion-spec/expectation.rb, line 19
def matcher_passes(matcher)
  matcher.matches?(@subject, &@subject_block)
end
not_to(matcher) click to toggle source
# File lib/motion-spec/expectation.rb, line 13
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/motion-spec/expectation.rb, line 8
def to(matcher)
  fail(matcher, false) unless matcher_passes(matcher)
  assert
end
to_not(matcher)
Alias for: not_to