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)
- - (Object) failure_message_for_should private
- - (Object) failure_message_for_should_not private
-
- (BeValid) initialize(*args)
constructor
A new instance of BeValid.
- - (Boolean) matches?(actual) private
Constructor Details
- (BeValid) initialize(*args)
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
- (Object) failure_message_for_should
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 |
- (Object) failure_message_for_should_not
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 |
- (Boolean) matches?(actual)
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 |