Sha256: e9e5619b4dbb1d815e0d32d67c344c997b4058c33ea51703916e9111ce2c0795

Contents?: true

Size: 925 Bytes

Versions: 6

Compression:

Stored size: 925 Bytes

Contents

require 'test_helper'

class SwfPathTest < ActionView::TestCase
  context "with no special asset host" do
    should "deduce the extension" do
      assert_equal swf_path("example.swf"), swf_path("example")
      assert_match "/swfs/example.swf", swf_path("example.swf")
    end

    should "accept relative paths" do
      assert_equal "/swfs/whatever/example.swf", swf_path("whatever/example.swf")
    end

    should "leave full paths alone" do
      ["/full/path.swf", "http://www.example.com/whatever.swf"].each do |p|
        assert_equal p, swf_path(p)
      end
    end
  end

  context "with custom asset host" do
    HOST = "http://assets.example.com"
    setup do
      ActionController::Base.asset_host = HOST
    end

    teardown do
      ActionController::Base.asset_host = nil
    end

    should "take it into account" do
      assert_equal "#{HOST}/swfs/whatever.swf", swf_path("whatever")
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
swf-guess-1.0.0 test/swf_path_test.rb
swf_fu-2.0.4 test/swf_path_test.rb
swf_fu-2.0.3 test/swf_path_test.rb
swf_fu-2.0.2 test/swf_path_test.rb
swf_fu-2.0.1 test/swf_path_test.rb
swf_fu-2.0.0 test/swf_path_test.rb