Class: Polyrun::Quick::Expectation
- Inherits:
-
Object
- Object
- Polyrun::Quick::Expectation
- Defined in:
- lib/polyrun/quick/matchers.rb
Overview
Minimal expect(x).to … chain (RSpec-ish) without RSpec.
Instance Method Summary collapse
-
#initialize(actual) ⇒ Expectation
constructor
A new instance of Expectation.
- #not_to(matcher) ⇒ Object
- #to(matcher) ⇒ Object
Constructor Details
#initialize(actual) ⇒ Expectation
Returns a new instance of Expectation.
7 8 9 |
# File 'lib/polyrun/quick/matchers.rb', line 7 def initialize(actual) @actual = actual end |
Instance Method Details
#not_to(matcher) ⇒ Object
17 18 19 20 21 |
# File 'lib/polyrun/quick/matchers.rb', line 17 def not_to(matcher) return if matcher.does_not_match?(@actual) raise AssertionFailed, matcher.(@actual) end |
#to(matcher) ⇒ Object
11 12 13 14 15 |
# File 'lib/polyrun/quick/matchers.rb', line 11 def to(matcher) return if matcher.matches?(@actual) raise AssertionFailed, matcher.(@actual) end |