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