Class: MuckEngine::Models::Matchers::IsPublicMatcher
- Inherits:
-
MuckMatcherBase
- Object
- MuckMatcherBase
- MuckEngine::Models::Matchers::IsPublicMatcher
- Defined in:
- lib/muck-engine/test/models/matchers/scope_is_public_matchers.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(scope, field = :is_public) ⇒ IsPublicMatcher
constructor
A new instance of IsPublicMatcher.
- #matches?(subject) ⇒ Boolean
Constructor Details
#initialize(scope, field = :is_public) ⇒ IsPublicMatcher
Returns a new instance of IsPublicMatcher.
17 18 19 20 |
# File 'lib/muck-engine/test/models/matchers/scope_is_public_matchers.rb', line 17 def initialize(scope, field = :is_public) @scope = scope @field = field end |
Instance Method Details
#description ⇒ Object
35 36 37 |
# File 'lib/muck-engine/test/models/matchers/scope_is_public_matchers.rb', line 35 def description "public items" end |
#failure_message ⇒ Object
31 32 33 |
# File 'lib/muck-engine/test/models/matchers/scope_is_public_matchers.rb', line 31 def "Expected #{factory_name} to scope by #{@scope} on #{@field} and only find public 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_is_public_matchers.rb', line 22 def matches?(subject) @subject = subject @subject.class.delete_all public_item = Factory(factory_name, @field => true) not_public_item = Factory(factory_name, @field => false) @subject.class.send(@scope).include?(public_item) && !@subject.class.send(@scope).include?(not_public_item) end |