Module: NanDoc::SpecDoc::AgentInstanceMethods

Included in:
MockPrompt, TestCaseAgent
Defined in:
lib/nandoc/spec-doc/support-modules.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



7
8
9
10
11
# File 'lib/nandoc/spec-doc/support-modules.rb', line 7

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



13
14
15
# File 'lib/nandoc/spec-doc/support-modules.rb', line 13

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

#story(story_name) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/nandoc/spec-doc/support-modules.rb', line 17

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