cucumber-in-the-yard 1.5.2 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -0
- data/Rakefile +1 -1
- data/cucumber-in-the-yard.gemspec +1 -1
- data/example/second_example.feature +13 -1
- data/example/step_definitions/example.step.rb +21 -2
- data/lib/templates/default/feature/html/steps.erb +1 -1
- data/lib/templates/default/feature/setup.rb +7 -2
- data/lib/yard/code_objects/cucumber/step.rb +1 -7
- data/lib/yard/code_objects/step_definition.rb +7 -5
- data/lib/yard/handlers/cucumber/feature_handler.rb +2 -4
- data/lib/yard/handlers/step_definition_handler.rb +1 -1
- metadata +3 -3
data/History.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
=== 1.5.3 / 2010-10-26
|
2
|
+
|
3
|
+
* FIX - Step Definition YARD handler regex was poorly formed and raised exceptions
|
4
|
+
when it contained a forward-slash (even if escaped).
|
5
|
+
* FIX - Step highlighting was causing 'Out Of Memory' issues because
|
6
|
+
gsub could not handle nil values.
|
7
|
+
* FIX - Step highlighting failed to replace matches properly causing for corrupted
|
8
|
+
HTML span values to appear in the highlighted step definitions
|
9
|
+
|
1
10
|
=== 1.5.2 / 2010-10-26
|
2
11
|
|
3
12
|
* FIX - Step Transform YARD handler regex was poorly formed and raised exceptions
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ task :gendoc do
|
|
8
8
|
`yardoc -e lib/city.rb -p lib/templates 'example/**/*' --debug`
|
9
9
|
end
|
10
10
|
|
11
|
-
Echoe.new('cucumber-in-the-yard', '1.5.
|
11
|
+
Echoe.new('cucumber-in-the-yard', '1.5.3') do |g|
|
12
12
|
g.author = "Franklin Webber"
|
13
13
|
g.email = "franklin.webber@gmail.com"
|
14
14
|
g.url = "http://github.com/burtlo/Cucumber-In-The-Yard"
|
@@ -24,7 +24,19 @@ Feature: Customer Logout Feature
|
|
24
24
|
When a customer logs in as username 'frank' with password 'default'
|
25
25
|
And visits the customer update page
|
26
26
|
Then I expect the customer is able able to post to their profile
|
27
|
-
|
27
|
+
|
28
|
+
@optional_parameters
|
29
|
+
Scenario: Optional Parameter Step Definition
|
30
|
+
# This step definition has some optional parameters
|
31
|
+
Given a project
|
32
|
+
And an inactive project
|
33
|
+
And a project with the name 'optional', start date 10/26/2010, nicknamed 'norman'
|
34
|
+
|
35
|
+
@highlighting
|
36
|
+
Scenario: Highlighting
|
37
|
+
Given a duck that has a bill
|
38
|
+
Then I expect the duck to quack
|
39
|
+
|
28
40
|
@product
|
29
41
|
Scenario Outline: Customers that bought a product are included in their product groups
|
30
42
|
Given that <Customer> is a valid customer
|
@@ -1,5 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
1
|
CUSTOMER = /(?:(?:an?|the) customer|#{TEDDY_BEAR})/
|
4
2
|
|
5
3
|
TEDDY_BEAR = /teddy bear/
|
@@ -49,6 +47,27 @@ And /^edits their the (biography) to state:$/ do |section,text|
|
|
49
47
|
pending "text_field not present for #{section} #{bio} for this release"
|
50
48
|
end
|
51
49
|
|
50
|
+
#
|
51
|
+
# Complicated step definition with optional parameters
|
52
|
+
#
|
53
|
+
Given /^(?:I create )?an? (?:(active|deactive|inactive|simulated)d?)? ?project(?:[\s,]*(?:with)? ?(?:an?|the)? (?:(?:the size? (?:at|of)? ?(\d+)|named? (?:of )?'([^']+)'|start date (?:of )?((?:(?:\d{1,2}[\/-]){2}(?:\d\d){1,2}))|end date (?:of )?((?:(?:\d{1,2}[\/-]){2}(?:\d\d){1,2}))|user range (?:of )?(\d+-\d+)|description (?:of )?'([^']+)'|nicknamed? (?:of )?'([^']+)')[,\s]*)* ?)?$/ do |state,size,name,start_date,end_date,user_range,description,nickname|
|
54
|
+
pending "#{state} #{size} #{name} #{start_date} #{end_date} #{user_range} #{description} #{nickname}"
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
#
|
59
|
+
# The highlighting replacement uses a span which had trouble when blindly using
|
60
|
+
# a gsub replacement.
|
61
|
+
#
|
62
|
+
Given /(a|\d+) ducks? that ha(?:s|ve) (a|\d+) bills?/ do |duck_count,bills_count|
|
63
|
+
pending
|
64
|
+
end
|
65
|
+
|
66
|
+
Then /I expect the (duck|bird) to (\w+)/ do |animal,verb|
|
67
|
+
pending
|
68
|
+
end
|
69
|
+
|
70
|
+
|
52
71
|
#
|
53
72
|
# Some details about the helper method that might be picked up in the documentation.
|
54
73
|
#
|
@@ -33,8 +33,13 @@ def highlight_matches(step)
|
|
33
33
|
value = h(step.value)
|
34
34
|
|
35
35
|
if step.definition
|
36
|
-
step.value.match(%r{#{step.definition.compare_value}})
|
37
|
-
|
36
|
+
matches = step.value.match(%r{#{step.definition.compare_value}})
|
37
|
+
|
38
|
+
if matches
|
39
|
+
matches[1..-1].reverse.each_with_index do |match,index|
|
40
|
+
next if match == nil
|
41
|
+
value[matches.begin((matches.size - 1) - index)..(matches.end((matches.size - 1) - index) - 1)] = "<span class='match'>#{match}</span>"
|
42
|
+
end
|
38
43
|
end
|
39
44
|
end
|
40
45
|
|
@@ -29,13 +29,7 @@ module YARD::CodeObjects::Cucumber
|
|
29
29
|
def transformed?
|
30
30
|
!@transforms.empty?
|
31
31
|
end
|
32
|
-
|
33
|
-
def compare_values
|
34
|
-
|
35
|
-
@scenario.example_hash.collect do |stub,replacements|
|
36
|
-
replacements.collect {|replace| value.gsub("<#{stub}>",replace) }
|
37
|
-
end.flatten
|
38
|
-
end
|
32
|
+
|
39
33
|
end
|
40
34
|
|
41
35
|
end
|
@@ -12,18 +12,20 @@ module YARD::CodeObjects
|
|
12
12
|
@value = format_source(value)
|
13
13
|
@constants = {}
|
14
14
|
@steps = []
|
15
|
+
@compare_value = nil
|
15
16
|
end
|
16
17
|
|
17
18
|
def compare_value
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
unless @compare_value
|
20
|
+
@compare_value = value.gsub(/^\/|\/$/,'')
|
21
|
+
@constants.each do |name,value|
|
22
|
+
@compare_value.gsub!(/\#\{\s*#{name.to_s}\s*\}/,value.gsub(/^\/|\/$/,''))
|
23
|
+
end
|
21
24
|
end
|
22
|
-
|
25
|
+
@compare_value
|
23
26
|
end
|
24
27
|
|
25
28
|
def _value_constants(data=@value)
|
26
|
-
#Hash[*data.scan(/\#\{([^\}]+)\}/).flatten.collect {|value| [value.strip,nil]}.flatten]
|
27
29
|
data.scan(/\#\{([^\}]+)\}/).flatten.collect { |value| value.strip }
|
28
30
|
end
|
29
31
|
|
@@ -61,11 +61,9 @@ module YARD
|
|
61
61
|
#log.debug "Looking at step #{step_value} against #{stepdef}"
|
62
62
|
|
63
63
|
if stepdef.compare_value =~ /.+\#\{[^\}]+\}.+/
|
64
|
-
log.warn "Step definition has
|
64
|
+
log.warn "Step definition still has a unpacked constant #{stepdef.compare_value}"
|
65
65
|
else
|
66
|
-
if %r{#{stepdef.compare_value}}.match(step_value)
|
67
|
-
return stepdef
|
68
|
-
end
|
66
|
+
return stepdef if %r{#{stepdef.compare_value}}.match(step_value)
|
69
67
|
end
|
70
68
|
end
|
71
69
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
class StepDefinitionHandler < YARD::Handlers::Ruby::Legacy::Base
|
4
4
|
#TODO: This needs to become language independent.
|
5
|
-
MATCH = /^((When|Given|And|Then)\s*(
|
5
|
+
MATCH = /^((When|Given|And|Then)\s*(\/.+\/)\s+do(?:\s\|.+\|)?\s*)$/
|
6
6
|
handles MATCH
|
7
7
|
|
8
8
|
@@unique_name = 0
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-in-the-yard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 1.5.
|
9
|
+
- 3
|
10
|
+
version: 1.5.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Franklin Webber
|