Module: NanDoc::SpecDoc::AgentInstanceMethods

Included in:
MockPrompt, TestCaseAgent
Defined in:
lib/nandoc/spec-doc/agent-instance-methods.rb

Instance Method Summary collapse

Instance Method Details

#method_name_to_record(caller) ⇒ Object

we used to use first method, now we use first test_ method



6
7
8
9
10
# File 'lib/nandoc/spec-doc/agent-instance-methods.rb', line 6

def method_name_to_record caller
  line = caller.detect{ |x| x =~ /in `test_/ } or fail('hack fail')
  method = line =~ /in `(.+)'\Z/ && $1 or fail("hack fail")
  method
end

#recordingsObject



12
13
14
# File 'lib/nandoc/spec-doc/agent-instance-methods.rb', line 12

def recordings
  @recordings ||=  NanDoc::SpecDoc::Recordings.get(test_case)
end

#story(story_name) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/nandoc/spec-doc/agent-instance-methods.rb', line 16

def story story_name
  method = method_name_to_record(caller)
  rec = recordings
  rec.add(:method, method)
  rec.add(:story, story_name)
  nil
end