recipes/testing.rb in rails_apps_composer-2.2.11 vs recipes/testing.rb in rails_apps_composer-2.2.12

- old
+ new

@@ -1,10 +1,22 @@ # Application template recipe for the rails_apps_composer. Change the recipe here: # https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/testing.rb after_bundler do say_wizard "recipe running after 'bundle install'" + ### TEST/UNIT ### + if prefer :unit_test, 'test_unit' + inject_into_file 'config/application.rb', :after => "Rails::Application\n" do <<-RUBY + + config.generators do |g| + #{"g.test_framework :test_unit, fixture_replacement: :fabrication" if prefer :fixtures, 'fabrication'} + #{"g.fixture_replacement :fabrication, dir: 'test/fabricators'" if prefer :fixtures, 'fabrication'} + end + +RUBY + end + end ### RSPEC ### if prefer :unit_test, 'rspec' say_wizard "recipe installing RSpec" generate 'rspec:install' copy_from_repo 'spec/spec_helper.rb', :repo => 'https://raw.github.com/RailsApps/rails3-devise-rspec-cucumber/master/' @@ -18,13 +30,17 @@ run 'rm -rf test/' # Removing test folder (not needed for RSpec) inject_into_file 'config/application.rb', :after => "Rails::Application\n" do <<-RUBY # don't generate RSpec tests for views and helpers config.generators do |g| + #{"g.test_framework :rspec" if prefer :fixtures, 'none'} + #{"g.test_framework :rspec, fixture: true" unless prefer :fixtures, 'none'} + #{"g.fixture_replacement :factory_girl" if prefer :fixtures, 'factory_girl'} + #{"g.fixture_replacement :machinist" if prefer :fixtures, 'machinist'} + #{"g.fixture_replacement :fabrication" if prefer :fixtures, 'fabrication'} g.view_specs false g.helper_specs false - #{"g.fixture_replacement :machinist" if prefer :fixtures, 'machinist'} end RUBY end ## RSPEC AND MONGOID @@ -71,9 +87,10 @@ gsub_file 'features/support/env.rb', /transaction/, "truncation" inject_into_file 'features/support/env.rb', :after => 'begin' do "\n DatabaseCleaner.orm = 'mongoid'" end end + generate 'fabrication:cucumber_steps' if prefer :fixtures, 'fabrication' end ## TURNIP if prefer :integration, 'turnip' append_file '.rspec', '-r turnip/rspec' inject_into_file 'spec/spec_helper.rb', "require 'turnip/capybara'\n", :after => "require 'rspec/rails'\n"