Sha256: f0faf2b184c1321e747566a3883558d5f49ac65d4965ba4d0d7e32d06ac89e60

Contents?: true

Size: 905 Bytes

Versions: 5

Compression:

Stored size: 905 Bytes

Contents

require "test_helper"
require "roger/testing/mock_release"

module Roger
  # Test Roger Mockup
  class UrlRelativizerTest < ::Test::Unit::TestCase
    def setup
      @release = Testing::MockRelease.new
      @processor = Roger::Release::Processors::UrlRelativizer.new
    end

    def teardown
      @release.destroy
      @release = nil
    end

    def test_empty_release_runs
      files = @processor.call(@release)
      assert_equal 0, files.length
    end

    def test_basic_relativization
      @release.project.construct.directory "build/sub" do |dir|
        dir.file "test.html", "<a href='/test.html'>link</a>"
      end
      @release.project.construct.file "build/test.html"

      files = @processor.call(@release)
      assert_equal 2, files.length

      contents = File.read((@release.build_path + "sub/test.html").to_s)
      assert contents.include?("../test.html")
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
roger-1.3.5 test/unit/release/processors/url_relativizer_test.rb
roger-1.3.4 test/unit/release/processors/url_relativizer_test.rb
roger-1.3.3 test/unit/release/processors/url_relativizer_test.rb
roger-1.3.2 test/unit/release/processors/url_relativizer_test.rb
roger-1.3.0 test/unit/release/processors/url_relativizer_test.rb