class ConstantLookupTest
Public Instance Methods
find_foo(name)
click to toggle source
# File activesupport/test/testing/constant_lookup_test.rb, line 17 def find_foo(name) self.class.determine_constant_from_test_name(name) do |constant| Class === constant && constant < Foo end end
find_module(name)
click to toggle source
# File activesupport/test/testing/constant_lookup_test.rb, line 23 def find_module(name) self.class.determine_constant_from_test_name(name) do |constant| Module === constant end end
test_does_not_swallow_exception_on_no_method_error()
click to toggle source
# File activesupport/test/testing/constant_lookup_test.rb, line 63 def test_does_not_swallow_exception_on_no_method_error assert_raises(NoMethodError) { with_autoloading_fixtures { self.class.determine_constant_from_test_name("RaisesNoMethodError") } } end
test_does_not_swallow_exception_on_no_name_error_within_constant()
click to toggle source
# File activesupport/test/testing/constant_lookup_test.rb, line 71 def test_does_not_swallow_exception_on_no_name_error_within_constant assert_raises(NameError) do with_autoloading_fixtures do self.class.determine_constant_from_test_name("RaisesNameError") end end end
test_find_bar_from_foo()
click to toggle source
# File activesupport/test/testing/constant_lookup_test.rb, line 29 def test_find_bar_from_foo assert_equal Bar, find_foo("Bar") assert_equal Bar, find_foo("Bar::index") assert_equal Bar, find_foo("Bar::index::authenticated") assert_equal Bar, find_foo("BarTest") assert_equal Bar, find_foo("BarTest::index") assert_equal Bar, find_foo("BarTest::index::authenticated") end
test_find_module()
click to toggle source
# File activesupport/test/testing/constant_lookup_test.rb, line 38 def test_find_module assert_equal FooBar, find_module("FooBar") assert_equal FooBar, find_module("FooBar::index") assert_equal FooBar, find_module("FooBar::index::authenticated") assert_equal FooBar, find_module("FooBarTest") assert_equal FooBar, find_module("FooBarTest::index") assert_equal FooBar, find_module("FooBarTest::index::authenticated") end
test_returns_nil_when_cant_find_foo()
click to toggle source
# File activesupport/test/testing/constant_lookup_test.rb, line 47 def test_returns_nil_when_cant_find_foo assert_nil find_foo("DoesntExist") assert_nil find_foo("DoesntExistTest") assert_nil find_foo("DoesntExist::Nadda") assert_nil find_foo("DoesntExist::Nadda::Nope") assert_nil find_foo("DoesntExist::Nadda::Nope::NotHere") end
test_returns_nil_when_cant_find_module()
click to toggle source
# File activesupport/test/testing/constant_lookup_test.rb, line 55 def test_returns_nil_when_cant_find_module assert_nil find_module("DoesntExist") assert_nil find_module("DoesntExistTest") assert_nil find_module("DoesntExist::Nadda") assert_nil find_module("DoesntExist::Nadda::Nope") assert_nil find_module("DoesntExist::Nadda::Nope::NotHere") end