Sha256: 8172c196d7b060e6ef2e82decded423fb48b8268e4b37d5f450091b206e0c926

Contents?: true

Size: 695 Bytes

Versions: 9

Compression:

Stored size: 695 Bytes

Contents

require 'test_helper'
require 'bbq/util'

class User
  module Commenter
  end
end

module Commenter
end

class BbqUtilTest < Test::Unit::TestCase

  def test_find_module_in_object_namespace
    assert_commenter(User.new, User::Commenter)
  end

  def test_find_module_in_class_namespace
    assert_commenter(User, User::Commenter)
  end

  def test_find_module_in_string_namespace
    assert_commenter("User", User::Commenter)
  end

  def test_find_global_module
    assert_commenter(nil, ::Commenter)
  end


  private


  def assert_commenter(namespace, result)
    [:commenter, "commenter"].each do |name|
      assert_equal Bbq::Util.find_module(name, namespace), result
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bbq-0.2.1 test/unit/bbq_util_test.rb
bbq-0.2.0 test/unit/bbq_util_test.rb
bbq-0.1.0 test/unit/bbq_util_test.rb
bbq-0.0.4 test/unit/bbq_util_test.rb
bbq-0.0.3 test/unit/bbq_util_test.rb
bbq-0.0.2 test/unit/bbq_util_test.rb
bbq-0.0.2.beta.3 test/unit/bbq_util_test.rb
bbq-0.0.2.beta.2 test/unit/bbq_util_test.rb
bbq-0.0.2.beta.1 test/unit/bbq_util_test.rb