Class: SerializationScopes::Shoulda::Matchers::SerializeMatcher
- Inherits:
-
Object
- Object
- SerializationScopes::Shoulda::Matchers::SerializeMatcher
- Defined in:
- lib/serialization_scopes/matchers/serialize_matcher.rb
Instance Attribute Summary collapse
-
#failure_message ⇒ Object
readonly
Returns the value of attribute failure_message.
-
#negative_failure_message ⇒ Object
readonly
Returns the value of attribute negative_failure_message.
Instance Method Summary collapse
- #description ⇒ Object
- #for(scope) ⇒ Object
- #matches?(subject) ⇒ Boolean
- #to(value) ⇒ Object
- #with_attributes(count) ⇒ Object
Instance Attribute Details
#failure_message ⇒ Object (readonly)
Returns the value of attribute failure_message.
41 42 43 |
# File 'lib/serialization_scopes/matchers/serialize_matcher.rb', line 41 def end |
#negative_failure_message ⇒ Object (readonly)
Returns the value of attribute negative_failure_message.
41 42 43 |
# File 'lib/serialization_scopes/matchers/serialize_matcher.rb', line 41 def end |
Instance Method Details
#description ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/serialization_scopes/matchers/serialize_matcher.rb', line 43 def description result = "serialize" result << " with #{@scope.inspect} scope" unless @scope.nil? result << " to #{@to.inspect}" unless @to.nil? result << " with #{@count} attributes" unless @count.nil? result end |
#for(scope) ⇒ Object
20 21 22 23 |
# File 'lib/serialization_scopes/matchers/serialize_matcher.rb', line 20 def for(scope) @scope = scope self end |
#matches?(subject) ⇒ Boolean
35 36 37 38 39 |
# File 'lib/serialization_scopes/matchers/serialize_matcher.rb', line 35 def matches?(subject) @subject = subject @subject.id ||= rand(10000000) correct_root? && correct_column_count? end |
#to(value) ⇒ Object
25 26 27 28 |
# File 'lib/serialization_scopes/matchers/serialize_matcher.rb', line 25 def to(value) @to = value self end |
#with_attributes(count) ⇒ Object
30 31 32 33 |
# File 'lib/serialization_scopes/matchers/serialize_matcher.rb', line 30 def with_attributes(count) @count = count self end |