Class: MuckEngine::Models::Matchers::ActiveMatcher
- Inherits:
-
MuckMatcherBase
- Object
- MuckMatcherBase
- MuckEngine::Models::Matchers::ActiveMatcher
- Defined in:
- lib/muck-engine/test/models/matchers/scope_active_matchers.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(scope, field = :active) ⇒ ActiveMatcher
constructor
A new instance of ActiveMatcher.
- #matches?(subject) ⇒ Boolean
Constructor Details
#initialize(scope, field = :active) ⇒ ActiveMatcher
Returns a new instance of ActiveMatcher.
17 18 19 20 |
# File 'lib/muck-engine/test/models/matchers/scope_active_matchers.rb', line 17 def initialize(scope, field = :active) @scope = scope @field = field end |
Instance Method Details
#description ⇒ Object
35 36 37 |
# File 'lib/muck-engine/test/models/matchers/scope_active_matchers.rb', line 35 def description "active items" end |
#failure_message ⇒ Object
31 32 33 |
# File 'lib/muck-engine/test/models/matchers/scope_active_matchers.rb', line 31 def "Expected #{factory_name} to scope by #{@scope} on #{@field} and only find active items. But the call failed" end |
#matches?(subject) ⇒ Boolean
22 23 24 25 26 27 28 29 |
# File 'lib/muck-engine/test/models/matchers/scope_active_matchers.rb', line 22 def matches?(subject) @subject = subject @subject.class.delete_all active_item = Factory(factory_name, @field => true) not_active_item = Factory(factory_name, @field => false) @subject.class.send(@scope).include?(active_item) && !@subject.class.send(@scope).include?(not_active_item) end |