Class: MuckEngine::Models::Matchers::OrdinalMatcher
- Inherits:
-
MuckMatcherBase
- Object
- MuckMatcherBase
- MuckEngine::Models::Matchers::OrdinalMatcher
- Defined in:
- lib/muck-engine/test/models/matchers/scope_ordinal_matchers.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(scope, field) ⇒ OrdinalMatcher
constructor
A new instance of OrdinalMatcher.
- #matches?(subject) ⇒ Boolean
Constructor Details
#initialize(scope, field) ⇒ OrdinalMatcher
Returns a new instance of OrdinalMatcher.
22 23 24 25 |
# File 'lib/muck-engine/test/models/matchers/scope_ordinal_matchers.rb', line 22 def initialize(scope, field) @scope = scope @field = field end |
Instance Method Details
#description ⇒ Object
39 40 41 |
# File 'lib/muck-engine/test/models/matchers/scope_ordinal_matchers.rb', line 39 def description "sort by ordinal" end |
#failure_message ⇒ Object
35 36 37 |
# File 'lib/muck-engine/test/models/matchers/scope_ordinal_matchers.rb', line 35 def "Expected #{factory_name} to have scope #{@scope} and order by #{@field}" end |
#matches?(subject) ⇒ Boolean
27 28 29 30 31 32 33 |
# File 'lib/muck-engine/test/models/matchers/scope_ordinal_matchers.rb', line 27 def matches?(subject) @subject = subject @subject.class.delete_all @first = Factory(factory_name, @field => 1) @second = Factory(factory_name, @field => 2) @first == @subject.class.send(@scope)[0] && @second == @subject.class.send(@scope)[1] end |