From e9c8d4c6940cd687dba7eccbba11309420592a37 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Tue, 9 Mar 2021 08:03:18 +0000 Subject: [PATCH] Merge pull request #2475 from Naokimi/main remove all spec views on destroy controller --- lib/generators/rspec/controller/controller_generator.rb | 2 +- .../generators/rspec/controller/controller_generator_spec.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/generators/rspec/controller/controller_generator.rb b/lib/generators/rspec/controller/controller_generator.rb index c03ae83184..4111a9aabb 100644 --- a/lib/generators/rspec/controller/controller_generator.rb +++ b/lib/generators/rspec/controller/controller_generator.rb @@ -27,7 +27,7 @@ def generate_controller_spec end def generate_view_specs - return if actions.empty? + return if actions.empty? && behavior == :invoke return unless options[:view_specs] && options[:template_engine] empty_directory File.join("spec", "views", file_path) diff --git a/spec/generators/rspec/controller/controller_generator_spec.rb b/spec/generators/rspec/controller/controller_generator_spec.rb index 4143af50fe..3885194abf 100644 --- a/spec/generators/rspec/controller/controller_generator_spec.rb +++ b/spec/generators/rspec/controller/controller_generator_spec.rb @@ -115,6 +115,11 @@ end end end + + describe 'are removed' do + subject { run_generator %w[posts], behavior: :revoke } + it { is_expected.to match('remove spec/views/posts') } + end end describe 'routing spec' do