Reputation: 328
I found a nice hack to output a more meaningful error message when it { should be_valid }
fails.
Verbose be_valid RSpec Matcher
The hack overloads the be_valid with a matcher. But I'm unsure where to place this file. I tried adding it to: .rvm/gems/ruby-1.9.3-p286/gems/rspec-rails-2.11.0/lib/rspec/rails/matchers
then did bundle install but the changes did not make any difference.
Thanks!
Upvotes: 0
Views: 155
Reputation: 51697
In order to use a custom matcher, you just need to add the code to a new file in your application and require it anywhere you want it to be available. If you only have one custom matcher, I'd probably just stick it in spec/verbose_be_valid.rb and then require that in your spec_helper.rb file.
Upvotes: 1