spec/spec_helper.rb in foreman-0.13.1 vs spec/spec_helper.rb in foreman-0.14.0

- old
+ new

@@ -27,9 +27,30 @@ def write_procfile(procfile="Procfile") File.open(procfile, "w") do |file| file.puts "alpha: ./alpha" file.puts "bravo: ./bravo" end + File.expand_path(procfile) +end + +def load_export_templates_into_fakefs(type) + FakeFS.deactivate! + files = Dir[File.expand_path("../../data/export/#{type}/**", __FILE__)].inject({}) do |hash, file| + hash.update(file => File.read(file)) + end + FakeFS.activate! + files.each do |filename, contents| + File.open(filename, "w") do |f| + f.puts contents + end + end +end + +def example_export_file(filename) + FakeFS.deactivate! + data = File.read(File.expand_path("../resources/export/#{filename}", __FILE__)) + FakeFS.activate! + data end Rspec.configure do |config| config.color_enabled = true config.include FakeFS::SpecHelpers