Class: Shoulda::Matchers::ActiveRecord::HaveImplicitOrderColumnMatcher
- Inherits:
-
Object
- Object
- Shoulda::Matchers::ActiveRecord::HaveImplicitOrderColumnMatcher
- Defined in:
- lib/shoulda/matchers/active_record/have_implicit_order_column.rb
Defined Under Namespace
Classes: PrimaryCheckFailedError, SecondaryCheckFailedError
Instance Attribute Summary collapse
-
#failure_message ⇒ Object
readonly
Returns the value of attribute failure_message.
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(column_name) ⇒ HaveImplicitOrderColumnMatcher
constructor
A new instance of HaveImplicitOrderColumnMatcher.
- #matches?(subject) ⇒ Boolean
Constructor Details
#initialize(column_name) ⇒ HaveImplicitOrderColumnMatcher
Returns a new instance of HaveImplicitOrderColumnMatcher.
31 32 33 |
# File 'lib/shoulda/matchers/active_record/have_implicit_order_column.rb', line 31 def initialize(column_name) @column_name = column_name end |
Instance Attribute Details
#failure_message ⇒ Object (readonly)
Returns the value of attribute failure_message.
29 30 31 |
# File 'lib/shoulda/matchers/active_record/have_implicit_order_column.rb', line 29 def @failure_message end |
Instance Method Details
#description ⇒ Object
59 60 61 |
# File 'lib/shoulda/matchers/active_record/have_implicit_order_column.rb', line 59 def description expectation end |
#failure_message_when_negated ⇒ Object
53 54 55 56 57 |
# File 'lib/shoulda/matchers/active_record/have_implicit_order_column.rb', line 53 def Shoulda::Matchers.word_wrap( "Expected #{model.name} not to #{expectation}, but it did.", ) end |
#matches?(subject) ⇒ Boolean
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/shoulda/matchers/active_record/have_implicit_order_column.rb', line 35 def matches?(subject) @subject = subject check_column_exists! check_implicit_order_column_matches! true rescue SecondaryCheckFailedError => e @failure_message = Shoulda::Matchers.word_wrap( "Expected #{model.name} to #{expectation}, " + "but that could not be proved: #{e.}.", ) false rescue PrimaryCheckFailedError => e @failure_message = Shoulda::Matchers.word_wrap( "Expected #{model.name} to #{expectation}, but #{e.}.", ) false end |