Skip to content

Instantly share code, notes, and snippets.

@thej
Created November 11, 2015 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thej/4f9ce01fc361d00a1812 to your computer and use it in GitHub Desktop.
Save thej/4f9ce01fc361d00a1812 to your computer and use it in GitHub Desktop.
# GEMS
gem 'email_validator'
gem_group :development do
gem 'capistrano-rails'
gem 'capistrano-rvm'
end
gem_group :development, :test do
gem 'rspec-rails'
gem 'factory_girl_rails', require: false
end
gem_group :test do
gem 'faker'
gem 'capybara'
gem 'guard-rspec'
gem 'rb-inotify', '~> 0.9'
gem 'launchy'
gem 'database_cleaner'
gem 'shoulda-matchers', require: false
end
# ENVIRONMENTS
environment "config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }", env: 'development'
# RSPEC
after_bundle do
generate 'rspec:install'
#CAPYBARA
create_file "spec/support/capybara.rb", <<-RUBY
require 'capybara/rails'
require 'capybara/rspec'
RUBY
# SHOULDA
create_file "spec/support/shoulda_matchers.rb", <<-RUBY
require 'shoulda/matchers'
RUBY
inject_into_file "spec/rails_helper.rb", :after => "RSpec.configure do |config|\n" do
<<-RUBY
Shoulda::Matchers.configure do |config|
config.integrate do |with|
with.test_framework :rspec
with.library :active_record
with.library :active_model
with.library :action_controller
end
end
RUBY
end
# DATABASE CLEANER
inject_into_file "spec/rails_helper.rb", :after => "RSpec.configure do |config|\n" do
<<-RUBY
config.use_transactional_fixtures = false
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
end
config.before(:each) do |example|
DatabaseCleaner.strategy = example.metadata[:js] ? :truncation : :transaction
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
RUBY
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment