Skip to content

Commit

Permalink
Fix tests related to errant "fallback" src
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Eberle committed Nov 21, 2018
1 parent 44892e7 commit 498de78
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions spec/imgix/rails_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@

it 'generates the expected number of srcset values' do
tag = Nokogiri::HTML.fragment(helper.ix_image_tag("image.jpg")).children[0]
expect(tag.attribute('srcset').value.split(',').size).to eq(31)
expect(tag.attribute('srcset').value.split(',').size).to eq(30)
end

it 'generates the excpected number of srcset values with custom srcset-width-tolerance' do
Expand All @@ -226,11 +226,6 @@ def get_standard_widths
expect(Foo.new.get_standard_widths.size).to eq(7)
end

it 'last value is a fallback image' do
tag = Nokogiri::HTML.fragment(helper.ix_image_tag("image.jpg", url_params: {page: 3, w: 600, h: 300})).children[0]
expect(tag.attribute('srcset').value.split(',').last).not_to match("w=|h=")
end

it 'correctly calculates `h` to maintain aspect ratio, when specified' do
tag = Nokogiri::HTML.fragment(helper.ix_image_tag('presskit/imgix-presskit.pdf', url_params: {page: 3, w: 600, h: 300})).children[0]
sources = tag.attribute('srcset').value.split(',')
Expand All @@ -249,7 +244,7 @@ def get_standard_widths
end

it 'generates the expected number of srcset values' do
expect(tag.attribute('srcset').value.split(',').size).to eq(9)
expect(tag.attribute('srcset').value.split(',').size).to eq(8)
end
end

Expand All @@ -259,7 +254,7 @@ def get_standard_widths
end

it 'generates the expected number of srcset values' do
expect(tag.attribute('srcset').value.split(',').size).to eq(2)
expect(tag.attribute('srcset').value.split(',').size).to eq(1)
end
end
end
Expand Down

0 comments on commit 498de78

Please sign in to comment.