diff --git a/padrino-core/test/fixtures/dependencies/gc/t.rb b/padrino-core/test/fixtures/dependencies/gc/t.rb new file mode 100644 index 000000000..59dca3de5 --- /dev/null +++ b/padrino-core/test/fixtures/dependencies/gc/t.rb @@ -0,0 +1,5 @@ +Padrino.require_dependencies( + Padrino.root("fixtures/dependencies/gc/v.rb"), + Padrino.root("fixtures/dependencies/gc/w.rb"), + Padrino.root("fixtures/dependencies/gc/x.rb") +) diff --git a/padrino-core/test/fixtures/dependencies/gc/u.rb b/padrino-core/test/fixtures/dependencies/gc/u.rb new file mode 100644 index 000000000..fe2de5dc4 --- /dev/null +++ b/padrino-core/test/fixtures/dependencies/gc/u.rb @@ -0,0 +1,3 @@ +Padrino.require_dependencies( + Padrino.root("fixtures/dependencies/gc/y.rb") +) diff --git a/padrino-core/test/fixtures/dependencies/gc/v.rb b/padrino-core/test/fixtures/dependencies/gc/v.rb new file mode 100644 index 000000000..1642773cb --- /dev/null +++ b/padrino-core/test/fixtures/dependencies/gc/v.rb @@ -0,0 +1,10 @@ +class V + $prevent_from_being_gced ||= [] + $prevent_from_being_gced.push(self) + + def self.hello + "hello" + end + + W +end diff --git a/padrino-core/test/fixtures/dependencies/gc/w.rb b/padrino-core/test/fixtures/dependencies/gc/w.rb new file mode 100644 index 000000000..60d58c7c3 --- /dev/null +++ b/padrino-core/test/fixtures/dependencies/gc/w.rb @@ -0,0 +1,2 @@ +class W +end diff --git a/padrino-core/test/fixtures/dependencies/gc/x.rb b/padrino-core/test/fixtures/dependencies/gc/x.rb new file mode 100644 index 000000000..d9d8a6699 --- /dev/null +++ b/padrino-core/test/fixtures/dependencies/gc/x.rb @@ -0,0 +1,2 @@ +class X < Y +end diff --git a/padrino-core/test/fixtures/dependencies/gc/y.rb b/padrino-core/test/fixtures/dependencies/gc/y.rb new file mode 100644 index 000000000..f0452c6f6 --- /dev/null +++ b/padrino-core/test/fixtures/dependencies/gc/y.rb @@ -0,0 +1,2 @@ +class Y +end diff --git a/padrino-core/test/test_dependencies.rb b/padrino-core/test/test_dependencies.rb index c5a3c06fb..a2f69a09a 100644 --- a/padrino-core/test/test_dependencies.rb +++ b/padrino-core/test/test_dependencies.rb @@ -77,6 +77,16 @@ assert_equal "hello", M.hello end + it 'should not remove constants that are already `remove_const`ed' do + capture_io do + Padrino.require_dependencies( + Padrino.root("fixtures/dependencies/gc/t.rb"), + Padrino.root("fixtures/dependencies/gc/u.rb") + ) + end + assert_equal "hello", V.hello + end + describe "change log level for :devel" do before do