Sha256: ed8cad83f2d425236a3ff0d4fd8c8a6cefa87831573586bafe2682600c453c10

Contents?: true

Size: 776 Bytes

Versions: 17

Compression:

Stored size: 776 Bytes

Contents

class Fixture

  TYPES = { :gzip => "gz", :response => "xml", :wsdl => "xml" }

  class << self

    def [](type, fixture)
      fixtures(type)[fixture] ||= read_file type, fixture
    end

    def response_hash(fixture)
      @response_hash ||= {}
      @response_hash[fixture] ||= Nori.parse(response(fixture))[:envelope][:body]
    end

    TYPES.each do |type, ext|
      define_method(type) { |fixture| self[type, fixture] }
    end

  private

    def fixtures(type)
      @fixtures ||= {}
      @fixtures[type] ||= {}
    end

    def read_file(type, fixture)
      path = File.expand_path "../../fixtures/#{type}/#{fixture}.#{TYPES[type]}", __FILE__
      raise ArgumentError, "Unable to load: #{path}" unless File.exist? path

      File.read path
    end

  end
end

Version data entries

17 entries across 17 versions & 4 rubygems

Version Path
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/savon-0.9.5/spec/support/fixture.rb
savon-1.2.0 spec/support/fixture.rb
savon-1.1.0 spec/support/fixture.rb
savon-1.0.0 spec/support/fixture.rb
savon-0.9.14 spec/support/fixture.rb
savon-0.9.11 spec/support/fixture.rb
savon-0.9.10 spec/support/fixture.rb
savon-0.9.9 spec/support/fixture.rb
savon-0.9.8 spec/support/fixture.rb
they-savon-0.9.7.1 spec/support/fixture.rb
regenersis-savon-1.0.0 spec/support/fixture.rb
they-savon-0.9.7 spec/support/fixture.rb
savon-0.9.7 spec/support/fixture.rb
savon-0.9.6 spec/support/fixture.rb
savon-0.9.5 spec/support/fixture.rb
savon-0.9.4 spec/support/fixture.rb
savon-0.9.3 spec/support/fixture.rb