Class: Graphiti::SpecHelpers::Matchers::BaseMatcher
- Inherits:
-
Object
- Object
- Graphiti::SpecHelpers::Matchers::BaseMatcher
show all
- Defined in:
- lib/graphiti/spec_helpers/matchers.rb
Constant Summary
collapse
- GRAPHITI_OPTS =
[].freeze
- GRAPHITI_CONFIG_KEY =
""
- EXPECTED_ACTION =
""
Instance Method Summary
collapse
Instance Method Details
#description ⇒ Object
12
13
14
|
# File 'lib/graphiti/spec_helpers/matchers.rb', line 12
def description
"#{self.class::EXPECTED_ACTION} #{target}"
end
|
#does_not_match?(resource) ⇒ Boolean
28
29
30
|
# File 'lib/graphiti/spec_helpers/matchers.rb', line 28
def does_not_match?(resource)
!matches?(resource)
end
|
#failure_message ⇒ Object
16
17
18
|
# File 'lib/graphiti/spec_helpers/matchers.rb', line 16
def failure_message
"expected that #{resource.class} would #{self.class::EXPECTED_ACTION} #{target}\n#{@opt_failures.join("\n")}"
end
|
#failure_message_when_negated ⇒ Object
20
21
22
|
# File 'lib/graphiti/spec_helpers/matchers.rb', line 20
def failure_message_when_negated
"expected that #{resource.class} would not #{self.class::EXPECTED_ACTION} #{target}"
end
|
#matches?(resource) ⇒ Boolean
32
33
34
35
36
|
# File 'lib/graphiti/spec_helpers/matchers.rb', line 32
def matches?(resource)
@resource = resource
expected? && expected_opts?
end
|
#opt_failure_message(opt, expected, actual) ⇒ Object
24
25
26
|
# File 'lib/graphiti/spec_helpers/matchers.rb', line 24
def opt_failure_message(opt, expected, actual)
"expected that #{opt} would be #{expected}, was #{actual}"
end
|
#with_options(opts) ⇒ Object
38
39
40
41
|
# File 'lib/graphiti/spec_helpers/matchers.rb', line 38
def with_options(opts)
@opts = opts
self
end
|