lib/stationed/generators/plugins/rspec.rb in stationed-0.0.1 vs lib/stationed/generators/plugins/rspec.rb in stationed-0.1.0
- old
+ new
@@ -1,17 +1,26 @@
module Stationed
module Generators
module Plugins
module Rspec
+ def self.prepended(base)
+ base.class_option :rspec,
+ type: :boolean,
+ default: true,
+ desc: 'Generate configuration for Rspec with Simplecov'
+ end
+
def finish_template
+ return super unless options[:rspec]
gem 'simplecov', group: :test
gem 'rspec-rails', group: [:development, :test]
copy_file 'simplecov', '.simplecov'
super
end
def run_bundle
super
+ return unless options[:rspec]
generate 'rspec:install'
remove_file 'spec/spec_helper.rb'
copy_file 'spec_helper.rb', 'spec/spec_helper.rb'
end
end