Class: Bogus::AddsContractVerification

Inherits:
Object
  • Object
show all
Extended by:
Takes
Defined in:
lib/bogus/contracts/adds_contract_verification.rb

Instance Method Summary collapse

Methods included from Takes

takes

Instance Method Details

#add(fake_name, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bogus/contracts/adds_contract_verification.rb', line 6

def add(fake_name, &block)
  old_described_class = syntax.described_class

  before do
    new_class = adds_recording.add(fake_name, class_to_overwrite(fake_name, block))
    syntax.described_class = new_class if overwritten_described_class?(block)
  end

  after do
    syntax.described_class = old_described_class if overwritten_described_class?(block)
  end

  after_suite { verifies_contracts.verify(fake_name) }
end