Sha256: 29ffd61e02f2124e27750c15a0d9c10ea729dd2dc2868ec0b0fdec8bc0d8aa05

Contents?: true

Size: 977 Bytes

Versions: 11

Compression:

Stored size: 977 Bytes

Contents

require 'test_helper'

module PushType
  class MediaUrlHelperTest < ActionView::TestCase

    let(:asset) { FactoryGirl.create :asset }

    describe '#media_path' do
      it { media_path(asset).must_equal "/media/#{ asset.file_uid }" }
      it { media_path('test2.jpg').must_equal '/media/test2.jpg' }
    end

    describe '#media_url' do
      it { media_url(asset).must_equal "http://test.host/media/#{ asset.file_uid }" }
      it { media_url('test2.jpg').must_equal 'http://test.host/media/test2.jpg' }
    end

    describe 'with asset_host set' do      
      it '#media_path' do
        stub :compute_asset_host, 'https://cdn.test.host' do
          media_path(asset).must_equal "https://cdn.test.host/media/#{ asset.file_uid }"
        end
      end
      it '#media_url' do
        stub :compute_asset_host, 'https://cdn.test.host' do
          media_url(asset).must_equal "https://cdn.test.host/media/#{ asset.file_uid }"
        end
      end
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
push_type_core-0.11.2 test/helpers/push_type/media_url_helper_test.rb
push_type_core-0.11.1 test/helpers/push_type/media_url_helper_test.rb
push_type_core-0.11.0.beta.2 test/helpers/push_type/media_url_helper_test.rb
push_type_core-0.11.0.beta.1 test/helpers/push_type/media_url_helper_test.rb
push_type_core-0.10.4 test/helpers/push_type/media_url_helper_test.rb
push_type_core-0.10.3 test/helpers/push_type/media_url_helper_test.rb
push_type_core-0.10.2 test/helpers/push_type/media_url_helper_test.rb
push_type_core-0.10.1 test/helpers/push_type/media_url_helper_test.rb
push_type_core-0.10.0 test/helpers/push_type/media_url_helper_test.rb
push_type_core-0.10.0.beta.5 test/helpers/push_type/media_url_helper_test.rb
push_type_core-0.10.0.beta.3 test/helpers/push_type/media_url_helper_test.rb