citrusbyte-stories 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +15 -2
- data/lib/stories/runner.rb +21 -14
- data/lib/stories/runner/pdf.rb +1 -3
- metadata +1 -1
data/README.markdown
CHANGED
@@ -50,11 +50,24 @@ If you are using Rails, you can use stories for your integration tests with Webr
|
|
50
50
|
|
51
51
|
You can run it normally, it's Test::Unit after all. If you want to run a particular test, say "yet more tests", try this:
|
52
52
|
|
53
|
-
$
|
53
|
+
$ ruby my_test.rb -n test_yet_more_tests
|
54
54
|
|
55
55
|
Or with a regular expression:
|
56
56
|
|
57
|
-
$
|
57
|
+
$ ruby my_test.rb -n /yet_more_tests/
|
58
|
+
|
59
|
+
Awesome output
|
60
|
+
--------------
|
61
|
+
|
62
|
+
You can get a nice output with your user stories with the `stories` runner:
|
63
|
+
|
64
|
+
$ ruby my_test.rb --runner=stories
|
65
|
+
|
66
|
+
Now, if you want to impress everyone around you, try this:
|
67
|
+
|
68
|
+
$ ruby my_test.rb --runner=stories-pdf
|
69
|
+
|
70
|
+
You will get a nicely formatted PDF with your user stories. It uses [Prawn](http://prawn.majesticseacreature.com/), so you will need to install it first.
|
58
71
|
|
59
72
|
Installation
|
60
73
|
------------
|
data/lib/stories/runner.rb
CHANGED
@@ -53,9 +53,11 @@ module Stories
|
|
53
53
|
|
54
54
|
class Runner < Test::Unit::UI::Console::TestRunner
|
55
55
|
def test_finished(name)
|
56
|
+
print "."
|
56
57
|
end
|
57
58
|
|
58
59
|
def add_fault(fault)
|
60
|
+
print "F"
|
59
61
|
@faults << fault
|
60
62
|
end
|
61
63
|
|
@@ -90,14 +92,14 @@ module Stories
|
|
90
92
|
end
|
91
93
|
|
92
94
|
module Webrat
|
93
|
-
def
|
95
|
+
def report_for(action, &block)
|
94
96
|
define_method(action) do |*args|
|
95
97
|
@scenario.steps << block.call(*args)
|
96
98
|
super
|
97
99
|
end
|
98
100
|
end
|
99
101
|
|
100
|
-
module_function :
|
102
|
+
module_function :report_for
|
101
103
|
end
|
102
104
|
end
|
103
105
|
|
@@ -116,27 +118,32 @@ end
|
|
116
118
|
|
117
119
|
# Common Webrat steps.
|
118
120
|
module Stories::Webrat
|
119
|
-
|
120
|
-
"Click #{name
|
121
|
+
report_for :click_link do |name|
|
122
|
+
"Click #{quote(name)}"
|
121
123
|
end
|
122
124
|
|
123
|
-
|
124
|
-
"Click #{name
|
125
|
+
report_for :click_button do |name|
|
126
|
+
"Click #{quote(name)}"
|
125
127
|
end
|
126
128
|
|
127
|
-
|
128
|
-
"Fill in #{name
|
129
|
+
report_for :fill_in do |name, opts|
|
130
|
+
"Fill in #{quote(name)} with #{quote(opts[:with])}"
|
129
131
|
end
|
130
132
|
|
131
|
-
|
132
|
-
"Go to #{page
|
133
|
+
report_for :visit do |page|
|
134
|
+
"Go to #{quote(page)}"
|
133
135
|
end
|
134
136
|
|
135
|
-
|
136
|
-
"Check #{name
|
137
|
+
report_for :check do |name|
|
138
|
+
"Check #{quote(name)}"
|
137
139
|
end
|
138
140
|
|
139
|
-
|
140
|
-
"I should see #{text
|
141
|
+
report_for :assert_contain do |text|
|
142
|
+
"I should see #{quote(text)}"
|
141
143
|
end
|
144
|
+
|
145
|
+
def quote(text)
|
146
|
+
"“#{text}”"
|
147
|
+
end
|
148
|
+
module_function :quote
|
142
149
|
end
|
data/lib/stories/runner/pdf.rb
CHANGED