Created
August 5, 2013 09:12
-
-
Save deivid-rodriguez/6154519 to your computer and use it in GitHub Desktop.
Information for issue https://github.com/laserlemon/figaro/issues/57
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
production: | |
DB_NAME: '' | |
DB_USER: '' | |
DB_PASS: '' | |
test: | |
DB_NAME: '' | |
DB_USER: '' | |
DB_PASS: '' | |
development: | |
DB_NAME: '' | |
DB_USER: '' | |
DB_PASS: '' |
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
connection: &connection | |
adapter: postgresql | |
encoding: unicode | |
host: localhost | |
database: <%= ENV['DB_NAME'] %> | |
username: <%= ENV['DB_USER'] %> | |
password: <%= ENV['DB_PASS'] %> | |
pool: 5 | |
timeout: 5000 | |
development: | |
<<: *connection | |
# Warning: The database defined as "test" will be erased and | |
# re-generated from your development database when you run "rake". | |
# Do not set this db to the same as development or production. | |
test: | |
<<: *connection | |
production: | |
<<: *connection |
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
require 'spork' | |
def start_simple_cov | |
require 'simplecov' | |
SimpleCov.start 'rails' do | |
add_filter '/vendor/ruby/' | |
end | |
end | |
Spork.prefork do | |
# Loading more in this block will cause your tests to run faster. However, | |
# if you change any configuration or code from libraries loaded here, you'll | |
# need to restart spork for it take effect. | |
ENV["RAILS_ENV"] ||= 'test' | |
unless ENV['DRB'] | |
start_simple_cov | |
end | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'rspec/autorun' | |
require 'cancan/matchers' | |
# Requires supporting ruby files with custom matchers and macros, etc, | |
# in spec/support/ and its subdirectories. | |
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f} | |
require 'capybara/rails' | |
require 'capybara/rspec' | |
require 'capybara/poltergeist' | |
require 'capybara/mechanize' | |
Capybara.javascript_driver = :poltergeist | |
RSpec.configure do |config| | |
config.include Devise::TestHelpers, :type => :controller | |
config.treat_symbols_as_metadata_keys_with_true_values = true | |
# ## Mock Framework (uncomment the appropriate line) | |
# config.mock_with :mocha | |
# config.mock_with :flexmock | |
# config.mock_with :rr | |
config.mock_with :rspec | |
config.use_transactional_fixtures = true | |
# If true, the base class of anonymous controllers will be inferred | |
# automatically. This will be the default behavior in future versions of | |
# rspec-rails. | |
config.infer_base_class_for_anonymous_controllers = false | |
# Run specs in random order to surface order dependencies. If you find an | |
# order dependency and want to debug it, you can fix the order by providing | |
# the seed, which is printed after each run. | |
# --seed 1234 | |
config.order = "random" | |
# Use the core set of syntax methods (build, build_stubbed, create, | |
# attributes_for, and their *_list counterparts) without having to call them | |
# on FactoryGirl directly | |
require 'factory_girl' | |
config.include FactoryGirl::Syntax::Methods | |
# Stop on the first fail | |
config.fail_fast = true | |
end | |
end | |
Spork.each_run do | |
if ENV['DRB'] | |
start_simple_cov | |
end | |
FactoryGirl.reload | |
# Forces all threads to share the same connection. capybara drivers start the | |
# web server in another thread and transactions are not shared between threads | |
# by default. | |
ActiveRecord::ConnectionAdapters::ConnectionPool.class_eval do | |
def current_connection_id | |
Thread.main.object_id | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment