Module: Test::Storyteller
- Defined in:
- lib/storyteller.rb
Overview
Including Storyteller in your TestCase allows you to declare a user story (global to the entire test case) and then run ‘scenarios’ (tests) regarding that user story
For example:
class MyTestCase < Test::Unit::TestCase
include Test::Storyteller
story <<-EOS
As a <role>
I want to <feature>
So that <profit>
EOS
scenario "some scenario description" do
...
end
end
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Class Method Details
.color ⇒ Object
60 61 62 |
# File 'lib/storyteller.rb', line 60 def self.color [@start_color, @end_color] end |
.color=(color) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/storyteller.rb', line 51 def self.color=(color) if color @start_color = "\e[#{color}m" @end_color = "\e[0m" else @start_color = @end_color = nil end end |
.included(base) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/storyteller.rb', line 25 def self.included(base) base.before(:all) do puts print Storyteller.color.first print self.class.story.to_s.gsub(/^\s+/, '') print Storyteller.color.last end base.after(:all) do puts end class << base alias :scenario :test end base.extend ClassMethods end |