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 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
- $ testrb my_test.rb -n test_yet_more_tests
53
+ $ ruby my_test.rb -n test_yet_more_tests
54
54
 
55
55
  Or with a regular expression:
56
56
 
57
- $ testrb my_test.rb -n /yet_more_tests/
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
  ------------
@@ -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 report(action, &block)
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 :report
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
- report :click_link do |name|
120
- "Click #{name.inspect}"
121
+ report_for :click_link do |name|
122
+ "Click #{quote(name)}"
121
123
  end
122
124
 
123
- report :click_button do |name|
124
- "Click #{name.inspect}"
125
+ report_for :click_button do |name|
126
+ "Click #{quote(name)}"
125
127
  end
126
128
 
127
- report :fill_in do |name, opts|
128
- "Fill in #{name.inspect} with #{opts[:with].inspect}"
129
+ report_for :fill_in do |name, opts|
130
+ "Fill in #{quote(name)} with #{quote(opts[:with])}"
129
131
  end
130
132
 
131
- report :visit do |page|
132
- "Go to #{page.inspect}"
133
+ report_for :visit do |page|
134
+ "Go to #{quote(page)}"
133
135
  end
134
136
 
135
- report :check do |name|
136
- "Check #{name.inspect}"
137
+ report_for :check do |name|
138
+ "Check #{quote(name)}"
137
139
  end
138
140
 
139
- report :assert_contain do |text|
140
- "I should see #{text.inspect}"
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
@@ -49,9 +49,7 @@ module Stories
49
49
 
50
50
  def render_many(pdf, elements)
51
51
  elements.each do |el|
52
- pdf.text el.to_s.gsub(/"([^"]+)"/) {
53
- "“#{$1}”"
54
- }
52
+ pdf.text el.to_s
55
53
  end
56
54
  end
57
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: citrusbyte-stories
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damian Janowski