Module: JasmineRails::SaveFixture
- Defined in:
- lib/jasmine_rails/save_fixture.rb
Constant Summary collapse
- FIXTURE_DIRECTORY =
'spec/javascripts/fixtures/generated'
Instance Method Summary collapse
-
#save_fixture(file_name, content = rendered) ⇒ Object
Saves the rendered as a fixture file.
Instance Method Details
#save_fixture(file_name, content = rendered) ⇒ Object
Saves the rendered as a fixture file.
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/jasmine_rails/save_fixture.rb', line 22 def save_fixture(file_name, content = rendered) fixture_path = File.join(Rails.root, FIXTURE_DIRECTORY, file_name) fixture_directory = File.dirname(fixture_path) FileUtils.mkdir_p fixture_directory unless File.exists?(fixture_directory) File.open(fixture_path, 'w') do |file| file.puts(content) end ignore_generated_fixtures end |