1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00

Broke configuration out into its own file

This commit is contained in:
Ryan McGeary 2008-08-31 22:26:17 -04:00
parent d741a991c8
commit dab4badd0b
2 changed files with 19 additions and 18 deletions

View file

@ -15,21 +15,4 @@ module Test # :nodoc: all
end
end
require 'yaml'
shoulda_options = {}
possible_config_paths = []
possible_config_paths << File.join(ENV["HOME"], ".shoulda.conf") if ENV["HOME"]
possible_config_paths << "shoulda.conf"
possible_config_paths << File.join("test", "shoulda.conf")
possible_config_paths << File.join(RAILS_ROOT, "test", "shoulda.conf") if defined?(RAILS_ROOT)
possible_config_paths.each do |config_file|
if File.exists? config_file
shoulda_options = YAML.load_file(config_file).symbolize_keys
break
end
end
require 'shoulda/color' if shoulda_options[:color]
require 'shoulda/config.rb'

18
lib/shoulda/config.rb Normal file
View file

@ -0,0 +1,18 @@
require 'yaml'
shoulda_options = {}
possible_config_paths = []
possible_config_paths << File.join(ENV["HOME"], ".shoulda.conf") if ENV["HOME"]
possible_config_paths << "shoulda.conf"
possible_config_paths << File.join("test", "shoulda.conf")
possible_config_paths << File.join(RAILS_ROOT, "test", "shoulda.conf") if defined?(RAILS_ROOT)
possible_config_paths.each do |config_file|
if File.exists? config_file
shoulda_options = YAML.load_file(config_file).symbolize_keys
break
end
end
require 'shoulda/color' if shoulda_options[:color]