class RSpec::GoldenFiles::ErbFileReader
Public Class Methods
new(filename, template_vars)
click to toggle source
# File lib/rspec-golden-files.rb, line 37 def initialize(filename, template_vars) plain_file_contents = File.read(filename) template = ERB.new(plain_file_contents) template_struct = TemplateStruct.new(template_vars) @file_contents = template_struct.render(template) @tmpfile = Tempfile.new('expected') @tmpfile.write(@file_contents) @tmpfile.close(false) @filename = @tmpfile.path end
Public Instance Methods
close()
click to toggle source
# File lib/rspec-golden-files.rb, line 51 def close @tmpfile.delete end