Class: Lookout::Recorder

Inherits:
Aphonic show all
Defined in:
lib/lookout/recorder.rb

Defined Under Namespace

Classes: Not, Tape

Constant Summary

Constants inherited from Aphonic

Aphonic::Methods

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Aphonic

silence

Constructor Details

#initialize(subject) ⇒ Recorder

Returns a new instance of Recorder.



7
8
9
# File 'lib/lookout/recorder.rb', line 7

def initialize(subject)
  @subject, @negated = subject, false
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



39
40
41
42
43
44
# File 'lib/lookout/recorder.rb', line 39

def method_missing(method, *args)
  return super unless method.to_s =~ /\?$/
  extend Lookout::Recorders::State
  @verb = nil
  method_missing method, *args
end

Instance Attribute Details

#subjectObject (readonly)

Returns the value of attribute subject.



37
38
39
# File 'lib/lookout/recorder.rb', line 37

def subject
  @subject
end

Instance Method Details

#beObject



21
22
23
24
25
# File 'lib/lookout/recorder.rb', line 21

def be
  extend Lookout::Recorders::State
  @verb = :be
  self
end

#haveObject



27
28
29
30
31
# File 'lib/lookout/recorder.rb', line 27

def have
  extend Lookout::Recorders::State
  @verb = :have
  self
end

#notObject



11
12
13
14
# File 'lib/lookout/recorder.rb', line 11

def not
  @negated = true
  self
end

#receiveObject



16
17
18
19
# File 'lib/lookout/recorder.rb', line 16

def receive
  extend Lookout::Recorders::Reception
  receive!
end

#subject!(mocks, stubs) ⇒ Object



33
34
35
# File 'lib/lookout/recorder.rb', line 33

def subject!(mocks, stubs)
  subject
end