Skip to content

Instantly share code, notes, and snippets.

module JasmineFixtures
# Saves the markup to a fixture file using the given name
def save_fixture(markup, name)
fixture_path = File.join(Rails.root, '/tmp/js_dom_fixtures')
Dir.mkdir(fixture_path) unless File.exists?(fixture_path)
fixture_file = File.join(fixture_path, "#{name}.fixture.html.erb")
File.open(fixture_file, 'w') do |file|
file.puts(markup)
end