Sha256: 170cb097b4cc82c0bd255451cda0329f9577c707d078b789fe75a3539f1a2833
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
require 'test_helper' class AutoloadingTest < Minitest::Test include FakesFilesystem include TestsAutoloading def test_simple_case assert_equal 'hello from A::AA', Foo::A.references_aa end def test_negative_case assert_raises NameError do Foo::A.references_abracadabra end end def test_deeply_nested_module_with_implicit_namespaces assert_equal 'hello from C::CA::CAA::CAAA', Foo::A.references_caaa end def test_reference_from_within_constant assert_equal 'hello from A', Foo::D.references_a assert_equal 'hello from B::BA', Foo::D.new.references_b_ba end def test_invoking_method_inside_implicit_namespace_raises_error exception = assert_raises NameError do Foo::C.hello end assert_equal "uninitialized constant C (in Foo)", exception.message end def test_raises_name_error_if_no_context_found exception = assert_raises NameError do Abracadabra end assert_equal "uninitialized constant Abracadabra", exception.message end def test_application_autoload_paths Pico.application.resolve_const 'A' assert_equal 'hello from MyApp::A', MyApp::A.message # Implicit namespace assert_equal 'hello from MyApp::B::BA', MyApp::A.references_b_ba end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pico-0.1.0 | test/integration/autoloading_test.rb |
pico-0.0.1 | test/integration/autoloading_test.rb |