Class: RSpec::Rails::Matchers::BeValid
- Inherits:
-
Matchers::BuiltIn::Be
- Object
- Matchers::BuiltIn::Be
- RSpec::Rails::Matchers::BeValid
- Defined in:
- lib/rspec/rails/matchers/be_valid.rb
Instance Method Summary collapse
- #failure_message_for_should ⇒ Object private
- #failure_message_for_should_not ⇒ Object private
-
#initialize(*args) ⇒ BeValid
constructor
A new instance of BeValid.
- #matches?(actual) ⇒ Boolean private
Constructor Details
#initialize(*args) ⇒ BeValid
Returns a new instance of BeValid.
3 4 5 |
# File 'lib/rspec/rails/matchers/be_valid.rb', line 3 def initialize(*args) @args = args end |
Instance Method Details
#failure_message_for_should ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
14 15 16 17 18 19 20 21 |
# File 'lib/rspec/rails/matchers/be_valid.rb', line 14 def = "expected #{actual.inspect} to be valid" if actual.respond_to?(:errors) << ", but got errors: #{actual.errors..join(', ')}" end end |
#failure_message_for_should_not ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
24 25 26 |
# File 'lib/rspec/rails/matchers/be_valid.rb', line 24 def "expected #{actual.inspect} not to be valid" end |
#matches?(actual) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
8 9 10 11 |
# File 'lib/rspec/rails/matchers/be_valid.rb', line 8 def matches?(actual) @actual = actual actual.valid?(*@args) end |