10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/cockroach/fixtures/factory_girl/loader.rb', line 10
def load
if factory_items.blank?
old_paths = ::FactoryGirl.definition_file_paths
if Cockroach.config.fixtures_path
::FactoryGirl.definition_file_paths = [Cockroach.config.fixtures_path]
else
::FactoryGirl.definition_file_paths = old_paths.collect { |path| File.join(Cockroach::Config.root, path) }
end
unless ::FactoryGirl.definition_file_paths.inject(false) { |valid, path| valid || File.exists?("#{path}.rb") || File.directory?(path) }
raise NoExistingPathError.new("Neither of the paths are valid: #{::FactoryGirl.definition_file_paths.inspect}")
end
::FactoryGirl.find_definitions
::FactoryGirl.definition_file_paths = old_paths
end
end
|