Class: Polyrun::Quick::IncludeMatcher
- Inherits:
-
Object
- Object
- Polyrun::Quick::IncludeMatcher
- Defined in:
- lib/polyrun/quick/matchers.rb
Instance Method Summary collapse
- #does_not_match?(actual) ⇒ Boolean
- #failure_message(actual) ⇒ Object
- #failure_message_when_negated(actual) ⇒ Object
-
#initialize(expected_parts) ⇒ IncludeMatcher
constructor
A new instance of IncludeMatcher.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(expected_parts) ⇒ IncludeMatcher
Returns a new instance of IncludeMatcher.
109 110 111 |
# File 'lib/polyrun/quick/matchers.rb', line 109 def initialize(expected_parts) @expected_parts = expected_parts end |
Instance Method Details
#does_not_match?(actual) ⇒ Boolean
119 120 121 |
# File 'lib/polyrun/quick/matchers.rb', line 119 def does_not_match?(actual) !matches?(actual) end |
#failure_message(actual) ⇒ Object
123 124 125 |
# File 'lib/polyrun/quick/matchers.rb', line 123 def (actual) "expected #{actual.inspect} to include #{@expected_parts.map(&:inspect).join(", ")}" end |
#failure_message_when_negated(actual) ⇒ Object
127 128 129 |
# File 'lib/polyrun/quick/matchers.rb', line 127 def (actual) "expected #{actual.inspect} not to include #{@expected_parts.map(&:inspect).join(", ")}" end |
#matches?(actual) ⇒ Boolean
113 114 115 116 117 |
# File 'lib/polyrun/quick/matchers.rb', line 113 def matches?(actual) return false unless actual.respond_to?(:include?) @expected_parts.all? { |part| actual.include?(part) } end |