Class: Shoulda::Matchers::ActiveRecord::HaveRichTextMatcher
- Inherits:
-
Object
- Object
- Shoulda::Matchers::ActiveRecord::HaveRichTextMatcher
- Defined in:
- lib/shoulda/matchers/active_record/have_rich_text_matcher.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(rich_text_attribute) ⇒ HaveRichTextMatcher
constructor
A new instance of HaveRichTextMatcher.
- #matches?(subject) ⇒ Boolean
Constructor Details
#initialize(rich_text_attribute) ⇒ HaveRichTextMatcher
Returns a new instance of HaveRichTextMatcher.
31 32 33 |
# File 'lib/shoulda/matchers/active_record/have_rich_text_matcher.rb', line 31 def initialize(rich_text_attribute) @rich_text_attribute = rich_text_attribute end |
Instance Method Details
#description ⇒ Object
35 36 37 38 |
# File 'lib/shoulda/matchers/active_record/have_rich_text_matcher.rb', line 35 def description "have configured :#{rich_text_attribute} as a "\ 'ActionText::RichText association' end |
#failure_message ⇒ Object
40 41 42 |
# File 'lib/shoulda/matchers/active_record/have_rich_text_matcher.rb', line 40 def "Expected #{subject.class} to #{error_description}" end |
#failure_message_when_negated ⇒ Object
44 45 46 47 |
# File 'lib/shoulda/matchers/active_record/have_rich_text_matcher.rb', line 44 def "Did not expect #{subject.class} to have ActionText::RichText"\ " :#{rich_text_attribute}" end |
#matches?(subject) ⇒ Boolean
49 50 51 52 53 |
# File 'lib/shoulda/matchers/active_record/have_rich_text_matcher.rb', line 49 def matches?(subject) @subject = subject @error = run_checks @error.nil? end |