diff --git a/lib/generators/administrate/views/layout_generator.rb b/lib/generators/administrate/views/layout_generator.rb index 6f683ac728..ac2af783e4 100644 --- a/lib/generators/administrate/views/layout_generator.rb +++ b/lib/generators/administrate/views/layout_generator.rb @@ -9,7 +9,7 @@ class LayoutGenerator < Administrate::ViewGenerator def copy_template copy_file( "../../layouts/administrate/application.html.erb", - "app/views/layouts/admin/application.html.erb" + "app/views/layouts/#{namespace}/application.html.erb" ) call_generator("administrate:views:navigation") diff --git a/spec/generators/views/layout_generator_spec.rb b/spec/generators/views/layout_generator_spec.rb index c9fff9ca42..ef6a767745 100644 --- a/spec/generators/views/layout_generator_spec.rb +++ b/spec/generators/views/layout_generator_spec.rb @@ -16,6 +16,19 @@ expect(contents).to eq(expected_contents) end + it "copies the layout template into the `namespace=` dir" do + allow(Rails::Generators).to receive(:invoke) + expected_contents = File.read( + "app/views/layouts/administrate/application.html.erb" + ) + generated_file = file("app/views/layouts/console/application.html.erb") + + run_generator ["--namespace", "console"] + contents = File.read(generated_file) + + expect(contents).to eq(expected_contents) + end + it "copies the flashes partial into the `admin/application` namespace" do allow(Rails::Generators).to receive(:invoke) expected_contents = contents_for_application_template("_flashes")