recipes/testing.rb in rails_apps_composer-2.2.6 vs recipes/testing.rb in rails_apps_composer-2.2.7
- old
+ new
@@ -5,10 +5,11 @@
say_wizard "recipe running after 'bundle install'"
### 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/'
unless prefer :email, 'none'
generate 'email_spec:steps'
inject_into_file 'spec/spec_helper.rb', "require 'email_spec'\n", :after => "require 'rspec/rails'\n"
inject_into_file 'spec/spec_helper.rb', :after => "RSpec.configure do |config|\n" do <<-RUBY
config.include(EmailSpec::Helpers)
@@ -31,25 +32,10 @@
## RSPEC AND MONGOID
if prefer :orm, 'mongoid'
# remove ActiveRecord artifacts
gsub_file 'spec/spec_helper.rb', /config.fixture_path/, '# config.fixture_path'
gsub_file 'spec/spec_helper.rb', /config.use_transactional_fixtures/, '# config.use_transactional_fixtures'
- # reset your application database to a pristine state during testing
- inject_into_file 'spec/spec_helper.rb', :before => "\nend" do
- <<-RUBY
- \n
- require 'database_cleaner'
- config.before(:suite) do
- DatabaseCleaner.strategy = :truncation
- DatabaseCleaner.orm = "mongoid"
- end
-
- config.before(:each) do
- DatabaseCleaner.clean
- end
-RUBY
- end
# remove either possible occurrence of "require rails/test_unit/railtie"
gsub_file 'config/application.rb', /require 'rails\/test_unit\/railtie'/, '# require "rails/test_unit/railtie"'
gsub_file 'config/application.rb', /require "rails\/test_unit\/railtie"/, '# require "rails/test_unit/railtie"'
# configure RSpec to use matchers from the mongoid-rspec gem
create_file 'spec/support/mongoid.rb' do
@@ -144,21 +130,19 @@
end
## RSPEC AND OMNIAUTH
if (prefer :authentication, 'omniauth') && (prefer :starter_app, 'users_app')
say_wizard "copying RSpec files from the rails3-mongoid-omniauth examples"
repo = 'https://raw.github.com/RailsApps/rails3-mongoid-omniauth/master/'
- copy_from_repo 'spec/spec_helper.rb', :repo => repo
copy_from_repo 'spec/factories/users.rb', :repo => repo
copy_from_repo 'spec/controllers/sessions_controller_spec.rb', :repo => repo
copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo
copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo
copy_from_repo 'spec/models/user_spec.rb', :repo => repo
end
## SUBDOMAINS
if (prefer :authentication, 'devise') && (prefer :starter_app, 'subdomains_app')
say_wizard "copying RSpec files from the rails3-subdomains examples"
repo = 'https://raw.github.com/RailsApps/rails3-subdomains/master/'
- copy_from_repo 'spec/spec_helper.rb', :repo => repo
copy_from_repo 'spec/factories/users.rb', :repo => repo
copy_from_repo 'spec/controllers/home_controller_spec.rb', :repo => repo
copy_from_repo 'spec/controllers/users_controller_spec.rb', :repo => repo
copy_from_repo 'spec/models/user_spec.rb', :repo => repo
end