Sha256: d9e59d5a6a0d461d731ba38094a54ab9653a4d252f57020ebbaae2b3aadec06f

Contents?: true

Size: 913 Bytes

Versions: 7

Compression:

Stored size: 913 Bytes

Contents

require 'spec_helper'

describe Utils::ImageUrlFormatter do
  let(:url) { "http://berkin.com/whatever/else/is/here" }
  let(:image_url) { "/some/stupid/path" }
  let(:formatted_url) { Utils::ImageUrlFormatter.new(url, image_url).perform }

  context 'scheme is http' do
    it 'should return the image as a full url using the host as domain' do
      formatted_url.should == 'http://berkin.com/some/stupid/path'
    end
  end

  context 'scheme is https' do
    let(:url) { "https://berkin.com/whatever/else/is/here" }
    it 'should return the image as a full url using the host as domain' do
      formatted_url.should == 'https://berkin.com/some/stupid/path'
    end
  end

  context 'image_url is nil' do
    let(:image_url) { nil }
    it 'fails silently' do
      expect {
        formatted_url
      }.not_to raise_error
    end

    it 'returns nil' do
      formatted_url.should == nil
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
link_oracle-0.1.2 spec/link_oracle/Utils/image_url_formatter_spec.rb
link_oracle-0.1.1 spec/link_oracle/Utils/image_url_formatter_spec.rb
link_oracle-0.1.0 spec/link_oracle/Utils/image_url_formatter_spec.rb
link_oracle-0.0.8 spec/link_oracle/Utils/image_url_formatter_spec.rb
link_oracle-0.0.7 spec/link_oracle/Utils/image_url_formatter_spec.rb
link_oracle-0.0.6 spec/link_oracle/Utils/image_url_formatter_spec.rb
link_oracle-0.0.5 spec/link_oracle/Utils/image_url_formatter_spec.rb