Sha256: ce3c777830b07a4ef9e549795e9242569040cf15725f4b62a40fa38e8337c4ce

Contents?: true

Size: 372 Bytes

Versions: 1

Compression:

Stored size: 372 Bytes

Contents

module MockHelpers
	def mock(url:, fixture:)
    allow_any_instance_of(MusicBrainz::Client).to receive(:get_contents)
      .with(url)
      .and_return({ status: 200, body: read_fixture(fixture)})
	end

	def read_fixture(name)
		spec_path = File.join(File.dirname(__FILE__), "..")
		file_path = File.join(spec_path, "fixtures", name)
		File.open(file_path).read
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
musicbrainz-0.8.0 spec/support/mock_helpers.rb