Sha256: 73f1d4136ac367eeb485c86a35b711ed4ed662752f22b5149c5b75157fc0e35d

Contents?: true

Size: 1.06 KB

Versions: 6

Compression:

Stored size: 1.06 KB

Contents

require 'spec_helper'

describe LinkShrink::Shrinkers::TinyUrl do
  include_examples 'shared_examples'

  let(:link_shrink) { described_class.new }
  let(:tiny_url) { 'http://tinyurl.com/api-create.php' }

  describe '#sub_klass' do
    it 'returns the inherited subclass name' do
      expect(link_shrink.sub_klass).to eq('TinyUrl')
    end
  end

  describe '#base_url' do
    it 'returns the base_url for the API' do
      expect(link_shrink.base_url)
      .to eq(tiny_url)
    end
  end

  describe '#api_url' do
    it 'returns full api url' do
      link_shrink.stub(:url).and_return('www.google.com')

      expect(link_shrink.api_url)
      .to eq('http://tinyurl.com/api-create.php?url=www.google.com')
    end
  end

  describe '#api_query_parameter' do
    it 'returns query parameter' do
      link_shrink.stub(:url).and_return('www.google.com')
      expect(link_shrink.api_query_parameter).to eq('?url=www.google.com')
    end
  end

  describe '#content_type' do
    it 'returns text/plain' do
      expect(link_shrink.content_type).to eq('text/plain')
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
link_shrink-0.0.8 spec/link_shrink/shrinkers/tiny_url_spec.rb
link_shrink-0.0.7 spec/link_shrink/shrinkers/tiny_url_spec.rb
link_shrink-0.0.6 spec/link_shrink/tiny_url_spec.rb
link_shrink-0.0.5 spec/link_shrink/tiny_url_spec.rb
link_shrink-0.0.4 spec/link_shrink/tiny_url_spec.rb
link_shrink-0.0.3 spec/link_shrink/tiny_url_spec.rb