do prepare_destination # initialize ../../tmp end describe 'generated files' do before do run_generator # run "rails g my_gem:install" end # write test cases here end after(:context) do FileUtils.rm_rf(destination_root) end end
describe 'generated files' do before do run_generator # run: rails g my_gem:install end describe 'config/initializers/my_gem.rb' do subject { file('config/initializers/my_gem.rb') } it { is_expected.to exist } it { is_expected.to have_correct_syntax } it { is_expected.to contain /\AMyGem\.configure do \|config\|/ } end end