Sha256: bdb47bf47db0496d636f480952c021dc65ba84137b9e923a5025709e674a5a84
Contents?: true
Size: 719 Bytes
Versions: 65
Compression:
Stored size: 719 Bytes
Contents
module DiscoApp::Test module FileFixtures # Return an XML fixture as an XML string. def xml_fixture(path) filename = Rails.root.join('test', 'fixtures', 'xml', "#{path}.xml") File.read(filename) end # Return a JSON fixture as an indifferent hash. def json_fixture(path, dir: 'json', parse: true) filename = Rails.root.join('test', 'fixtures', dir, "#{path}.json") return File.read(filename) unless parse HashWithIndifferentAccess.new(ActiveSupport::JSON.decode(File.read(filename))) end # Webhook fixtures are special-case JSON fixtures. def webhook_fixture(path, parse: true) json_fixture(path, dir: 'webhooks', parse: parse) end end end
Version data entries
65 entries across 65 versions & 1 rubygems