Sha256: 19fe8127a828eb127037a87563934472c0710a47c840f8b11061226fc25d101a

Contents?: true

Size: 1.26 KB

Versions: 3

Compression:

Stored size: 1.26 KB

Contents

# encoding: utf-8
require 'test_helper'

class SupportTest < ActiveSupport::TestCase

  def setup
  end

  test "#find_resource_class: should find proper class based on class, class instance, or (symbol) name" do
    assert_nil ::Link2::Support.find_resource_class(nil)

    assert_equal ::Fraggle, ::Link2::Support.find_resource_class(::Fraggle)
    assert_equal ::Fraggle, ::Link2::Support.find_resource_class(::Fraggle.new)
    assert_equal ::Fraggle, ::Link2::Support.find_resource_class(:fraggle)

    assert_not_equal ::Fraggle, ::Link2::Support.find_resource_class(::Unicorn)
    assert_not_equal ::Fraggle, ::Link2::Support.find_resource_class(::Unicorn.new)
    assert_not_equal ::Fraggle, ::Link2::Support.find_resource_class(:unicorn)
  end

  test "#resource_identifier_class?: should only be true for valid classes" do
    assert ::Link2::Support.resource_identifier_class?(nil)
    assert ::Link2::Support.resource_identifier_class?(:hello)
    assert ::Link2::Support.resource_identifier_class?(::Fraggle)

    assert_not ::Link2::Support.resource_identifier_class?(::Unicorn)
  end

  test "#record_class?: should only be true for record classes" do
    assert ::Link2::Support.record_class?(::Fraggle)

    assert_not ::Link2::Support.record_class?(::Unicorn)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
link2-0.1.5 test/support_test.rb
link2-0.1.4 test/support_test.rb
link2-0.1.3 test/support_test.rb