Sha256: 3cc1a64d817178c51ba09c271c19632599211bd91ae9c5ec2088255a0439ea0e

Contents?: true

Size: 561 Bytes

Versions: 1

Compression:

Stored size: 561 Bytes

Contents

require 'fileutils'
require 'rails'

module JasmineFixtureBuilder
  class FixtureWriter

    def initialize(markup, fixture_name)
      @markup = markup
      @fixture_name = fixture_name
    end

    def write
      fixture_file = File.join(fixture_path, @fixture_name)
      FileUtils.mkdir_p(fixture_path) unless File.directory?(fixture_path)
      File.open(fixture_file, 'w') do |file|
        file.puts(@markup)
      end
    end

    private

    def fixture_path
      @fixture_path ||= Rails.root.join(JAZZ_FIX_PATHS[:fixture_path])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jasmine_fixture_builder-0.1.0 lib/jasmine_fixture_builder/fixture_writer.rb