Skip to content

Commit

Permalink
Merge pull request alphagov#7602 from alphagov/test-for-image-too-lar…
Browse files Browse the repository at this point in the history
…ge-and-too-small

Add test for images both "too large" & "too small"
  • Loading branch information
ollietreend authored May 3, 2023
2 parents f248c53 + e9f7dfa commit cb03ae8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/unit/image_data_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ class ImageDataTest < ActiveSupport::TestCase
assert image_data.errors.of_kind?(:file, :too_large)
end

test "rejects image as 'too small' when it's too large in one dimension but too small in another" do
image_data = build_example("300x1000_png.png")
assert_not image_data.valid?
assert image_data.errors.of_kind?(:file, :too_small)
end

test "rejects images with duplicate filename on edition" do
image_data = build_example("960x640_jpeg.jpg")
edition = create(:news_article, images: [build(:image, image_data:)])
Expand Down

0 comments on commit cb03ae8

Please sign in to comment.