Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Fix spec
Browse files Browse the repository at this point in the history
While working on this branch, Kito found that this test fails due to:

rails/rails@6ec8ba1#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:
rails/rails@b97035d

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
  • Loading branch information
tute committed Mar 23, 2016
1 parent 93c34e7 commit 799845e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions spec/paperclip/validators_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,11 @@
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
Expand Down

0 comments on commit 799845e

Please sign in to comment.