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.
33 34 35 |
# File 'lib/shoulda/matchers/active_record/have_implicit_order_column.rb', line 33 def initialize(column_name) @column_name = column_name end |
Instance Attribute Details
#failure_message ⇒ Object (readonly)
Returns the value of attribute failure_message.
31 32 33 |
# File 'lib/shoulda/matchers/active_record/have_implicit_order_column.rb', line 31 def end |
Instance Method Details
#description ⇒ Object
61 62 63 |
# File 'lib/shoulda/matchers/active_record/have_implicit_order_column.rb', line 61 def description expectation end |
#failure_message_when_negated ⇒ Object
55 56 57 58 59 |
# File 'lib/shoulda/matchers/active_record/have_implicit_order_column.rb', line 55 def Shoulda::Matchers.word_wrap( "Expected #{model.name} not to #{expectation}, but it did.", ) end |
#matches?(subject) ⇒ Boolean
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/shoulda/matchers/active_record/have_implicit_order_column.rb', line 37 def matches?(subject) @subject = subject check_column_exists! check_implicit_order_column_matches! true rescue SecondaryCheckFailedError => e = Shoulda::Matchers.word_wrap( "Expected #{model.name} to #{expectation}, " + "but that could not be proved: #{e.message}.", ) false rescue PrimaryCheckFailedError => e = Shoulda::Matchers.word_wrap( "Expected #{model.name} to #{expectation}, but #{e.message}.", ) false end |