Sha256: d0b5414226d8ce0568f41cb847e03dc0298cc311d9218e1dfe1cd19f1cd1fe2e
Contents?: true
Size: 862 Bytes
Versions: 85
Compression:
Stored size: 862 Bytes
Contents
module Pact module Fixture def self.fixtures @@fixtures ||= [] end def self.clear_fixtures @@fixtures = [] end def register_fixture name source = caller.first thing = yield Fixture.fixtures << OpenStruct.new(name: name, thing: thing, source: source) thing end def self.check_fixtures fixtures.group_by(&:name).each do | name, fixture_group | if fixture_group.size == 1 puts "WARN: Nothing to compare #{name} to." else if fixture_group.collect(&:thing).uniq.length != 1 desc = fixture_group.collect do | fixture | "#{fixture.thing} from #{fixture.source}\n" end.join("\n") raise "These fixtures don't match #{fixture_group.first.name}:\n #{desc}" end end end end end end
Version data entries
85 entries across 85 versions & 1 rubygems