Sha256: 97aa83589805eb3624cd0d6c11e82e9c53d3c7691517d83ecc601c3e28868857

Contents?: true

Size: 613 Bytes

Versions: 2

Compression:

Stored size: 613 Bytes

Contents

# frozen_string_literal: true

module SpecSupport

  class Fixture
    def self.[](name)
      fixtures[name]
    end

    def self.[]=(name, value)
      fixtures[name] = value
    end

    def self.fixtures
      @fixtures ||= {}
    end

    def initialize(file, ext = :wsdl)
      self.file = file
      self.ext = ext
    end

    attr_accessor :file, :ext

    def filename
      "#{file}.#{ext}"
    end

    def path
      File.expand_path("spec/fixtures/#{filename}")
    end

    def read
      Fixture[filename] ||= File.read(path)
    end
  end

  def fixture(*args)
    Fixture.new(*args)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wasabi-3.6.1 spec/support/fixture.rb
wasabi-3.6.0 spec/support/fixture.rb