recipes/tests4.rb in rails_apps_composer-2.5.0 vs recipes/tests4.rb in rails_apps_composer-2.5.1
- old
+ new
@@ -4,79 +4,13 @@
after_bundler do
say_wizard "recipe running after 'bundle install'"
### RSPEC ###
if prefer :tests, 'rspec'
say_wizard "recipe installing RSpec"
- run 'rm -rf test/' # Removing test folder (not needed for RSpec)
- generate 'rspec:install'
- inject_into_file '.rspec', "--format documentation\n", :after => "--color\n"
- gsub_file 'spec/spec_helper.rb', /ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)/, "ActiveRecord::Migration.maintain_test_schema!"
- inject_into_file 'config/application.rb', :after => "Rails::Application\n" do <<-RUBY
-
- config.generators do |g|
- g.test_framework :rspec,
- fixtures: true,
- view_specs: false,
- helper_specs: false,
- routing_specs: false,
- controller_specs: false,
- request_specs: false
- g.fixture_replacement :factory_girl, dir: "spec/factories"
- end
-
-RUBY
- end
- ### Configure Launchy to display CSS and JavaScript
- create_file 'spec/support/capybara.rb', "Capybara.asset_host = 'http://localhost:3000'\n"
- ### Configure Database Cleaner to test JavaScript
- gsub_file 'spec/spec_helper.rb', /config.use_transactional_fixtures = true/, "config.use_transactional_fixtures = false"
- create_file 'spec/support/database_cleaner.rb' do
- <<-RUBY
-RSpec.configure do |config|
- config.before(:suite) do
- DatabaseCleaner.clean_with(:truncation)
+ generate 'testing:configure rspec -f'
end
-
- config.before(:each) do
- DatabaseCleaner.strategy = :transaction
- end
-
- config.before(:each, :js => true) do
- DatabaseCleaner.strategy = :truncation
- end
-
- config.before(:each) do
- DatabaseCleaner.start
- end
-
- config.append_after(:each) do
- DatabaseCleaner.clean
- end
-end
-RUBY
- end
- ### Configure FactoryGirl for shortcuts
- create_file 'spec/support/factory_girl.rb' do
- <<-RUBY
-RSpec.configure do |config|
- config.include FactoryGirl::Syntax::Methods
-end
-RUBY
- end
- ## RSPEC AND DEVISE
- if prefer :authentication, 'devise'
- # add Devise test helpers
- create_file 'spec/support/devise.rb' do
- <<-RUBY
-RSpec.configure do |config|
- config.include Devise::TestHelpers, :type => :controller
-end
-RUBY
- end
- end
- end
- ### GUARD
+ ### GUARD ###
if prefer :continuous_testing, 'guard'
say_wizard "recipe initializing Guard"
run 'bundle exec guard init'
end
### GIT ###
@@ -84,10 +18,12 @@
git :commit => '-qm "rails_apps_composer: testing framework"' if prefer :git, true
end # after_bundler
after_everything do
say_wizard "recipe running after everything"
- # copy tests from repos here
+ if prefer :authentication, 'devise'
+ generate 'testing:configure devise -f'
+ end
end # after_everything
__END__
name: tests4