Sha256: 3e68cd087307f6893ff945d86f93a7f3640c0f1736038e8fb9aae3949e61b321

Contents?: true

Size: 975 Bytes

Versions: 6

Compression:

Stored size: 975 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')

class Tokamak::Builder::BaseTest < Test::Unit::TestCase

  class SomeBuilder < Tokamak::Builder::Base
    builder_for "valid/media_type"
  end

  class AnotherBuilder < Tokamak::Builder::Base
    builder_for "valid/media_type", "another_valid/media_type"
  end

  class YetAnotherBuilder < Tokamak::Builder::Base
    builder_for "yet_another_valid/media_type"
  end

  def test_should_support_media_type_registering
    assert_equal ["valid/media_type"]                           , SomeBuilder.media_types
    assert_equal ["valid/media_type","another_valid/media_type"], AnotherBuilder.media_types
  end

  def test_builder_lookup
    assert_equal AnotherBuilder   , Tokamak.builder_lookup("valid/media_type")
    assert_equal AnotherBuilder   , Tokamak.builder_lookup("another_valid/media_type")
    assert_equal YetAnotherBuilder, Tokamak.builder_lookup("yet_another_valid/media_type")
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tokamak-1.1.5 test/tokamak/builder/base_test.rb
tokamak-1.1.4 test/tokamak/builder/base_test.rb
tokamak-1.1.3 test/tokamak/builder/base_test.rb
tokamak-1.1.2 test/tokamak/builder/base_test.rb
tokamak-1.0.0.beta4 test/tokamak/builder/base_test.rb
tokamak-1.1.1 test/tokamak/builder/base_test.rb