mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 13:05:17 +08:00
Allow other directories to be specified when accessing fixtures.
This commit is contained in:
parent
3ea68f8f6c
commit
9a6f54de6c
|
@ -140,9 +140,9 @@ Spork.prefork do
|
||||||
Time.stubs(:now).returns(time)
|
Time.stubs(:now).returns(time)
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_from_fixtures(filename)
|
def file_from_fixtures(filename, directory="images")
|
||||||
FileUtils.mkdir_p("#{Rails.root}/tmp/spec") unless Dir.exists?("#{Rails.root}/tmp/spec")
|
FileUtils.mkdir_p("#{Rails.root}/tmp/spec") unless Dir.exists?("#{Rails.root}/tmp/spec")
|
||||||
FileUtils.cp("#{Rails.root}/spec/fixtures/images/#{filename}", "#{Rails.root}/tmp/spec/#{filename}")
|
FileUtils.cp("#{Rails.root}/spec/fixtures/#{directory}/#{filename}", "#{Rails.root}/tmp/spec/#{filename}")
|
||||||
File.new("#{Rails.root}/tmp/spec/#{filename}")
|
File.new("#{Rails.root}/tmp/spec/#{filename}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user