lib/bacon-expect/expectation.rb in bacon-expect-1.0.1 vs lib/bacon-expect/expectation.rb in bacon-expect-1.0.2
- old
+ new
@@ -10,30 +10,28 @@
@subject = subject
@subject_block = subject_block
end
def to(matcher)
- unless matcher.matches?(@subject, &@subject_block)
- raise matcher.fail!(@subject, &@subject_block)
- end
+ fail(matcher) unless matcher_passes(matcher)
assert
end
def not_to(matcher)
- if matcher.matches?(@subject, &@subject_block)
- raise matcher.fail!(@subject, &@subject_block)
- end
+ fail(matcher) if matcher_passes(matcher)
assert
end
alias_method :to_not, :not_to
+ def matcher_passes(matcher)
+ matcher.matches?(@subject, &@subject_block)
+ end
+
+ def fail(matcher)
+ raise matcher.fail!(@subject, &@subject_block)
+ end
+
def assert
true.should == true
end
end
-end
-
-module Spector
-
-
-
-end
+end
\ No newline at end of file