Last active
June 13, 2016 03:23
-
-
Save chadellison/b27901a7630ff0fe469bc45abf1714f9 to your computer and use it in GitHub Desktop.
Helpful gems for rails projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
#optional | |
# gem 'dropzonejs-rails' <-- for drag and drop photos | |
# Use SCSS for stylesheets | |
# gem 'faker' | |
# gem "chartkick" | |
# gem 'foundation-rails' <-- for foundation styling | |
# gem 'foundation-icons-sass-rails' | |
# gem 'stripe' | |
# gem 'paperclip' | |
# gem 'geocoder' | |
# gem 'bootstrap-generators', '~> 3.3.4' | |
# gem 'responders' | |
# gem 'active_model_serializers', github: 'rails-api/active_model_serializers' | |
# gem 'activerecord-postgresql-citext' <-- for case insensitive | |
ruby '2.3.0' | |
gem 'rails', '4.2.6' | |
gem 'pg' | |
gem 'sass-rails', '~> 5.0' | |
gem 'figaro' | |
gem 'uglifier', '>= 1.3.0' | |
gem 'coffee-rails', '~> 4.1.0' | |
gem 'jquery-rails' | |
gem 'jbuilder', '~> 2.0' | |
gem 'sdoc', '~> 0.4.0', group: :doc | |
gem 'unicorn' | |
gem 'bcrypt', '~> 3.1.7' | |
gem 'faraday' | |
gem 'aws-sdk-v1' | |
group :development, :test do | |
# Call 'byebug' anywhere in the code to stop execution and get a debugger console | |
# gem 'vcr' # for API | |
# gem 'webmock' # for API | |
# gem 'selenium-webdriver' < -- for ajax | |
# gem 'rspec' | |
gem 'byebug' | |
gem 'capybara' | |
gem 'launchy' | |
gem 'capybara-webkit' | |
gem 'pry-rails' | |
gem 'pry' | |
gem 'rspec-rails', '~> 3.0' | |
gem 'shoulda-matchers', github: 'thoughtbot/shoulda-matchers' | |
gem "factory_girl_rails" | |
gem "database_cleaner" | |
gem 'mocha' | |
gem 'simplecov', :require => false | |
end | |
group :development do | |
# Access an IRB console on exception pages or by using <%= console %> in views | |
gem 'web-console', '~> 2.0' | |
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring | |
gem 'spring' | |
end | |
group :production do | |
gem 'rails_12factor' | |
end | |
__________________________________________________________________________________________________________________ | |
FIGARO | |
$ bundle exec figaro install | |
#=> create config/application.yml | |
append .gitignore | |
(step) go to config/application.yml and place your keys | |
___________________________________________________________________________________________________________________ | |
RSpec | |
$ bundle exec rails g rspec:install | |
___________________________________________________________________________________________________________________ | |
See instructions for bootsrap | |
___________________________________________________________________________________________________________________ | |
Test helper setup | |
----------------------------- | |
test_helper.rb for MINITEST | |
--------------------------------- | |
ENV['RAILS_ENV'] ||= 'test' | |
require File.expand_path('../../config/environment', __FILE__) | |
require 'rails/test_help' | |
require 'minitest/pride' | |
require 'webmock' #fakes http request | |
require 'vcr' | |
Shoulda::Matchers.configure do |config| | |
config.integrate do |with| | |
with.test_framework :rspec | |
with.library :rails | |
end | |
end | |
class ActiveSupport::TestCase | |
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. | |
fixtures :all | |
# Add more helper methods to be used by all tests here... | |
VCR.configure do |config| | |
config.cassette_library_dir = 'test/cassettes' | |
config.hook_into :webmock | |
end | |
end | |
------------------------- | |
rails_helper setup for RSPEC | |
------------------------- | |
# This file is copied to spec/ when you run 'rails generate rspec:install' | |
ENV['RAILS_ENV'] ||= 'test' | |
require File.expand_path('../../config/environment', __FILE__) | |
# Prevent database truncation if the environment is production | |
abort("The Rails environment is running in production mode!") if Rails.env.production? | |
require 'spec_helper' | |
require 'rspec/rails' | |
require "capybara/rails" | |
require 'vcr' | |
require 'webmock' | |
#require 'support/factory_girl' | |
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } | |
ActiveRecord::Migration.maintain_test_schema! | |
RSpec.configure do |config| | |
config.fixture_path = "#{::Rails.root}/spec/fixtures" | |
config.use_transactional_fixtures = true # change to false if using selenium | |
config.infer_spec_type_from_file_location! | |
config.filter_rails_from_backtrace! | |
Shoulda::Matchers.configure do |config| | |
config.integrate do |with| | |
with.test_framework :rspec | |
with.library :rails | |
end | |
end | |
VCR.configure do |c| | |
VCR.configure do |c| | |
c.cassette_library_dir = 'spec/cassettes' | |
c.hook_into :webmock | |
c.configure_rspec_metadata! | |
c.allow_http_connections_when_no_cassette = true | |
end | |
end | |
config.before(:suite) do | |
DatabaseCleaner.strategy = :transaction # rollleaner.clean_with :truncation # clean DB of any leftover back transactions between each test | |
end | |
config.before(:each) do | |
DatabaseCleaner.start | |
end | |
config.after(:each) do | |
DatabaseCleaner.clean | |
end | |
end | |
------------------------ | |
spec_helper.rb | |
------------------------ | |
require 'simplecov' | |
SimpleCov.start 'rails' do | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment