Sha256: 24272d7c52f4da3b4a8a38a9aa70ab6e11f97230830058779196665eca17e211

Contents?: true

Size: 684 Bytes

Versions: 2

Compression:

Stored size: 684 Bytes

Contents

require 'test_helper'
require 'bbq/core/util'

class User
  module Commenter
  end
end

module Commenter
end

class UtilTest < Minitest::Test

  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

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

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bbq-core-0.4.0 test/util_test.rb
bbq-core-0.3.0 test/util_test.rb