Module: Hypercharge::Schema::Fixture
- Defined in:
- lib/ruby/hypercharge/schema/fixture.rb
Class Method Summary collapse
-
.json(file) ⇒ Object
Hash parsed json fixture in e.g.
-
.path(file) ⇒ Object
String absolute path e.g.
-
.xml(file) ⇒ Object
String contents (xml string) of fixture file e.g.
Class Method Details
.json(file) ⇒ Object
Returns Hash parsed json fixture in e.g. /foo/hypercharge-schema/test/fixtures/requests/sale.json or /foo/hypercharge-schema/test/fixtures/responses/WpfPayment_find.json.
18 19 20 |
# File 'lib/ruby/hypercharge/schema/fixture.rb', line 18 def self.json(file) JSON.parse(IO.read(path("#{file}.json"))) end |
.path(file) ⇒ Object
Returns String absolute path e.g. “/foo/hypercharge-schema/test/fixtures/requests/sale.xml” or “/foo/hypercharge-schema/test/fixtures/responses/WpfPayment_find.json”.
25 26 27 |
# File 'lib/ruby/hypercharge/schema/fixture.rb', line 25 def self.path(file) File.("../../../../../test/fixtures/#{file}", __FILE__) end |
.xml(file) ⇒ Object
Returns String contents (xml string) of fixture file e.g. /foo/hypercharge-schema/test/fixtures/requests/sale.xml or /foo/hypercharge-schema/test/fixtures/responses/WpfPayment_find.xml.
11 12 13 |
# File 'lib/ruby/hypercharge/schema/fixture.rb', line 11 def self.xml(file) IO.read(path("#{file}.xml")) end |