parent
5147f8b2f2
commit
e552dc322e
|
@ -14,7 +14,7 @@ module FactoryGirl
|
|||
require("#{path}.rb") if File.exists?("#{path}.rb")
|
||||
|
||||
if File.directory? path
|
||||
Dir[File.join(path, '*.rb')].sort.each do |file|
|
||||
Dir[File.join(path, '**', '*.rb')].sort.each do |file|
|
||||
require file
|
||||
end
|
||||
end
|
||||
|
|
|
@ -96,5 +96,14 @@ describe "definition loading" do
|
|||
it { should require_definitions_from("#{dir}/factories/person_factory.rb") }
|
||||
end
|
||||
end
|
||||
|
||||
describe "with deeply nested factory files under #{dir}" do
|
||||
in_directory_with_files File.join(dir, 'factories', 'subdirectory', 'post_factory.rb'),
|
||||
File.join(dir, 'factories', 'subdirectory', 'person_factory.rb')
|
||||
it_should_behave_like "finds definitions" do
|
||||
it { should require_definitions_from("#{dir}/factories/subdirectory/post_factory.rb") }
|
||||
it { should require_definitions_from("#{dir}/factories/subdirectory/person_factory.rb") }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue