stories 0.1.1 → 0.1.2

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.
@@ -50,7 +50,7 @@ If you are using Rails, you can use stories for your integration tests with Webr
50
50
 
51
51
  This will produce the following output:
52
52
 
53
- - As a user I want to lo in so that I can access restricted features
53
+ - As a user I want to log in so that I can access restricted features
54
54
  Using good information
55
55
  Go to “/”
56
56
  Click “Log in”
@@ -2,7 +2,7 @@ require "rubygems"
2
2
  require "contest"
3
3
 
4
4
  unless defined?(Test::Unit::AutoRunner)
5
- gem "test-unit", ">= 1.2"
5
+ gem "test-unit", "1.2.3"
6
6
  end
7
7
 
8
8
  class Test::Unit::TestCase
@@ -2,40 +2,38 @@
2
2
 
3
3
  require 'test/unit/ui/console/testrunner'
4
4
 
5
- $stories = []
6
-
7
- class Test::Unit::TestCase
8
- class << self
9
- alias original_story story
10
- alias original_scenario scenario
11
-
12
- def story(name, &block)
13
- story = Stories::Story.new(name)
14
-
15
- original_story(name) do
16
- @@story = story
17
-
18
- def self.story; @@story; end
5
+ module Stories
6
+ def self.all
7
+ @all ||= {}
8
+ end
19
9
 
20
- class_eval(&block) if block_given?
21
- end
10
+ module TestCase
11
+ def self.included(base)
12
+ class << base
13
+ def story(name, *args, &block)
14
+ context(name, *args) do
15
+ Stories.all[self] = Stories::Story.new(name)
16
+ class_eval(&block) if block_given?
17
+ end
18
+ end
22
19
 
23
- $stories << story
24
- end
20
+ def scenario(name, *args, &block)
21
+ scenario = Stories::Scenario.new(name)
25
22
 
26
- def scenario(name, &block)
27
- scenario = Stories::Scenario.new(name)
23
+ Stories.all[self].scenarios << scenario
28
24
 
29
- original_scenario(name) do
30
- @scenario = scenario
31
- instance_eval(&block)
25
+ test(name) do
26
+ @scenario = scenario
27
+ instance_eval(&block)
28
+ end
29
+ end
32
30
  end
33
-
34
- self.story.scenarios << scenario
35
31
  end
36
32
  end
37
33
  end
38
34
 
35
+ Test::Unit::TestCase.send(:include, Stories::TestCase)
36
+
39
37
  module Test::Unit::Assertions
40
38
  def report(text, &block)
41
39
  @scenario.steps << text
@@ -86,7 +84,7 @@ module Stories
86
84
  def finished(elapsed_time)
87
85
  puts
88
86
 
89
- $stories.each_with_index do |story,i|
87
+ Stories.all.values.to_a.each_with_index do |story,i|
90
88
  puts "- #{story.name}"
91
89
 
92
90
  story.scenarios.each do |scenario|
@@ -105,11 +103,11 @@ module Stories
105
103
  end
106
104
  end
107
105
 
108
- puts unless i + 1 == $stories.size
106
+ puts unless i + 1 == Stories.all.values.size
109
107
  end
110
108
 
111
109
  super
112
- puts "%d stories, %d scenarios" % [$stories.size, $stories.inject(0) {|total,s| total + s.scenarios.size }]
110
+ puts "%d stories, %d scenarios" % [Stories.all.values.size, Stories.all.values.inject(0) {|total,s| total + s.scenarios.size }]
113
111
  end
114
112
  end
115
113
 
@@ -18,7 +18,7 @@ module Stories
18
18
 
19
19
  pdf.move_down(15)
20
20
 
21
- $stories.each do |story|
21
+ Stories.all.values.each do |story|
22
22
  pdf.text story.name, :style => :bold
23
23
 
24
24
  story.scenarios.each_with_index do |scenario,i|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stories
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Damian Janowski
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-07-11 00:00:00 -03:00
13
+ date: 2009-08-25 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  requirements: []
69
69
 
70
70
  rubyforge_project: stories
71
- rubygems_version: 1.3.4
71
+ rubygems_version: 1.3.5
72
72
  signing_key:
73
73
  specification_version: 3
74
74
  summary: Write Stories and User Acceptance Tests using the minimalist testing framework Contest.