I have a Rails 3.2 application in which I use paperclip to upload and store file attachments. This works great in itself, but I want to test it using rspec.
Now, the documentation provides some pretty nifty shoulda matchers to do just that. However, when I try to run them, it says my configuration in the spec helper is wrong:
uninitialized constant Paperclip::Shoulda (NameError)
I have the following in my spec helper:
RSpec.configure do |config|
config.include Paperclip::Shoulda::Matchers
end
And this is in my Gemfile:
group :development, :test do
gem "rspec-rails", "~> 2.0"
gem "shoulda-matchers"
end
I am not sure what I am missing here?
I found out what the problem was. I had require 'paperclip/matchers' behind the shoulda matchers, but instead I first need to require the paper clip matchers, and only afterwards include the shoulda matchers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With