Commit 799845ec by Tute Costa

Fix spec

While working on this branch, Kito found that this test fails due to:

https://github.com/rails/rails/commit/6ec8ba16d85d5feaccb993c9756c1edcbbf0ba13#diff-fdcf8b65b5fb954372c6fe1ddf284c78R76

We are not yet sure if it's a bug in paperclip or in Rails itself. With
current `ActiveModel::Errors` implementation the following happens:

```
record.errors # => @messages = {}
record.errors.include?(:foo) # => false
record.errors # => @messages = { :foo => [] }
```

Which bit us in:
https://github.com/thoughtbot/paperclip/blob/69f18375333234b6f395300266e2612936bd242e/lib/paperclip/validators/attachment_file_name_validator.rb#L23

Another related Rails commit:
https://github.com/rails/rails/commit/b97035df64f5b2f912425c4a7fcb6e6bb3ddab8d

I worked around the issue by changing what we assert in this spec. I am
still not sure that this is a bug in current Rails master.

cc @kitop for review
parent 93c34e76
......@@ -64,12 +64,11 @@ describe Paperclip::Validators do
assert_raises(RuntimeError){ dummy.valid? }
end
it 'allows you to attach a file that does not violates these validations' do
it 'allows you to attach a file that does not violate these validations' do
dummy = Dummy.new(avatar: File.new(fixture_file('rotated.jpg')))
expect(dummy.errors.keys).to match_array []
expect(dummy.errors.full_messages).to be_empty
assert dummy.valid?
end
end
context "using the helper with a conditional" do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment