README.md in paperclip-storage-tmp-0.0.1 vs README.md in paperclip-storage-tmp-0.0.2
- old
+ new
@@ -77,13 +77,19 @@
The most important part is actually "rolling back the filesystem" after every test, so that the next test will run with isolated state. That's where the `Paperclip::Storage::Tmp.clear` method comes in handy. Call this method in the `teardown`/`after` block of your test framework. Here's an example for `RSpec`:
# in spec/spec_helper.rb
RSpec.configure do |config|
- config.after do
- Paperclip::Storage::Tmp.clear
- end
+ config.after { Paperclip::Storage::Tmp.clear }
end
+
+Or, just use the provided one-line testing helpers for RSpec and Cucumber, which add the necessary after hooks for you:
+
+ # in spec/spec_helper.rb
+ require 'paperclip-storage-tmp/testing/rspec'
+
+ # in features/support/env.rb
+ require 'paperclip-storage-tmp/testing/cucumber'
## Caveats
Beware that the file name assigned to the model attribute (`<attachment>_file_name`) is different than the name of the assigned/uploaded file (it's the name of the temporary file - a unique string).