Sha256: 253521ba439ec2399550e8510ebd4b258a6d444b6a6d36e9137bbfcc30bd0499

Contents?: true

Size: 375 Bytes

Versions: 7

Compression:

Stored size: 375 Bytes

Contents

module Helpers
  module JsonHelper

    # Return a JSON fixture as an indifferent hash.
    def json_fixture(path, dir: 'json', parse: true)
      filename = Rails.root.join('spec', 'fixtures', 'files', dir, "#{path}.json")
      return File.read(filename) unless parse

      HashWithIndifferentAccess.new(ActiveSupport::JSON.decode(File.read(filename)))
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
disco_app-0.17.0 lib/generators/disco_app/install/templates/spec/support/helpers/json_helper.rb
disco_app-0.18.0 lib/generators/disco_app/install/templates/spec/support/helpers/json_helper.rb
disco_app-0.18.2 lib/generators/disco_app/install/templates/spec/support/helpers/json_helper.rb
disco_app-0.18.3 lib/generators/disco_app/install/templates/spec/support/helpers/json_helper.rb
disco_app-0.18.6 lib/generators/disco_app/install/templates/spec/support/helpers/json_helper.rb
disco_app-0.18.4 lib/generators/disco_app/install/templates/spec/support/helpers/json_helper.rb
disco_app-0.18.1 lib/generators/disco_app/install/templates/spec/support/helpers/json_helper.rb