Skip to content

Commit

Permalink
fixup! Pass invalid_image_name into each image saving job
Browse files Browse the repository at this point in the history
These specs pass on Windows, but fail on Travis, so try a different way
of comparing images.
  • Loading branch information
Steve Day authored and Steve Day committed Sep 10, 2018
1 parent e0de3ed commit 9a3a247
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Binary file removed spec/images/invalid1.png
Binary file not shown.
20 changes: 13 additions & 7 deletions spec/save_images_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,24 @@
it "creates a dummy invalid image" do
allow(saving).to receive(:attempt_image_capture).and_raise("boom")
# Create the image at the original res of the invalid image, so that we
# can compare it's md5 easily
# can compare its md5 easily
jobs = [
['test', '/test/path', '1500x1500', test_url1, test_image1, nil, nil, nil,
'invalid1.jpg']
]
saving.parallel_task(jobs)
# Test fixture image created from the original invalid image because
# the original is a jpg
invalid_image = get_path_relative_to __FILE__, "./images/invalid1.png"
invalid_md5 = Digest::MD5.hexdigest(File.read(invalid_image))
created_md5 = Digest::MD5.hexdigest(File.read(test_image1))
expect(created_md5).to eq invalid_md5
# Create the expected image so we can compare them, because they'll
# differ between imagemagick versions and platforms and so we can't just
# use a fixture.
saving.create_invalid_image("shots/test/invalid1.png", 1500, "invalid1.jpg")
Wraith::CompareImages.new(config_name).compare_task(
test_image1,
"shots/test/invalid1.png",
"shots/test/test_diff.png",
"shots/test/test.txt"
)
diff = File.open("shots/test/test.txt", "rb").read
expect(diff).to eq "0.0"
end
end
end
Expand Down

0 comments on commit 9a3a247

Please sign in to comment.