Module: Bogus::PublicMethods

Included in:
Bogus
Defined in:
lib/bogus/public_methods.rb

Instance Method Summary collapse

Instance Method Details

#add_contract_verification(syntax, name, &block) ⇒ Object



7
8
9
# File 'lib/bogus/public_methods.rb', line 7

def add_contract_verification(syntax, name, &block)
  inject.adds_contract_verification(syntax).add(name, &block)
end

#after_each_testObject



52
53
54
55
56
# File 'lib/bogus/public_methods.rb', line 52

def after_each_test
  ensure_all_expectations_satisfied!
ensure
  clear
end

#clearObject



58
59
60
61
62
# File 'lib/bogus/public_methods.rb', line 58

def clear
  reset_stubbed_methods
  clear_expectations
  reset_overwritten_classes
end

#clear_expectationsObject



69
70
71
# File 'lib/bogus/public_methods.rb', line 69

def clear_expectations
  inject.clear_tracked_doubles
end

#configObject



19
20
21
# File 'lib/bogus/public_methods.rb', line 19

def config
  inject.configuration
end

#configure(&block) ⇒ Object



15
16
17
# File 'lib/bogus/public_methods.rb', line 15

def configure(&block)
  config.tap(&block)
end

#create_mock(*args) ⇒ Object



32
33
34
# File 'lib/bogus/public_methods.rb', line 32

def create_mock(*args)
  inject.create_mock(*args)
end

#create_stub(*args) ⇒ Object



28
29
30
# File 'lib/bogus/public_methods.rb', line 28

def create_stub(*args)
  inject.create_stub(*args)
end

#ensure_all_expectations_satisfied!Object



64
65
66
67
# File 'lib/bogus/public_methods.rb', line 64

def ensure_all_expectations_satisfied!
  doubles = inject.double_tracker.doubles
  inject.ensures_all_interactions_satisfied.ensure_satisfied!(doubles)
end

#fake_class(*args) ⇒ Object



48
49
50
# File 'lib/bogus/public_methods.rb', line 48

def fake_class(*args)
  inject.fakes_classes.fake(*args)
end

#fake_for(*args, &block) ⇒ Object



44
45
46
# File 'lib/bogus/public_methods.rb', line 44

def fake_for(*args, &block)
  inject.creates_fakes_with_stubbed_methods.create(*args, &block)
end

#fakes(&block) ⇒ Object



81
82
83
# File 'lib/bogus/public_methods.rb', line 81

def fakes(&block)
  inject.fake_configuration.evaluate(&block)
end

#have_received(*args) ⇒ Object



40
41
42
# File 'lib/bogus/public_methods.rb', line 40

def have_received(*args)
  inject.have_received_matcher.build(*args)
end

#injectObject



85
86
87
# File 'lib/bogus/public_methods.rb', line 85

def inject
  @injector ||= Bogus::Injector.new
end

#make_duck(*args) ⇒ Object



36
37
38
# File 'lib/bogus/public_methods.rb', line 36

def make_duck(*args)
  inject.makes_ducks.make(*args)
end

#record_calls_for(name, klass = nil) ⇒ Object



3
4
5
# File 'lib/bogus/public_methods.rb', line 3

def record_calls_for(name, klass = nil)
  inject.adds_recording.add(name, klass)
end

#reset!Object



23
24
25
26
# File 'lib/bogus/public_methods.rb', line 23

def reset!
  clear
  @injector = Bogus::Injector.new
end

#reset_overwritten_classesObject



77
78
79
# File 'lib/bogus/public_methods.rb', line 77

def reset_overwritten_classes
  inject.resets_overwritten_classes.reset
end

#reset_stubbed_methodsObject



73
74
75
# File 'lib/bogus/public_methods.rb', line 73

def reset_stubbed_methods
  inject.resets_stubbed_methods.reset_all_doubles
end

#verify_contract!(fake_name) ⇒ Object



11
12
13
# File 'lib/bogus/public_methods.rb', line 11

def verify_contract!(fake_name)
  inject.verifies_contracts.verify(fake_name)
end