Module: Smartest::Matchers
- Included in:
- ExecutionContext
- Defined in:
- lib/smartest/matchers.rb
Instance Method Summary collapse
- #be_a(expected_class) ⇒ Object
- #be_an(expected_class) ⇒ Object
- #be_nil ⇒ Object
- #change(*args, &block) ⇒ Object
- #contain_exactly(*expected_items) ⇒ Object
- #end_with(*suffixes) ⇒ Object
- #eq(expected) ⇒ Object
- #include(expected) ⇒ Object
- #match(regexp) ⇒ Object
- #match_array(expected_items) ⇒ Object
- #raise_error(*expected_error) ⇒ Object
- #start_with(*prefixes) ⇒ Object
Instance Method Details
#be_a(expected_class) ⇒ Object
21 22 23 |
# File 'lib/smartest/matchers.rb', line 21 def be_a(expected_class) BeAKindOfMatcher.new(expected_class) end |
#be_an(expected_class) ⇒ Object
25 26 27 |
# File 'lib/smartest/matchers.rb', line 25 def be_an(expected_class) BeAKindOfMatcher.new(expected_class) end |
#be_nil ⇒ Object
29 30 31 |
# File 'lib/smartest/matchers.rb', line 29 def be_nil BeNilMatcher.new end |
#change(*args, &block) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/smartest/matchers.rb', line 49 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 |
#contain_exactly(*expected_items) ⇒ Object
37 38 39 |
# File 'lib/smartest/matchers.rb', line 37 def contain_exactly(*expected_items) ContainExactlyMatcher.new(expected_items, matcher_name: "contain exactly") 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 |
#match(regexp) ⇒ Object
33 34 35 |
# File 'lib/smartest/matchers.rb', line 33 def match(regexp) MatchMatcher.new(regexp) end |
#match_array(expected_items) ⇒ Object
41 42 43 |
# File 'lib/smartest/matchers.rb', line 41 def match_array(expected_items) ContainExactlyMatcher.new(expected_items, matcher_name: "match array") end |
#raise_error(*expected_error) ⇒ Object
45 46 47 |
# File 'lib/smartest/matchers.rb', line 45 def raise_error(*expected_error) 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 |