From 2499efdc3963997dee38831c979e4d88ba755f25 Mon Sep 17 00:00:00 2001 From: Grayson Wright Date: Tue, 15 Dec 2015 01:03:34 -0600 Subject: [PATCH] Stub out sidebar generator in layout gen tests Problem: When the layout generator invokes the sidebar generator, the tests do not recognize the file created by the sidebar generator, and the file does not get cleaned up after the test. Solution: Stub out the invocation of the sidebar generator when we're testing the layout generator. --- spec/generators/views/layout_generator_spec.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/generators/views/layout_generator_spec.rb b/spec/generators/views/layout_generator_spec.rb index 2b395cdff3..885de12a49 100644 --- a/spec/generators/views/layout_generator_spec.rb +++ b/spec/generators/views/layout_generator_spec.rb @@ -5,6 +5,7 @@ describe Administrate::Generators::Views::LayoutGenerator, :generator do describe "administrate:views:layout" do it "copies the layout template into the `admin/application` namespace" do + allow(Rails::Generators).to receive(:invoke) expected_contents = File.read( "app/views/layouts/administrate/application.html.erb", ) @@ -16,6 +17,7 @@ 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") generated_file = file("app/views/admin/application/_flashes.html.erb") @@ -35,6 +37,7 @@ end it "copies the javascript partial into the `admin/application` namespace" do + allow(Rails::Generators).to receive(:invoke) expected_contents = contents_for_application_template("_javascript") generated_file = file("app/views/admin/application/_javascript.html.erb")