Class: Spec::Rails::Matchers::ArBeValid
- Defined in:
- lib/vendor/plugins/rspec-rails/lib/spec/rails/matchers/ar_be_valid.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize ⇒ ArBeValid
constructor
A new instance of ArBeValid.
- #matches?(actual) ⇒ Boolean
Constructor Details
Instance Method Details
#description ⇒ Object
31 32 33 |
# File 'lib/vendor/plugins/rspec-rails/lib/spec/rails/matchers/ar_be_valid.rb', line 31 def description "be valid" end |
#failure_message_for_should ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/vendor/plugins/rspec-rails/lib/spec/rails/matchers/ar_be_valid.rb', line 18 def if @actual.respond_to?(:errors) && ActiveRecord::Errors === @actual.errors "Expected #{@actual.inspect} to be valid, but it was not\nErrors: " + @actual.errors..join(", ") else @matcher. end end |
#failure_message_for_should_not ⇒ Object
27 28 29 |
# File 'lib/vendor/plugins/rspec-rails/lib/spec/rails/matchers/ar_be_valid.rb', line 27 def @matcher. end |
#matches?(actual) ⇒ Boolean
13 14 15 16 |
# File 'lib/vendor/plugins/rspec-rails/lib/spec/rails/matchers/ar_be_valid.rb', line 13 def matches?(actual) @actual = actual @matcher.matches? @actual end |