-
-
Save rinaldifonseca/4475107 to your computer and use it in GitHub Desktop.
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
ENV["RAILS_ENV"] ||= 'test' | |
require File.expand_path("../../config/environment", __FILE__) | |
require 'rspec/rails' | |
require 'rspec/autorun' | |
require 'machinist/active_record' | |
require 'machinist/caching/active_record' | |
# Requires supporting ruby files with custom matchers and macros, etc, | |
# in spec/support/ and its subdirectories. | |
spec_support = Rails.root.join("spec/support/**/*.rb") | |
blueprints = Rails.root.join('spec/blueprints/**/*.rb') | |
Dir[spec_support, blueprints].each { |f| require(f) } | |
HTTPI.log = false | |
Savon.log = false | |
RSpec.configure do |config| | |
config.include Rack::Test::Methods | |
config.include Helpers | |
config.include GatewayMatchers | |
config.before(:suite) do | |
DatabaseCleaner.strategy = :truncation | |
end | |
config.before do | |
DatabaseCleaner.start | |
Machinist::Caching::Shop.instance.reset! | |
end | |
config.after do | |
DatabaseCleaner.clean | |
end | |
end |
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 'unit_test' | |
require "bundler/setup" | |
require 'active_support/i18n' | |
Bundler.require :models # Create a group in the Gemfile with :models in a group | |
I18n.load_path << Dir['config/locales/*.yml'] | |
I18n.locale = 'pt-BR' | |
I18n.load_path.flatten! | |
database_yml = YAML.load_file(File.expand_path('config/database.yml')) | |
ActiveRecord::Base.establish_connection(database_yml['test']) | |
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 'active_support/dependencies' | |
%w(app/business app/enumerations app/models app/validators).each do |path| | |
ActiveSupport::Dependencies.autoload_paths.push(path) unless ActiveSupport::Dependencies.autoload_paths.include?(path) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment