lime 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
File without changes
data/.ruby CHANGED
@@ -1,51 +1,48 @@
1
- ---
2
- authors:
1
+ ---
2
+ authors:
3
3
  - name: Thomas Sawyer
4
4
  email: transfire@gmail.com
5
- copyrights:
5
+ copyrights:
6
6
  - holder: Thomas Sawyer
7
- year: "2011"
7
+ year: '2011'
8
8
  license: BSD-2-Clause
9
9
  replacements: []
10
-
11
10
  conflicts: []
12
-
13
- requirements:
11
+ requirements:
14
12
  - name: test
15
13
  - name: ae
16
14
  - name: detroit
17
- groups:
15
+ groups:
18
16
  - build
19
17
  development: true
20
18
  - name: reap
21
- groups:
19
+ groups:
22
20
  - build
23
21
  development: true
24
22
  - name: qed
25
- groups:
23
+ groups:
26
24
  - test
27
25
  development: true
28
26
  dependencies: []
29
-
30
- repositories:
27
+ repositories:
31
28
  - uri: git://github.com/proutils/lime.git
32
29
  scm: git
33
30
  name: upstream
34
- resources:
31
+ resources:
35
32
  home: http://rubyworks.github.com/lime
36
33
  code: http://github.com/rubyworks/lime
37
34
  mail: http://groups.google.com/group/rubyworks-mailinglist
38
- load_path:
35
+ load_path:
39
36
  - lib
40
- extra:
37
+ extra:
41
38
  manifest: MANIFEST
42
39
  alternatives: []
43
-
44
40
  revision: 0
45
41
  title: Lime
46
42
  suite: RubyWorks
47
43
  summary: Gherkin-style Test Framework
48
- description: Lime is a "Ruby DSL" knock-off of Cucumber's Gherkin BDD nomenclature that runs on top of ruby-test.
49
- version: 0.1.0
44
+ description: Lime is a pure Ruby variation of Cucumber's Gherkin BDD test system that
45
+ runs on top of the Ruby Universal Test Harness.
46
+ version: 0.2.0
50
47
  name: lime
51
- date: "2011-07-29"
48
+ date: '2011-08-11'
data/.yardopts CHANGED
@@ -1,4 +1,4 @@
1
- --output-dir site
1
+ --output-dir doc
2
2
  --protected
3
3
  --readme README.md
4
4
  lib
@@ -0,0 +1,20 @@
1
+ # Release History
2
+
3
+
4
+ ## 0.2.0 / 2011-08-11
5
+
6
+ Version 0.2 is first really usable release.
7
+
8
+ Changes:
9
+
10
+ * Renamed omit to skip.
11
+ * Add World base class for adding test helpers.
12
+
13
+
14
+ ## 0.1.0 / 2011-07-29
15
+
16
+ Pushed very early release to get name up on RubyGems.
17
+
18
+ Changes:
19
+
20
+ * Happy Birthday.
data/MANIFEST CHANGED
@@ -4,9 +4,11 @@ lib/lime/advice.rb
4
4
  lib/lime/feature.rb
5
5
  lib/lime/scenario.rb
6
6
  lib/lime/step.rb
7
+ lib/lime/world.rb
7
8
  lib/lime.rb
8
9
  PROFILE
9
10
  LICENSE.txt
11
+ HISTORY.md
10
12
  README.md
11
13
  VERSION
12
14
  COPYING.rdoc
data/PROFILE CHANGED
@@ -6,8 +6,9 @@ authors:
6
6
  - Thomas Sawyer <transfire@gmail.com>
7
7
 
8
8
  description:
9
- Lime is a "Ruby DSL" knock-off of Cucumber's Gherkin
10
- BDD nomenclature that runs on top of ruby-test.
9
+ Lime is a pure Ruby variation of Cucumber's Gherkin
10
+ BDD test system that runs on top of the Ruby
11
+ Universal Test Harness.
11
12
 
12
13
  resources:
13
14
  home: http://rubyworks.github.com/lime
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -1,28 +1,31 @@
1
+ # Ignore lime paths in backtraces
2
+ ignore_path = File.expand_path(File.dirname(__FILE__) + '/lime')
3
+ ignore_regexp = Regexp.new(Regexp.escape(ignore_path))
4
+ RUBY_IGNORE_CALLERS = [] unless defined? RUBY_IGNORE_CALLERS
5
+ RUBY_IGNORE_CALLERS << ignore_regexp
6
+
7
+ # Make sure the global test array is defined.
8
+ $TEST_SUITE ||= []
9
+
1
10
  module Lime
2
- $TEST_SUITE ||= []
3
11
 
4
12
  require 'lime/advice'
5
13
  require 'lime/feature'
6
14
  require 'lime/scenario'
7
15
  require 'lime/step'
8
- end
9
16
 
10
- # Ignore lime paths in backtraces
11
- ignore_path = File.expand_path(File.dirname(__FILE__) + '/lime')
12
- ignore_regexp = Regexp.new(Regexp.escape(ignore_path))
13
- RUBY_IGNORE_CALLERS = [] unless defined? RUBY_IGNORE_CALLERS
14
- RUBY_IGNORE_CALLERS << ignore_regexp
15
- RUBY_IGNORE_CALLERS << /bin\/ruby-test/
17
+ # Toplevel DSL.
18
+ module DSL
19
+
20
+ # Define a feature.
21
+ def Feature(label, &block)
22
+ $TEST_SUITE << Lime::Feature.new(:label=>label, &block)
23
+ end
16
24
 
17
- module Test
18
- extend self
25
+ alias :feature :Feature
19
26
 
20
- # Define a general test case.
21
- def Feature(label, &block)
22
- $TEST_SUITE << Lime::Feature.new(:label=>label, &block)
23
27
  end
24
28
 
25
- alias :feature :Feature
26
29
  end
27
30
 
28
- extend Test
31
+ extend Lime::DSL
@@ -1,10 +1,11 @@
1
- #require 'lime/pending'
2
- require 'lime/advice'
3
- require 'lime/scenario'
4
-
5
1
  module Lime
6
2
 
7
- # The TestFeature ...
3
+ #require 'lime/pending'
4
+ require 'lime/world'
5
+ require 'lime/advice'
6
+ require 'lime/scenario'
7
+
8
+ # Features contain scenarios.
8
9
  #
9
10
  # The `advice` are _given_, _when_ and _then_ rules.
10
11
  #
@@ -13,10 +14,11 @@ module Lime
13
14
  # Brief description of the feature.
14
15
  attr :label
15
16
 
16
- #
17
+ # The descriptive details of the feature, defined using
18
+ # the `To`, `As` and `We` methods.
17
19
  attr :story
18
20
 
19
- # List of tests and sub-cases.
21
+ # List of scenarios.
20
22
  attr :scenarios
21
23
 
22
24
  # Advice are labeled procedures, such as before
@@ -32,12 +34,12 @@ module Lime
32
34
  @setup = settings[:setup]
33
35
 
34
36
  @advice = Advice.new
35
- @scope = Module.new
36
37
 
37
38
  @story = []
38
39
  @scenarios = []
39
40
 
40
- @scope.extend DSL.new(self, &block)
41
+ @scope = Scope.new(self)
42
+ @scope.module_eval(&block)
41
43
  end
42
44
 
43
45
  # Convenience method for accessing advice, aka step definitions.
@@ -66,16 +68,6 @@ module Lime
66
68
  (["#{label}"] + story).join("\n")
67
69
  end
68
70
 
69
- #
70
- def omit?
71
- @omit
72
- end
73
-
74
- #
75
- def omit=(boolean)
76
- @omit = boolean
77
- end
78
-
79
71
  #
80
72
  def update(mixin)
81
73
  @advice[:given].concat mixin[:given] || []
@@ -85,51 +77,50 @@ module Lime
85
77
  end
86
78
 
87
79
  #
88
- class DSL < Module
80
+ class Scope < World
89
81
 
90
82
  #
91
- def initialize(feature, &code)
83
+ def initialize(feature) #, &code)
92
84
  @_feature = feature
93
-
94
- module_eval(&code)
85
+ @_skip = false
86
+ #module_eval(&code)
95
87
  end
96
88
 
97
89
  #
98
90
  def To(description)
99
91
  @_feature.story << "To " + description
100
92
  end
101
- alias_method :to, :To
93
+
94
+ alias :to :To
102
95
 
103
96
  #
104
97
  def As(description)
105
98
  @_feature.story << "As " + description
106
99
  end
107
- alias_method :as, :As
100
+
101
+ alias :as :As
108
102
 
109
103
  #
110
104
  def We(description)
111
105
  @_feature.story << "We " + description
112
106
  end
113
- alias_method :we, :We
107
+
108
+ alias :we :We
114
109
 
115
110
  #
116
111
  def Scenario(label, &procedure)
117
- scenario = Scenario.new(@_feature, :label=>label, &procedure)
112
+ scenario = Scenario.new(
113
+ @_feature,
114
+ :skip => @_skip,
115
+ :label => label,
116
+ &procedure
117
+ )
118
118
  @_feature.scenarios << scenario
119
+ @_skip = false
119
120
  scenario
120
121
  end
121
- alias_method :scenario, :Scenario
122
122
 
123
- # Omit a scenario from test runs.
124
- #
125
- # omit unit :foo do
126
- # # ...
127
- # end
128
- #
129
- def Omit(scenario)
130
- scenario.omit = true
131
- end
132
- alias_method :omit, :Omit
123
+ alias :scenario :Scenario
133
124
 
134
125
  # Given ...
135
126
  #
@@ -139,7 +130,8 @@ module Lime
139
130
  def Given(description, &procedure)
140
131
  @_feature[:given][description] = procedure
141
132
  end
142
- alias_method :given, :Given
133
+
134
+ alias :given :Given
143
135
 
144
136
  # When ...
145
137
  #
@@ -149,7 +141,8 @@ module Lime
149
141
  def When(description, &procedure)
150
142
  @_feature[:when][description] = procedure
151
143
  end
152
- alias_method :wence, :When
144
+
145
+ alias :wence :When
153
146
 
154
147
  # Then ...
155
148
  #
@@ -159,9 +152,22 @@ module Lime
159
152
  def Then(description, &procedure)
160
153
  @_feature[:then][description] = procedure
161
154
  end
162
- alias_method :hence, :Then
163
155
 
156
+ alias :hence :Then
157
+
158
+ # Skip the next scenario when running feature.
164
159
  #
160
+ # skip "for some reason"
161
+ # Scenario "blah blah blah" do
162
+ # # ...
163
+ # end
164
+ #
165
+ # @todo Use block form of this instead?
166
+ def skip(reason=true)
167
+ @_skip = reason
168
+ end
169
+
170
+ # Is this necessary?
165
171
  def _feature
166
172
  @_feature
167
173
  end
@@ -182,33 +188,27 @@ module Lime
182
188
  #
183
189
  # @example
184
190
  #
185
- # module MySteps
186
- # include Lime::Featurable
191
+ # module MyStepDefinitions
192
+ # include Lime::Featurette
193
+ #
187
194
  # Given "customer's name is '(((\s+)))'" do |name|
188
195
  # @name = name
189
196
  # end
190
197
  # end
191
198
  #
192
199
  # Feature do
193
- # include MySteps
200
+ # include MyStepDefinitions
194
201
  # end
195
202
  #
196
- module Featurable
203
+ module Featurette
197
204
 
198
205
  def self.append_features(base)
199
206
  base.extend(self)
200
207
  base.module_eval %{
201
- @_advice = Hash.new { |h,k| h[k]={} }
208
+ @_advice = Hash.new{ |h,k| h[k]={} }
202
209
  }
203
210
  end
204
211
 
205
- #
206
- #def initialize(&code)
207
- # @_advice = Hash.new { |h,k| h[k]={} }
208
- #
209
- # module_eval(&code)
210
- #end
211
-
212
212
  # Given ...
213
213
  #
214
214
  # @param [String] description
@@ -217,7 +217,8 @@ module Lime
217
217
  def Given(description, &procedure)
218
218
  @_advice[:given][description] = procedure
219
219
  end
220
- alias_method :given, :Given
220
+
221
+ alias :given :Given
221
222
 
222
223
  # When ...
223
224
  #
@@ -227,7 +228,8 @@ module Lime
227
228
  def When(description, &procedure)
228
229
  @_advice[:when][description] = procedure
229
230
  end
230
- alias_method :wence, :When
231
+
232
+ alias :wence :When
231
233
 
232
234
  # Then ...
233
235
  #
@@ -237,9 +239,10 @@ module Lime
237
239
  def Then(description, &procedure)
238
240
  @_advice[:then][description] = procedure
239
241
  end
240
- alias_method :hence, :Then
241
242
 
242
- # Access to internal feature instance.
243
+ alias :hence :Then
244
+
245
+ # Access to advice.
243
246
  def [](key)
244
247
  @_advice[key]
245
248
  end
@@ -10,61 +10,63 @@ module Lime
10
10
  @feature = feature
11
11
 
12
12
  @label = settings[:label]
13
-
14
- @scope = Module.new
13
+ @skip = settings[:skip]
15
14
 
16
15
  @steps = []
17
16
 
18
- @scope.extend DSL.new(self, &block)
17
+ @scope = Scope.new(self)
18
+ @scope.module_eval(&block)
19
19
  end
20
20
 
21
- #
21
+ # Parent feature.
22
22
  attr :feature
23
23
 
24
- #
24
+ # Description of scenario.
25
25
  attr :label
26
26
 
27
- #
27
+ # List scenario steps.
28
28
  attr :steps
29
29
 
30
- #
30
+ # Evaluation scope.
31
31
  attr :scope
32
32
 
33
+ # Skip this scenario from runs.
33
34
  #
34
- def omit?
35
- @omit
35
+ # @return [Boolean,String] reason for skipping
36
+ def skip?
37
+ @skip
36
38
  end
37
39
 
38
- #
39
- def omit=(boolean)
40
- @omit = boolean
40
+ # Scenario steps must be run in order.
41
+ def ordered?
42
+ true
41
43
  end
42
44
 
43
- #
45
+ # Iterate over steps.
44
46
  def each(&block)
45
47
  @steps.each(&block)
46
48
  end
47
49
 
48
- #
50
+ # Number of steps.
49
51
  def size(&block)
50
52
  @steps.size
51
53
  end
52
54
 
53
- #
55
+ # The type is "Scenario". This is used by Ruby Test in test output.
54
56
  def type
55
57
  "Scenario"
56
58
  end
57
59
 
58
- #
60
+ # Provided the scenario label.
59
61
  def to_s
60
62
  @label.to_s
61
63
  end
62
64
 
63
65
  # FIXME
64
- def subject
66
+ def topic
65
67
  end
66
68
 
67
- #
69
+ # Run a step in the context of this scenario.
68
70
  def run(step)
69
71
  type = step.type
70
72
  desc = step.label
@@ -75,52 +77,40 @@ module Lime
75
77
  end
76
78
  end
77
79
 
78
- #
79
- #--
80
- # TODO: Change so that the scope is the DSL
81
- # and includes the DSL of the context?
82
- #++
83
- #def scope
84
- # @scope ||= (
85
- # #if feature
86
- # # scope = feature.scope || Object.new
87
- # # scope.extend(dsl)
88
- # #else
89
- # scope = Object.new
90
- # scope.extend(dsl)
91
- # #end
92
- # )
93
- #end
94
-
95
80
  #
96
81
  #def find
97
82
  # features.clauses[@type].find{ |c| c =~ @description }
98
83
  #end
99
84
 
100
85
  # Convert matching string into a regular expression. If the string
101
- # contains double parenthesis, such as ((.*?)), then the text within
102
- # them is treated as in regular expression and kept verbatium.
103
- #
104
- # TODO: Better way to isolate regexp. Maybe ?:(.*?) or /(.*?)/.
86
+ # contains parentheticals, e.g. `(.*?)`, the text within them is
87
+ # treated as a case-insensitve back-referenceing regular expression
88
+ # and kept verbatium.
105
89
  #
90
+ # To use a regular expression, but leave the resulting match out of
91
+ # the backreferences use `?:`, e.g. `(?:\d+)`.
106
92
  def match_regexp(str)
107
- str = str.split(/(\(\(.*?\)\))(?!\))/).map{ |x|
108
- x =~ /\A\(\((.*)\)\)\Z/ ? $1 : Regexp.escape(x)
93
+ ## the old way required double and triple parens
94
+ #str = str.split(/(\(\(.*?\)\))(?!\))/).map{ |x|
95
+ # x =~ /\A\(\((.*)\)\)\Z/ ? $1 : Regexp.escape(x)
96
+ #}.join
97
+ str = str.split(/(\(.*?\))(?!\))/).map{ |x|
98
+ x =~ /\A\((.*)\)\Z/ ? "(#{$1})" : Regexp.escape(x)
109
99
  }.join
110
100
  str = str.gsub(/\\\s+/, '\s+')
111
101
  Regexp.new(str, Regexp::IGNORECASE)
112
102
  end
113
103
 
114
104
  # TODO: Need to ensure the correct order of Given, When, Then.
115
- class DSL < Module
105
+ class Scope < Module
116
106
 
117
107
  #
118
- def initialize(scenario, &code)
108
+ def initialize(scenario) #, &code)
119
109
  @scenario = scenario
120
110
 
121
111
  extend(scenario.feature.scope)
122
112
 
123
- module_eval(&code)
113
+ #module_eval(&code)
124
114
  end
125
115
 
126
116
  # Given ...
@@ -131,7 +121,8 @@ module Lime
131
121
  def Given(label)
132
122
  @scenario.steps << Step.new(@scenario, label, :type=>:given)
133
123
  end
134
- alias_method :given, :Given
124
+
125
+ alias :given :Given
135
126
 
136
127
  # When ...
137
128
  #
@@ -141,7 +132,8 @@ module Lime
141
132
  def When(label)
142
133
  @scenario.steps << Step.new(@scenario, label, :type=>:when)
143
134
  end
144
- alias_method :wence, :When
135
+
136
+ alias :wence :When
145
137
 
146
138
  # Then ...
147
139
  #
@@ -151,7 +143,8 @@ module Lime
151
143
  def Then(label)
152
144
  @scenario.steps << Step.new(@scenario, label, :type=>:then)
153
145
  end
154
- alias_method :hence, :Then
146
+
147
+ alias :hence :Then
155
148
 
156
149
  end
157
150
 
@@ -0,0 +1,7 @@
1
+ module Lime
2
+
3
+ #
4
+ class World < Module
5
+ end
6
+
7
+ end
@@ -0,0 +1,39 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
3
+ <!-- Created with Inkscape (http://www.inkscape.org/) -->
4
+ <svg id="svg1" sodipodi:version="0.32" inkscape:version="0.38.1" width="400.00000pt" height="400.00000pt" sodipodi:docbase="/var/www/html/svg_gallery/svg/fruits" sodipodi:docname="lemon.svg" xmlns="http://www.w3.org/2000/svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:xlink="http://www.w3.org/1999/xlink">
5
+ <defs id="defs3">
6
+ <linearGradient id="linearGradient831">
7
+ <stop style="stop-color: rgb(255, 255, 0); stop-opacity: 1;" offset="0.0000000" id="stop832"/>
8
+ <stop style="stop-color: rgb(255, 227, 0); stop-opacity: 1;" offset="1.0000000" id="stop833"/>
9
+ </linearGradient>
10
+ <radialGradient xlink:href="#linearGradient831" id="radialGradient834" cx="0.33703703" cy="0.28358209" r="0.38183698" fx="0.33703703" fy="0.28358209"/>
11
+ </defs>
12
+ <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="1.3195079" inkscape:cx="120.13018" inkscape:cy="204.09312" inkscape:window-width="910" inkscape:window-height="775" inkscape:window-x="119" inkscape:window-y="24"/>
13
+ <g id="g838">
14
+ <path style="fill: url(#radialGradient834) rgb(0, 0, 0); fill-rule: evenodd; stroke: rgb(0, 0, 0); stroke-width: 10; stroke-linejoin: round; stroke-dasharray: none;" d="M 68.708186,148.12939 C 228.69852,9.5810597 474.45687,146.15839 471.15810,289.65487 C 497.54826,315.22034 467.85933,343.25988 451.36548,350.68211 C 309.51838,525.51691 17.577254,382.02043 34.895796,237.69925 C 12.847026,174.32754 32.421718,155.55162 68.708186,148.12939 z " id="path827" sodipodi:nodetypes="ccccc"/>
15
+ <path style="fill-opacity: 0.133333; fill-rule: evenodd; stroke-width: 1pt;" d="M 44.330330,267.99099 C 65.580330,246.74099 68.080330,411.74099 378.08033,350.49099 C 371.83033,344.24099 338.08033,201.74099 458.08033,249.24099 C 504.95533,263.61599 358.70533,239.55349 410.58033,339.24099 C 418.62433,352.33698 416.20533,352.36599 438.08033,357.99099 C 305.58033,500.49099 46.830330,390.49099 44.330330,267.99099 z " id="path828" sodipodi:nodetypes="cccccc"/>
16
+ <path style="fill: rgb(255, 255, 255); fill-opacity: 0.7; fill-rule: evenodd; stroke-width: 1pt;" d="M 68.080330,155.83295 C 124.36962,90.490990 313.68568,43.977604 438.08033,203.33295 C 395.58033,249.58295 275.58033,49.582958 68.080330,155.83295 z " id="path829" sodipodi:nodetypes="ccc"/>
17
+ <path style="fill: rgb(255, 255, 255); fill-opacity: 0.7; fill-rule: evenodd; stroke-width: 1pt;" d="M 469.33033,295.49099 C 483.64639,312.99099 470.58033,332.99099 460.58033,330.49099 C 381.83033,309.24099 424.33033,287.99099 469.33033,295.49099 z " id="path830" sodipodi:nodetypes="ccc"/>
18
+ </g>
19
+
20
+ <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
21
+ <Work rdf:about="">
22
+ <dc:title>Clipart by Nicu Buculei - pear</dc:title>
23
+ <dc:rights>
24
+ <Agent>
25
+ <dc:title>Nicu Buculei</dc:title>
26
+ </Agent>
27
+ </dc:rights>
28
+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
29
+ <license rdf:resource="http://web.resource.org/cc/PublicDomain"/>
30
+ </Work>
31
+
32
+ <License rdf:about="http://web.resource.org/cc/PublicDomain">
33
+ <permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
34
+ <permits rdf:resource="http://web.resource.org/cc/Distribution"/>
35
+ <permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
36
+ </License>
37
+
38
+ </rdf:RDF>
39
+ </svg>
@@ -0,0 +1,17 @@
1
+ html { font-family: sans-serif; font-size: 16px; color: black; }
2
+ body { padding: 0; margin: 0; font-family: sans-serif; font-size: 12px; background: #fff; }
3
+
4
+ h1 { font-size: 90px; margin: 20px; }
5
+
6
+ p { font-size: 110%; text-align: justify; margin: 20px 0; line-height: 150%; }
7
+
8
+ a { text-decoration: none; font-size: 100%; }
9
+ a:hover { text-decoration: underline; }
10
+
11
+ ul { margin: 0 auto; list-style-type: none; width: 300px; }
12
+ li { float: left; padding: 10px; text-align: center; }
13
+
14
+ pre { font-size: 130%; padding: 10px 0 0 0; -moz-border-radius: 10px; font-family: courier, monospace; color: #000; }
15
+ code { font-family: courier, monospace; }
16
+
17
+ img { border: none; }
@@ -0,0 +1,47 @@
1
+ html { font-size: 16px; }
2
+
3
+ h1 { font-family: times; font-size: 400%; margin: 20px 0; color: #f7d901; }
4
+ h2 { font-size: 220%; margin-top: 30px; color: #444; }
5
+ h3 { font-size: 190%; color: green; }
6
+
7
+ p { color: #222; font-weight: normal; font-size: 110%; }
8
+ a { color: #262; }
9
+ a:hover { text-decoration: underline; }
10
+
11
+ pre { background: #ffffff; -moz-border-radius: 10px; line-height: 140%; font-size: 0.9em; }}
12
+ code { color: #222; font-weight: bold; }
13
+ tt { color: #222; font-weight: bold; }
14
+
15
+ #nav { padding: 0 30px 20px 60px; text-align: left; color: pink; float: right; }
16
+ #nav a { font-size: 160%; font-weight: bold; line-height: 150%; color: #000; }
17
+ #nav a:hover { color: #FFF; text-decoration: none; }
18
+
19
+ #header { height: 250px; text-align: left; }
20
+ #header h1 { font-size: 100px; padding: 40px 0 0 0; color: #f7d901; margin-left: -10px; }
21
+ #header h2 { padding-left: 5px; margin-top: 0; }
22
+
23
+ #main { color: white; padding: 20px 0 30px 0; background: url(../images/skin.jpg) #f7e931; }
24
+ #main p { font-weight: bold; font-family: sans-serif; font-size: 1.7em; color: #222; font-weight: bold; text-shadow: 1px 1px white; }
25
+ #main h2 { color: #333333; }
26
+ #main h3 { color: #333333; }
27
+
28
+ #example p { font-size: 2em; }
29
+
30
+ #footer { margin-top: 40px; padding: 40px 0; text-align: center; background: url(../images/skin.jpg) #f7e931; }
31
+ #footer .copyright { padding-top: 0; }
32
+ #footer .copyright p { color: #222; font-weight: normal; font-size: 80%; line-height: 150%; }
33
+
34
+ #forkme {
35
+ position: absolute;
36
+ top: 0; right: 0;
37
+ width: 150px;
38
+ }
39
+
40
+ .page { width: 730px; margin: 0 auto; }
41
+
42
+ .bordered { border-top: 2px solid #99ff99; border-bottom: 2px solid #99ff99; }
43
+
44
+ .copyright { padding: 0; text-align: left; }
45
+ .copyright td { font-size: 10px; color: #444; }
46
+
47
+
@@ -0,0 +1,157 @@
1
+ <html>
2
+ <head>
3
+ <title>Lime</title>
4
+ <link href="assets/styles/reset.css" rel="stylesheet" type="text/css"/>
5
+ <link href="assets/styles/site.css" rel="stylesheet" type="text/css"/>
6
+ <link href="assets/images/lime.jpg" rel="shortcut icon"/>
7
+
8
+ <!-- syntax highlighing -->
9
+ <script src="http://rubyworks.github.com/assets/includes/shjs/sh_main.min.js"></script>
10
+ <script src="http://rubyworks.github.com/assets/includes/shjs/lang/sh_ruby.min.js"></script>
11
+ <script src="http://rubyworks.github.com/assets/includes/shjs/lang/sh_sh.min.js"></script>
12
+ <link href="http://rubyworks.github.com/assets/includes/shjs/css/sh_acid.min.css" rel="stylesheet" type="text/css" />
13
+ </head>
14
+ <body onload="sh_highlightDocument();">
15
+
16
+ <div id="forkme">
17
+ <a href="http://github.com/rubyworks/lime"><img src="assets/images/forkme.png" /></a>
18
+ </div>
19
+
20
+ <div id="header">
21
+ <div class="page">
22
+ <img src="assets/images/cut-lime.png" height="200px" align="right" style="padding-top: 15px;"/>
23
+ <h1><img src="assets/images/title.png"/></h1>
24
+ <h2>Slices of Green Behavior</h2>
25
+ </div>
26
+ </div>
27
+
28
+ <div id="main" class="bordered">
29
+ <div class="page">
30
+
31
+ <div id="nav">
32
+ <!-- <a href="guide/doc.en/index.html">English Manual</a> &nbsp;&middot;&nbsp; -->
33
+ <a href="http://wiki.github.com/rubyworks/lime">Wiki</a> <br/>
34
+ <a href="http://rubydoc.info/gems/lime/frames">API</a> <br/>
35
+ <a href="http://googlegroups.com/group/rubyworks-mailinglist">Email</a> <br/>
36
+ <a href="http://github.com/rubyworks/lime/issues">Issue</a> <br/>
37
+ <a href="http://github.com/rubyworks/lime">Code</a>
38
+ </div>
39
+
40
+ <p>Lime is a behavior-oriented test framework using a Gherkin-based
41
+ syntax inspeired by Cucumber. Unlike Cucumber, Lime is implemented
42
+ purely in Ruby, not as a separate parse system, and runs on top of
43
+ the Ruby Universal Test Harness, <a href="http://rubyworks.github.com/test">Ruby Test</a>.
44
+ </p>
45
+
46
+ <!--
47
+ <p>Lime uses the <a href="http://rubyworks.github.com/ae">Assertive Expressive</a>
48
+ assertions framework. This is the same verstile framework used by <a href="http://rubyworks.github.com/qed">Q.E.D.</a>.
49
+ By default Lime test support the standard <code>#assert</code> and <code>#expect</code> assertion methods.
50
+ If you wish to use subjunctive terms, either <code>#should</code> or <code>#must</code>, you can load these
51
+ via a helper script (eg. <code>require 'ae/should'</code>).</p>
52
+ -->
53
+
54
+ </div>
55
+ </div>
56
+
57
+ <div id="example">
58
+ <div class="page">
59
+ <h3>Example</h3>
60
+
61
+ <p>To give you a taste of what a lime testcase looks like and example based on
62
+ the one given on Cucumber's homepage. We would write a Lime feature case along
63
+ the same lines:</p>
64
+
65
+ <pre class="sh_ruby">
66
+ Feature "Addition" do
67
+ To "avoid silly mistakes"
68
+ As "a math idiot"
69
+ We "need to calculate the sum of numbers"
70
+
71
+ Scenario "Add two numbers" do
72
+ Given "I have a calculator"
73
+ Given "I have entered 50 into the calculator"
74
+ Given "I have entered 70 into the calculator"
75
+ When "I press add"
76
+ Then "the result should be 120 on the screen"
77
+ end
78
+
79
+ Scenario "Add three numbers" do
80
+ Given "I have a calculator"
81
+ Given "I have entered 50 into the calculator"
82
+ Given "I have entered 70 into the calculator"
83
+ Given "I have entered 90 into the calculator"
84
+ When "I press add"
85
+ Then "the result should be 210 on the screen"
86
+ end
87
+
88
+ Given 'I have a calculator' do
89
+ require 'calculator'
90
+ @calculator = Calculator.new
91
+ end
92
+
93
+ Given 'I have entered (\d+) into the calculator' do |n|
94
+ @calculator.push n.to_i
95
+ end
96
+
97
+ When 'I press add' do
98
+ @result = @calculator.add
99
+ end
100
+
101
+ Then 'the result should be (\d+) on the screen' do |n|
102
+ @result.assert == n.to_i
103
+ end
104
+ end
105
+ </pre>
106
+
107
+ <p>A silly example to be sure, but one we can all easily understand.</p>
108
+
109
+ </div>
110
+ </div>
111
+
112
+ <div id="footer" class="bordered">
113
+ <div class="page">
114
+ <script type="text/javascript"><!--
115
+ google_ad_client = "ca-pub-1126154564663472";
116
+ /* RUBYWORKS 09-10-02 728x90 */
117
+ google_ad_slot = "0788888658";
118
+ google_ad_width = 728;
119
+ google_ad_height = 90;
120
+ //-->
121
+ </script>
122
+ <script type="text/javascript"
123
+ src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
124
+ </script>
125
+
126
+ <br/><br/><br/>
127
+
128
+ <div class="copyright" width="100%">
129
+ <a href="http://rubyworks.github.com/">
130
+ <img src="assets/images/ruby-logo.png" height="110px" align="left" style="margin: 0 5px; padding: 0 10px" />
131
+ </a>
132
+ <a href="http://www.apache.org/licenses/LICENSE-2.0.html">
133
+ <img src="assets/images/opensource.png" height="120px" align="left" style="padding: 0 10px;" />
134
+ </a>
135
+ <a href="github.com/rubyworks/lime">
136
+ <img src="assets/images/github-logo.png" height="115px" align="left" style="margin: 0; padding: 0 10px;" />
137
+ </a>
138
+ <a href="http://testanything.org/wiki/index.php/Main_Page">
139
+ <img src="assets/images/tap.png" height="113px" align="left" style="margin: 0; padding: 0 20px;" />
140
+ </a>
141
+ <a href="">
142
+ <img src="assets/images/limes-are-good.png" height="117px" align="left" style="margin: 0; padding: 0 10px;" />
143
+ </a>
144
+ </div>
145
+
146
+ <br style="clear: both;" />
147
+
148
+ <div style="margin-top: 30px;">
149
+ <b>Lime</b>, Copyright &copy; 2009 Thomas Sawyer &middot;
150
+ <b>Contact:</b> transfire @ gmail.com
151
+ </div>
152
+ </div>
153
+ </div>
154
+
155
+ </body>
156
+ </html>
157
+
@@ -1,4 +1,4 @@
1
- Test::Feature "Addition" do
1
+ Feature "Addition" do
2
2
  To "avoid silly mistakes"
3
3
  As "a math idiot"
4
4
  We "need to calculate the sum of numbers"
@@ -25,7 +25,7 @@ Test::Feature "Addition" do
25
25
  @calculator = Calculator.new
26
26
  end
27
27
 
28
- Given 'I have entered (((\d+))) into the calculator' do |n|
28
+ Given 'I have entered (\d+) into the calculator' do |n|
29
29
  @calculator.push n.to_i
30
30
  end
31
31
 
@@ -33,7 +33,7 @@ Test::Feature "Addition" do
33
33
  @result = @calculator.add
34
34
  end
35
35
 
36
- Then 'the result should be (((\d+))) on the screen' do |n|
36
+ Then 'the result should be (\d+) on the screen' do |n|
37
37
  @result.assert == n.to_i
38
38
  end
39
39
  end
metadata CHANGED
@@ -1,89 +1,90 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: lime
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
4
5
  prerelease:
5
- version: 0.1.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Thomas Sawyer
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-07-29 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2011-08-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: test
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &30695100 !ruby/object:Gem::Requirement
19
17
  none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
24
22
  type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: ae
28
23
  prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *30695100
25
+ - !ruby/object:Gem::Dependency
26
+ name: ae
27
+ requirement: &30694560 !ruby/object:Gem::Requirement
30
28
  none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: "0"
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
35
33
  type: :runtime
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: detroit
39
34
  prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *30694560
36
+ - !ruby/object:Gem::Dependency
37
+ name: detroit
38
+ requirement: &30694040 !ruby/object:Gem::Requirement
41
39
  none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
46
44
  type: :development
47
- version_requirements: *id003
48
- - !ruby/object:Gem::Dependency
49
- name: reap
50
45
  prerelease: false
51
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *30694040
47
+ - !ruby/object:Gem::Dependency
48
+ name: reap
49
+ requirement: &30725580 !ruby/object:Gem::Requirement
52
50
  none: false
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: "0"
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
57
55
  type: :development
58
- version_requirements: *id004
59
- - !ruby/object:Gem::Dependency
60
- name: qed
61
56
  prerelease: false
62
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *30725580
58
+ - !ruby/object:Gem::Dependency
59
+ name: qed
60
+ requirement: &30725080 !ruby/object:Gem::Requirement
63
61
  none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: "0"
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
68
66
  type: :development
69
- version_requirements: *id005
70
- description: Lime is a "Ruby DSL" knock-off of Cucumber's Gherkin BDD nomenclature that runs on top of ruby-test.
71
- email:
67
+ prerelease: false
68
+ version_requirements: *30725080
69
+ description: Lime is a pure Ruby variation of Cucumber's Gherkin BDD test system that
70
+ runs on top of the Ruby Universal Test Harness.
71
+ email:
72
72
  - transfire@gmail.com
73
73
  executables: []
74
-
75
74
  extensions: []
76
-
77
- extra_rdoc_files:
75
+ extra_rdoc_files:
78
76
  - LICENSE.txt
79
77
  - COPYING.rdoc
78
+ - HISTORY.md
80
79
  - README.md
81
- files:
80
+ files:
81
+ - .gemspec
82
82
  - .gitignore
83
83
  - .ruby
84
84
  - .yardopts
85
85
  - Assembly
86
86
  - COPYING.rdoc
87
+ - HISTORY.md
87
88
  - LICENSE.txt
88
89
  - MANIFEST
89
90
  - PROFILE
@@ -94,36 +95,47 @@ files:
94
95
  - lib/lime/feature.rb
95
96
  - lib/lime/scenario.rb
96
97
  - lib/lime/step.rb
97
- - lime.gemspec
98
+ - lib/lime/world.rb
99
+ - site/assets/images/cut-lime.png
100
+ - site/assets/images/forkme.png
101
+ - site/assets/images/github-logo.png
102
+ - site/assets/images/lemon.jpg
103
+ - site/assets/images/lemon.svg
104
+ - site/assets/images/limes-are-good.png
105
+ - site/assets/images/opensource.png
106
+ - site/assets/images/ruby-logo.png
107
+ - site/assets/images/skin.jpg
108
+ - site/assets/images/skin1.jpg
109
+ - site/assets/images/tap.png
110
+ - site/assets/images/title.png
111
+ - site/assets/styles/reset.css
112
+ - site/assets/styles/site.css
113
+ - site/index.html
98
114
  - try/.testrb
99
115
  - try/calculator.rb
100
116
  - try/feature_example.rb
101
117
  homepage: http://rubyworks.github.com/lime
102
118
  licenses: []
103
-
104
119
  post_install_message:
105
120
  rdoc_options: []
106
-
107
- require_paths:
121
+ require_paths:
108
122
  - lib
109
- required_ruby_version: !ruby/object:Gem::Requirement
123
+ required_ruby_version: !ruby/object:Gem::Requirement
110
124
  none: false
111
- requirements:
112
- - - ">="
113
- - !ruby/object:Gem::Version
114
- version: "0"
115
- required_rubygems_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ! '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
116
130
  none: false
117
- requirements:
118
- - - ">="
119
- - !ruby/object:Gem::Version
120
- version: "0"
131
+ requirements:
132
+ - - ! '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
121
135
  requirements: []
122
-
123
136
  rubyforge_project:
124
- rubygems_version: 1.8.2
137
+ rubygems_version: 1.8.5
125
138
  signing_key:
126
139
  specification_version: 3
127
140
  summary: Gherkin-style Test Framework
128
141
  test_files: []
129
-