Sha256: 556f37770f28e03d21a300ca75e5bc646a044850aa719e701199a19837df94cc

Contents?: true

Size: 1.01 KB

Versions: 48

Compression:

Stored size: 1.01 KB

Contents

module DiscoApp::Test
  module FileFixtures

    # Return an XML fixture as an XML string.
    def xml_fixture(path)
      filename = File.join(File.dirname(File.dirname(__FILE__)), 'fixtures', 'xml', "#{path}.xml")
      File.read(filename)
    end

    # Return a JSON fixture as an indifferent hash.
    def json_fixture(path)
      filename = File.join(File.dirname(File.dirname(__FILE__)), 'fixtures', 'json', "#{path}.json")
      HashWithIndifferentAccess.new(ActiveSupport::JSON.decode(File.read(filename)))
    end

    # API fixtures are special-case JSON fixtures.
    def api_fixture(path)
      filename = File.join(File.dirname(File.dirname(__FILE__)), 'fixtures', 'api', "#{path}.json")
      HashWithIndifferentAccess.new(ActiveSupport::JSON.decode(File.read(filename)))
    end

    # Webhook fixtures are special-case JSON fixtures.
    def webhook_fixture(path)
      filename = File.join(File.dirname(File.dirname(__FILE__)), 'fixtures', 'webhooks', "#{path}.json")
      File.read(filename)
    end

  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
disco_app-0.16.1.pre.sidekiq.pre.6.pre.release test/support/test_file_fixtures.rb
disco_app-0.8.8 test/support/test_file_fixtures.rb
disco_app-0.8.9 test/support/test_file_fixtures.rb
disco_app-0.9.0 test/support/test_file_fixtures.rb
disco_app-0.9.1 test/support/test_file_fixtures.rb
disco_app-0.9.2 test/support/test_file_fixtures.rb
disco_app-0.9.3 test/support/test_file_fixtures.rb
disco_app-0.9.4 test/support/test_file_fixtures.rb
disco_app-0.9.5 test/support/test_file_fixtures.rb
disco_app-0.9.6 test/support/test_file_fixtures.rb
disco_app-0.9.7 test/support/test_file_fixtures.rb
disco_app-0.9.8 test/support/test_file_fixtures.rb
disco_app-0.9.9 test/support/test_file_fixtures.rb
disco_app-0.9.10 test/support/test_file_fixtures.rb
disco_app-0.9.11 test/support/test_file_fixtures.rb
disco_app-0.10.0 test/support/test_file_fixtures.rb
disco_app-0.10.1 test/support/test_file_fixtures.rb
disco_app-0.10.2 test/support/test_file_fixtures.rb
disco_app-0.10.3 test/support/test_file_fixtures.rb
disco_app-0.10.4 test/support/test_file_fixtures.rb