Sha256: 4acb3736e6b91fa5f10348937dd4a80d412aa5f1aeda4da68af9d95890f168f5

Contents?: true

Size: 703 Bytes

Versions: 3

Compression:

Stored size: 703 Bytes

Contents

module Bogus
  module RSpecExtensions
    def fake(name, opts = {}, &block)
      let(name) { fake(name, opts, &block) }
    end

    def fake_class(name, opts = {})
      before do
        fake_class(name, opts)
      end
    end

    def verify_contract(name)
      old_described_class = described_class

      before do
        new_class = Bogus.record_calls_for(name, described_class)
        example.metadata[:example_group][:described_class] = new_class
      end

      after do
        example.metadata[:example_group][:described_class] = old_described_class
      end

      RSpec.configure do |config|
        config.after(:suite) { Bogus.verify_contract!(name) }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bogus-0.1.3 lib/bogus/rspec_extensions.rb
bogus-0.1.2 lib/bogus/rspec_extensions.rb
bogus-0.1.1 lib/bogus/rspec_extensions.rb