Module: Smartest::Matchers
- Included in:
- ExecutionContext
- Defined in:
- lib/smartest/matchers.rb
Instance Method Summary collapse
- #be_nil ⇒ Object
- #change(*args, &block) ⇒ Object
- #end_with(*suffixes) ⇒ Object
- #eq(expected) ⇒ Object
- #include(expected) ⇒ Object
- #raise_error(expected_error = StandardError) ⇒ Object
- #start_with(*prefixes) ⇒ Object
Instance Method Details
#be_nil ⇒ Object
21 22 23 |
# File 'lib/smartest/matchers.rb', line 21 def be_nil BeNilMatcher.new end |
#change(*args, &block) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/smartest/matchers.rb', line 29 def change(*args, &block) raise ArgumentError, "change does not support arguments; use change { ... }" if args.any? raise ArgumentError, "change requires a block" unless block ChangeMatcher.new(block) end |
#end_with(*suffixes) ⇒ Object
17 18 19 |
# File 'lib/smartest/matchers.rb', line 17 def end_with(*suffixes) EndWithMatcher.new(*suffixes) end |
#eq(expected) ⇒ Object
5 6 7 |
# File 'lib/smartest/matchers.rb', line 5 def eq(expected) EqMatcher.new(expected) end |
#include(expected) ⇒ Object
9 10 11 |
# File 'lib/smartest/matchers.rb', line 9 def include(expected) IncludeMatcher.new(expected) end |
#raise_error(expected_error = StandardError) ⇒ Object
25 26 27 |
# File 'lib/smartest/matchers.rb', line 25 def raise_error(expected_error = StandardError) RaiseErrorMatcher.new(expected_error) end |
#start_with(*prefixes) ⇒ Object
13 14 15 |
# File 'lib/smartest/matchers.rb', line 13 def start_with(*prefixes) StartWithMatcher.new(*prefixes) end |