Class: MuckEngine::Models::Matchers::CreatedByMatcher
- Inherits:
-
MuckMatcherBase
- Object
- MuckMatcherBase
- MuckEngine::Models::Matchers::CreatedByMatcher
- Defined in:
- lib/muck-engine/test/models/matchers/scope_creator_matchers.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(scope, field) ⇒ CreatedByMatcher
constructor
A new instance of CreatedByMatcher.
- #matches?(subject) ⇒ Boolean
Constructor Details
#initialize(scope, field) ⇒ CreatedByMatcher
Returns a new instance of CreatedByMatcher.
37 38 39 40 |
# File 'lib/muck-engine/test/models/matchers/scope_creator_matchers.rb', line 37 def initialize(scope, field) @scope = scope @field = field end |
Instance Method Details
#description ⇒ Object
57 58 59 |
# File 'lib/muck-engine/test/models/matchers/scope_creator_matchers.rb', line 57 def description "scope created_by" end |
#failure_message ⇒ Object
53 54 55 |
# File 'lib/muck-engine/test/models/matchers/scope_creator_matchers.rb', line 53 def "Expected #{factory_name} to have scope created_by and to be able to successfully find #{@subject}'s creator" end |
#matches?(subject) ⇒ Boolean
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/muck-engine/test/models/matchers/scope_creator_matchers.rb', line 42 def matches?(subject) @subject = subject @subject.class.delete_all @user = Factory(:user) @user1 = Factory(:user) @item = Factory(factory_name, @field => @user) @item1 = Factory(factory_name, @field => @user1) items = @subject.class.send(@scope, @user) items.include?(@item) && !items.include?(@item1) end |