FIX: should be able to serve optimized image from local if its ... local...

This commit is contained in:
Sam
2015-05-26 12:32:52 +10:00
parent 90eaad336d
commit eeda367e70
3 changed files with 20 additions and 1 deletions

View File

@ -5,6 +5,21 @@ describe OptimizedImage do
let(:upload) { build(:upload) }
before { upload.id = 42 }
describe ".local?" do
def local(url)
OptimizedImage.new(url: url).local?
end
it "correctly detects local vs remote" do
expect(local("//hello")).to eq(false)
expect(local("http://hello")).to eq(false)
expect(local("https://hello")).to eq(false)
expect(local("https://hello")).to eq(false)
expect(local("/hello")).to eq(true)
end
end
describe ".create_for" do
context "when using an internal store" do