Sha256: d2b0534de12d2f9532e1dac98f0baa1b155571d0558becdb431e9bfa502a7d38
Contents?: true
Size: 972 Bytes
Versions: 21
Compression:
Stored size: 972 Bytes
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") 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
21 entries across 21 versions & 1 rubygems