From c0fb9496011bb5dbc43075aa818e005bea6acaab Mon Sep 17 00:00:00 2001 From: "Andrew W. Lee" Date: Tue, 24 Mar 2020 09:24:17 -0700 Subject: [PATCH 1/2] Add test for `rails g annotate:install` --- spec/integration/rails_5.2.4.1_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/integration/rails_5.2.4.1_spec.rb b/spec/integration/rails_5.2.4.1_spec.rb index f2957d6dd..06a62cea7 100644 --- a/spec/integration/rails_5.2.4.1_spec.rb +++ b/spec/integration/rails_5.2.4.1_spec.rb @@ -152,4 +152,20 @@ end end end + + describe 'rails g annotate:install' do + let(:command) { 'bin/rails g annotate:install' } + let(:rake_file_path) { 'lib/tasks/auto_annotate_models.rake' } + + it 'generates the rake file' do + Bundler.with_clean_env do + Dir.chdir RAILS_5_2_APP_PATH do + full_path = File.expand_path(rake_file_path) + expect { `#{command}` }.to change { File.exist?(rake_file_path) }.from(false).to(true) + + File.delete(full_path) + end + end + end + end end From ad0aa898eb37e7eb5d5ea3e6c23c31a4cf0fa41d Mon Sep 17 00:00:00 2001 From: "Andrew W. Lee" Date: Wed, 25 Mar 2020 09:31:26 -0700 Subject: [PATCH 2/2] Add test for `rails g annotate:install` --- spec/integration/rails_6.0.2.1_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/spec/integration/rails_6.0.2.1_spec.rb b/spec/integration/rails_6.0.2.1_spec.rb index 4622bfe41..d5161693f 100644 --- a/spec/integration/rails_6.0.2.1_spec.rb +++ b/spec/integration/rails_6.0.2.1_spec.rb @@ -167,4 +167,20 @@ end end end + + describe 'rails g annotate:install' do + let(:command) { 'bin/rails g annotate:install' } + let(:rake_file_path) { 'lib/tasks/auto_annotate_models.rake' } + + it 'generates the rake file' do + Bundler.with_clean_env do + Dir.chdir RAILS_6_0_APP_PATH do + full_path = File.expand_path(rake_file_path) + expect { `#{command}` }.to change { File.exist?(rake_file_path) }.from(false).to(true) + + File.delete(full_path) + end + end + end + end end