cucumber 0.10.6 → 0.10.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ [submodule "features/cucumber-features"]
2
+ path = features/cucumber-features
3
+ url = https://github.com/cucumber/cucumber-features
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cucumber (0.10.6)
4
+ cucumber (0.10.7)
5
5
  builder (>= 2.1.2)
6
6
  diff-lcs (>= 1.1.2)
7
7
  gherkin (~> 2.4.0)
@@ -11,12 +11,16 @@ PATH
11
11
  GEM
12
12
  remote: http://rubygems.org/
13
13
  specs:
14
- aruba (0.3.7)
14
+ aruba (0.4.1)
15
+ bcat (>= 0.6.1)
15
16
  childprocess (>= 0.1.9)
16
- cucumber (>= 0.10.5)
17
+ cucumber (>= 0.10.7)
18
+ rdiscount (>= 1.6.8)
17
19
  rspec (>= 2.6.0)
20
+ bcat (0.6.1)
21
+ rack (~> 1.0)
18
22
  builder (3.0.0)
19
- capybara (1.0.0.rc1)
23
+ capybara (1.0.0)
20
24
  mime-types (>= 1.16)
21
25
  nokogiri (>= 1.3.3)
22
26
  rack (>= 1.0.0)
@@ -31,10 +35,10 @@ GEM
31
35
  json (>= 1.4.6)
32
36
  innate (2011.04)
33
37
  rack (>= 1.1.0)
34
- json (1.5.1)
35
- json_pure (1.5.1)
38
+ json (1.5.2)
39
+ json_pure (1.5.2)
36
40
  mime-types (1.16)
37
- nokogiri (1.4.4)
41
+ nokogiri (1.4.5)
38
42
  prawn (0.8.4)
39
43
  prawn-core (< 0.9, >= 0.8.4)
40
44
  prawn-layout (< 0.9, >= 0.8.4)
@@ -85,7 +89,8 @@ PLATFORMS
85
89
  ruby
86
90
 
87
91
  DEPENDENCIES
88
- aruba (>= 0.3.7)
92
+ aruba (>= 0.4.1)
93
+ bcat (= 0.6.1)
89
94
  capybara (>= 1.0.0.rc1)
90
95
  cucumber!
91
96
  nokogiri (>= 1.4.4)
data/History.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [v0.10.7](https://github.com/cucumber/cucumber/compare/v0.10.6...v0.10.7)
2
+
3
+ ### New Features
4
+ * Rake task exits with an error if rcov is true and we're on Ruby 1.9.x (Aslak Hellesøy)
5
+ * Started implementation of cucumber-features (Mike Sassak, Julien Biezemans, Aslak Hellesøy)
6
+
1
7
  ## [v0.10.6](https://github.com/cucumber/cucumber/compare/v0.10.5...v0.10.6)
2
8
 
3
9
  ### New Features
data/README.md CHANGED
@@ -16,10 +16,9 @@ The documentation is at https://wiki.github.com/cucumber/cucumber/
16
16
 
17
17
  gem install bundler
18
18
  bundle install
19
+ git submodule update --init --recursive
19
20
  rake
20
21
 
21
- If you get errors about missing gems - just install them.
22
-
23
22
  ## Copyright
24
23
 
25
24
  Copyright (c) 2008,2009,2010,2011 Aslak Hellesøy. See LICENSE for details.
@@ -29,7 +29,7 @@ for important information about this release. Happy cuking!
29
29
  s.add_dependency 'diff-lcs', '>= 1.1.2'
30
30
  s.add_dependency 'json', '>= 1.4.6'
31
31
 
32
- s.add_development_dependency 'aruba', '>= 0.3.7'
32
+ s.add_development_dependency 'aruba', '>= 0.4.1'
33
33
  s.add_development_dependency 'rake', '>= 0.8.7'
34
34
  s.add_development_dependency 'rspec', '>= 2.6.0'
35
35
  s.add_development_dependency 'nokogiri', '>= 1.4.4'
@@ -38,16 +38,18 @@ for important information about this release. Happy cuking!
38
38
  s.add_development_dependency 'syntax', '>= 1.0.0'
39
39
  s.add_development_dependency 'spork', '>= 0.9.0.rc7'
40
40
  s.add_development_dependency 'simplecov', '>= 0.4.2'
41
+
41
42
  # For Documentation:
42
43
  s.add_development_dependency('yard', '= 0.7.1')
43
44
  s.add_development_dependency('rdiscount', '= 1.6.8')
45
+ s.add_development_dependency('bcat', '= 0.6.1')
44
46
 
45
47
  # Needed for examples (rake examples)
46
48
  s.add_development_dependency 'ramaze'
47
49
  s.add_development_dependency 'rack-test', '>= 0.5.7'
48
50
  s.add_development_dependency 'webrat', '>= 0.7.3'
49
51
  s.add_development_dependency 'sinatra', '>= 1.2.6'
50
- s.add_development_dependency 'capybara', '>= 1.0.0.rc1'
52
+ s.add_development_dependency 'capybara', '>= 1.0.0'
51
53
 
52
54
  s.rubygems_version = ">= 1.6.1"
53
55
  s.files = `git ls-files`.split("\n")
@@ -3,6 +3,7 @@ Feature: Bootstrapping a new project
3
3
  As a new cucumber user
4
4
  I want cucumber to give helpful error messages in basic situations
5
5
 
6
+ @announce
6
7
  Scenario: running cucumber against a non-existing feature file
7
8
  Given a directory without standard Cucumber project directory structure
8
9
  When I run `cucumber`
@@ -0,0 +1,143 @@
1
+ require 'erb'
2
+ CUCUMBER = File.dirname(__FILE__) + '/../../../bin/cucumber'
3
+
4
+ # TODO: Move all of this (except the ruby stepdef specific stepdefs) into cucumber-features
5
+ # This way all Cucumber implementations can use Aruba/Cucumber 1.x to for testing, and have Aruba reports.
6
+ module CucumberCoreHelpers
7
+ def scenario_with_steps(scenario_name, steps)
8
+ write_file("features/a_feature.feature", <<-EOF)
9
+ Feature: A feature
10
+ Scenario: #{scenario_name}
11
+ #{steps.gsub(/^/, ' ')}
12
+ EOF
13
+ end
14
+
15
+ def write_feature(feature)
16
+ write_file("features/a_feature.feature", feature)
17
+ end
18
+
19
+ def write_mappings(mappings)
20
+ mapping_code = mappings.raw.map do |pattern, result|
21
+ erb = ERB.new(<<-EOF, nil, '-')
22
+ Given /<%= pattern -%>/ do
23
+ <% if result == 'passing' -%>
24
+ File.open("<%= step_file(pattern) %>", "w")
25
+ <% elsif result == 'pending' -%>
26
+ File.open("<%= step_file(pattern) %>", "w")
27
+ pending
28
+ <% else -%>
29
+ File.open("<%= step_file(pattern) %>", "w")
30
+ raise "bang!"
31
+ <% end -%>
32
+ end
33
+ EOF
34
+ erb.result(binding)
35
+ end.join("\n")
36
+ write_file("features/step_definitions/some_stepdefs.rb", mapping_code)
37
+ end
38
+
39
+ def write_mappings_for_calculator
40
+ mapping_code = <<-EOF
41
+ Given /^a calculator$/ do
42
+ end
43
+
44
+ When /^the calculator computes PI$/ do
45
+ end
46
+
47
+ When /^the calculator adds up ([\\d\\.]+) and ([\\d\\.]+)$/ do |arg1, arg2|
48
+ end
49
+
50
+ When /^the calculator adds up "([^"]*)" and "([^"]*)"$/ do |arg1, arg2|
51
+ end
52
+
53
+ When /^the calculator adds up "([^"]*)", "([^"]*)" and "([^"]*)"$/ do |arg1, arg2, arg3|
54
+ end
55
+
56
+ When /^the calculator adds up the following numbers:$/ do |string|
57
+ end
58
+
59
+ Then /^the calculator returns PI$/ do
60
+ end
61
+
62
+ Then /^the calculator returns "([^"]*)"$/ do |arg1|
63
+ end
64
+
65
+ Then /^the calculator does not return ([\\d\\.]+)$/ do |arg1|
66
+ end
67
+
68
+ EOF
69
+ write_file("features/step_definitions/calculator_mappings.rb", mapping_code)
70
+ end
71
+
72
+ def step_file(pattern)
73
+ pattern.gsub(/ /, '_') + '.step'
74
+ end
75
+
76
+ def run_scenario(scenario_name)
77
+ run_simple "#{CUCUMBER} features/a_feature.feature --name '#{scenario_name}'", false
78
+ end
79
+
80
+ def run_feature
81
+ run_simple "#{CUCUMBER} features/a_feature.feature", false
82
+ end
83
+
84
+ def assert_skipped(pattern)
85
+ if File.exist?(File.join(current_dir, step_file(pattern)))
86
+ raise "#{pattern} was not skipped"
87
+ end
88
+ end
89
+ end
90
+
91
+ World(CucumberCoreHelpers)
92
+
93
+ Given /^a scenario "([^"]*)" with:$/ do |scenario_name, steps|
94
+ @scenario_name = scenario_name
95
+ scenario_with_steps(scenario_name, steps)
96
+ end
97
+
98
+ Given /^the following feature:$/ do |feature|
99
+ write_feature(feature)
100
+ end
101
+
102
+ When /^Cucumber executes "([^"]*)" with these step mappings:$/ do |scenario_name, mappings|
103
+ write_mappings(mappings)
104
+ run_scenario(scenario_name)
105
+ end
106
+
107
+ When /^Cucumber runs the feature$/ do
108
+ run_feature
109
+ end
110
+
111
+ When /^Cucumber runs the scenario with steps for a calculator$/ do
112
+ write_mappings_for_calculator
113
+ run_scenario(@scenario_name)
114
+ end
115
+
116
+ Then /^the scenario passes$/ do
117
+ assert_partial_output("1 scenario (1 passed)", all_stdout)
118
+ assert_success true
119
+ end
120
+
121
+ Then /^the scenario fails$/ do
122
+ assert_partial_output("1 scenario (1 failed)", all_stdout)
123
+ assert_success false
124
+ end
125
+
126
+ Then /^the scenario is pending$/ do
127
+ assert_partial_output("1 scenario (1 pending)", all_stdout)
128
+ assert_success true
129
+ end
130
+
131
+ Then /^the scenario is undefined$/ do
132
+ assert_partial_output("1 scenario (1 undefined)", all_stdout)
133
+ assert_success true
134
+ end
135
+
136
+ Then /^the step "([^"]*)" is skipped$/ do |pattern|
137
+ assert_skipped(pattern)
138
+ end
139
+
140
+ Then /^the feature passes$/ do
141
+ assert_no_partial_output("failed", all_stdout)
142
+ assert_success true
143
+ end
@@ -4,7 +4,7 @@ end
4
4
 
5
5
  Then /^it should (pass|fail) with JSON:$/ do |pass_fail, json|
6
6
  JSON.parse(all_stdout).should == JSON.parse(json)
7
- assert_exiting_with(pass_fail == 'pass')
7
+ assert_success(pass_fail == 'pass')
8
8
  end
9
9
 
10
10
  Given /^a directory without standard Cucumber project directory structure$/ do
@@ -1,28 +1,24 @@
1
+ ENV['FORCE_COLOR'] = 'true'
1
2
  require 'aruba/api'
3
+ require 'aruba/cucumber'
2
4
 
3
5
  # Monkey patch aruba to filter out some stuff
4
6
  module Aruba::Api
5
- alias _all_stdout all_stdout
7
+ alias __all_stdout all_stdout
6
8
 
7
9
  def all_stdout
8
- out = _all_stdout
10
+ unrandom(__all_stdout)
11
+ end
9
12
 
10
- # Remove absolute paths
11
- out.gsub!(/#{Dir.pwd}\/tmp\/aruba/, '.')
12
- # Make duration predictable
13
- out.gsub!(/^\d+m\d+\.\d+s$/, '0m0.012s')
14
- # Remove SimpleCov message
15
- out.gsub!(/Coverage report generated for Cucumber Features to #{Dir.pwd}\/coverage.*\n$/, '')
16
-
13
+ def unrandom(out)
17
14
  out
15
+ .gsub(/#{Dir.pwd}\/tmp\/aruba/, '.') # Remove absolute paths
16
+ .gsub(/^\d+m\d+\.\d+s$/, '0m0.012s') # Make duration predictable
17
+ .gsub(/Coverage report generated for Cucumber Features to #{Dir.pwd}\/coverage.*\n$/, '') # Remove SimpleCov message
18
18
  end
19
19
  end
20
20
 
21
- require 'aruba/cucumber'
22
-
23
- Before do |scenario|
24
- @scenario = scenario
25
-
21
+ Before do
26
22
  # Make sure bin/cucumber runs with SimpleCov enabled
27
23
  # set_env('SIMPLECOV', 'true')
28
24
 
@@ -0,0 +1,14 @@
1
+ echo 'Commits'
2
+ git log --pretty=format:'' | wc -l
3
+
4
+ echo 'Contributors'
5
+ git log --pretty=short --no-merges | git shortlog -ne | egrep -ve '^ +' | egrep -ve '^$' | wc -l
6
+
7
+ echo 'Resolved bugs/feature requests'
8
+ egrep -e '^\*' History.md | wc -l
9
+
10
+ echo 'Open tickets'
11
+ curl -s http://github.com/api/v2/json/issues/list/cucumber/cucumber/open | ruby -e "require 'json'; puts JSON.parse(STDIN.read)['issues'].length"
12
+
13
+ echo 'Group members'
14
+ curl -s http://groups.google.com/group/cukes | grep Members
@@ -1,13 +1,15 @@
1
1
  require 'cucumber/ast/feature_element'
2
+ require 'cucumber/ast/names'
2
3
 
3
4
  module Cucumber
4
5
  module Ast
5
6
  class Background #:nodoc:
6
7
  include FeatureElement
7
- attr_reader :feature_elements, :name
8
+ include Names
9
+ attr_reader :feature_elements
8
10
 
9
- def initialize(comment, line, keyword, name, raw_steps)
10
- @comment, @line, @keyword, @name, @raw_steps = comment, line, keyword, name, raw_steps
11
+ def initialize(comment, line, keyword, title, description, raw_steps)
12
+ @comment, @line, @keyword, @title, @description, @raw_steps = comment, line, keyword, title, description, raw_steps
11
13
  @feature_elements = []
12
14
  end
13
15
 
@@ -32,7 +34,7 @@ module Cucumber
32
34
  return if Cucumber.wants_to_quit
33
35
  init
34
36
  visitor.visit_comment(@comment) unless @comment.empty?
35
- visitor.visit_background_name(@keyword, @name, file_colon_line(@line), source_indent(first_line_length))
37
+ visitor.visit_background_name(@keyword, name, file_colon_line(@line), source_indent(first_line_length))
36
38
  with_visitor(hook_context, visitor) do
37
39
  visitor.step_mother.before(hook_context)
38
40
  skip_invoke! if failed?
@@ -79,7 +81,7 @@ module Cucumber
79
81
  def to_sexp
80
82
  init
81
83
  sexp = [:background, @line, @keyword]
82
- sexp += [@name] unless @name.empty?
84
+ sexp += [name] unless name.empty?
83
85
  comment = @comment.to_sexp
84
86
  sexp += [comment] if comment
85
87
  steps = @steps.to_sexp
@@ -1,10 +1,13 @@
1
+ require 'cucumber/ast/names'
2
+
1
3
  module Cucumber
2
4
  module Ast
3
5
  class Examples #:nodoc:
6
+ include Names
4
7
  attr_writer :outline_table
5
8
 
6
- def initialize(comment, line, keyword, name, outline_table)
7
- @comment, @keyword, @name, @outline_table = comment, keyword, name, outline_table
9
+ def initialize(comment, line, keyword, title, description, outline_table)
10
+ @comment, @keyword, @title, @description, @outline_table = comment, keyword, title, description, outline_table
8
11
  end
9
12
 
10
13
  attr_reader :gherkin_statement
@@ -15,7 +18,7 @@ module Cucumber
15
18
  def accept(visitor)
16
19
  return if Cucumber.wants_to_quit
17
20
  visitor.visit_comment(@comment) unless @comment.empty?
18
- visitor.visit_examples_name(@keyword, @name)
21
+ visitor.visit_examples_name(@keyword, name)
19
22
  visitor.visit_outline_table(@outline_table)
20
23
  end
21
24
 
@@ -32,7 +35,7 @@ module Cucumber
32
35
  end
33
36
 
34
37
  def to_sexp
35
- sexp = [:examples, @keyword, @name]
38
+ sexp = [:examples, @keyword, name]
36
39
  comment = @comment.to_sexp
37
40
  sexp += [comment] if comment
38
41
  sexp += [@outline_table.to_sexp]
@@ -1,14 +1,17 @@
1
+ require 'cucumber/ast/names'
2
+
1
3
  module Cucumber
2
4
  module Ast
3
5
  # Represents the root node of a parsed feature.
4
6
  class Feature #:nodoc:
7
+ include Names
8
+
5
9
  attr_accessor :language
6
10
  attr_writer :features, :background
7
11
  attr_reader :file
8
- attr_reader :name
9
12
 
10
- def initialize(background, comment, tags, keyword, name, feature_elements)
11
- @background, @comment, @tags, @keyword, @name, @feature_elements = background, comment, tags, keyword, name.strip, feature_elements
13
+ def initialize(background, comment, tags, keyword, title, description, feature_elements)
14
+ @background, @comment, @tags, @keyword, @title, @description, @feature_elements = background, comment, tags, keyword, title, description, feature_elements
12
15
  end
13
16
 
14
17
  attr_reader :gherkin_statement
@@ -43,7 +46,7 @@ module Cucumber
43
46
 
44
47
  def indented_name
45
48
  indent = ""
46
- @name.split("\n").map do |l|
49
+ name.split("\n").map do |l|
47
50
  s = "#{indent}#{l}"
48
51
  indent = " "
49
52
  s
@@ -89,7 +92,7 @@ module Cucumber
89
92
 
90
93
  def to_sexp
91
94
  init
92
- sexp = [:feature, @file, @name]
95
+ sexp = [:feature, @file, name]
93
96
  comment = @comment.to_sexp
94
97
  sexp += [comment] if comment
95
98
  tags = @tags.to_sexp
@@ -6,7 +6,7 @@ module Cucumber
6
6
  module FeatureElement #:nodoc:
7
7
  attr_accessor :feature
8
8
 
9
- attr_reader :gherkin_statement, :raw_steps
9
+ attr_reader :gherkin_statement, :raw_steps, :title, :description
10
10
  def gherkin_statement(statement=nil)
11
11
  @gherkin_statement ||= statement
12
12
  end
@@ -32,10 +32,10 @@ module Cucumber
32
32
  end
33
33
 
34
34
  def name_line_lengths
35
- if @name.strip.empty?
35
+ if name.strip.empty?
36
36
  [Ast::Step::INDENT + @keyword.unpack('U*').length + ': '.length]
37
37
  else
38
- @name.split("\n").enum_for(:each_with_index).map do |line, line_number|
38
+ name.split("\n").enum_for(:each_with_index).map do |line, line_number|
39
39
  if line_number == 0
40
40
  Ast::Step::INDENT + @keyword.unpack('U*').length + ': '.length + line.unpack('U*').length
41
41
  else
@@ -46,10 +46,10 @@ module Cucumber
46
46
  end
47
47
 
48
48
  def matches_scenario_names?(scenario_name_regexps)
49
- scenario_name_regexps.detect{|name| name =~ @name}
49
+ scenario_name_regexps.detect{|n| n =~ name}
50
50
  end
51
51
 
52
- def backtrace_line(name = "#{@keyword}: #{@name}", line = @line)
52
+ def backtrace_line(name = "#{@keyword}: #{name}", line = @line)
53
53
  @feature.backtrace_line(name, line) if @feature
54
54
  end
55
55
 
@@ -0,0 +1,13 @@
1
+ module Cucumber
2
+ module Ast
3
+ module Names
4
+ attr_reader :title, :description
5
+
6
+ def name
7
+ s = @title
8
+ s += "\n#{@description}" if @description != ""
9
+ s
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,11 +1,13 @@
1
1
  require 'cucumber/ast/feature_element'
2
+ require 'cucumber/ast/names'
2
3
 
3
4
  module Cucumber
4
5
  module Ast
5
6
  class Scenario #:nodoc:
6
7
  include FeatureElement
8
+ include Names
7
9
 
8
- attr_reader :name, :line
10
+ attr_reader :line
9
11
 
10
12
  class EmptyBackground
11
13
  def failed?
@@ -24,9 +26,9 @@ module Cucumber
24
26
  end
25
27
  end
26
28
 
27
- def initialize(background, comment, tags, line, keyword, name, raw_steps)
29
+ def initialize(background, comment, tags, line, keyword, title, description, raw_steps)
28
30
  @background = background || EmptyBackground.new
29
- @comment, @tags, @line, @keyword, @name, @raw_steps = comment, tags, line, keyword, name, raw_steps
31
+ @comment, @tags, @line, @keyword, @title, @description, @raw_steps = comment, tags, line, keyword, title, description, raw_steps
30
32
  @exception = @executed = nil
31
33
  end
32
34
 
@@ -45,7 +47,7 @@ module Cucumber
45
47
  with_visitor(visitor) do
46
48
  visitor.visit_comment(@comment) unless @comment.empty?
47
49
  visitor.visit_tags(@tags)
48
- visitor.visit_scenario_name(@keyword, @name, file_colon_line(@line), source_indent(first_line_length))
50
+ visitor.visit_scenario_name(@keyword, name, file_colon_line(@line), source_indent(first_line_length))
49
51
 
50
52
  skip_invoke! if @background.failed?
51
53
  visitor.step_mother.with_hooks(self, skip_hooks?) do
@@ -90,7 +92,7 @@ module Cucumber
90
92
  end
91
93
 
92
94
  def to_sexp
93
- sexp = [:scenario, @line, @keyword, @name]
95
+ sexp = [:scenario, @line, @keyword, name]
94
96
  comment = @comment.to_sexp
95
97
  sexp += [comment] if comment
96
98
  tags = @tags.to_sexp
@@ -1,10 +1,12 @@
1
+ require 'cucumber/ast/feature_element'
2
+ require 'cucumber/ast/names'
3
+
1
4
  module Cucumber
2
5
  module Ast
3
6
  class ScenarioOutline #:nodoc:
4
7
  include FeatureElement
8
+ include Names
5
9
 
6
- attr_reader :name
7
-
8
10
  module ExamplesArray #:nodoc:
9
11
  def accept(visitor)
10
12
  return if Cucumber.wants_to_quit
@@ -20,8 +22,8 @@ module Cucumber
20
22
  # * Examples keyword
21
23
  # * Examples section name
22
24
  # * Raw matrix
23
- def initialize(background, comment, tags, line, keyword, name, raw_steps, example_sections)
24
- @background, @comment, @tags, @line, @keyword, @name, @raw_steps, @example_sections = background, comment, tags, line, keyword, name, raw_steps, example_sections
25
+ def initialize(background, comment, tags, line, keyword, title, description, raw_steps, example_sections)
26
+ @background, @comment, @tags, @line, @keyword, @title, @description, @raw_steps, @example_sections = background, comment, tags, line, keyword, title, description, raw_steps, example_sections
25
27
  end
26
28
 
27
29
  def add_examples(example_section, gherkin_examples)
@@ -37,14 +39,15 @@ module Cucumber
37
39
  example_section = example_section_and_gherkin_examples[0]
38
40
  gherkin_examples = example_section_and_gherkin_examples[1]
39
41
 
40
- examples_comment = example_section[0]
41
- examples_line = example_section[1]
42
- examples_keyword = example_section[2]
43
- examples_name = example_section[3]
44
- examples_matrix = example_section[4]
42
+ examples_comment = example_section[0]
43
+ examples_line = example_section[1]
44
+ examples_keyword = example_section[2]
45
+ examples_title = example_section[3]
46
+ examples_description = example_section[4]
47
+ examples_matrix = example_section[5]
45
48
 
46
49
  examples_table = OutlineTable.new(examples_matrix, self)
47
- ex = Examples.new(examples_comment, examples_line, examples_keyword, examples_name, examples_table)
50
+ ex = Examples.new(examples_comment, examples_line, examples_keyword, examples_title, examples_description, examples_table)
48
51
  ex.gherkin_statement(gherkin_examples)
49
52
  ex
50
53
  end
@@ -58,7 +61,7 @@ module Cucumber
58
61
  return if Cucumber.wants_to_quit
59
62
  visitor.visit_comment(@comment) unless @comment.empty?
60
63
  visitor.visit_tags(@tags)
61
- visitor.visit_scenario_name(@keyword, @name, file_colon_line(@line), source_indent(first_line_length))
64
+ visitor.visit_scenario_name(@keyword, name, file_colon_line(@line), source_indent(first_line_length))
62
65
  visitor.visit_steps(@steps)
63
66
 
64
67
  skip_invoke! if @background && @background.failed?
@@ -107,7 +110,7 @@ module Cucumber
107
110
 
108
111
  def to_sexp
109
112
  init
110
- sexp = [:scenario_outline, @keyword, @name]
113
+ sexp = [:scenario_outline, @keyword, name]
111
114
  comment = @comment.to_sexp
112
115
  sexp += [comment] if comment
113
116
  tags = @tags.to_sexp
@@ -74,7 +74,6 @@ module Cucumber
74
74
  def initialize(raw, conversion_procs = NULL_CONVERSIONS.dup)
75
75
  @cells_class = Cells
76
76
  @cell_class = Cell
77
-
78
77
  raw = ensure_array_of_array(rubify(raw))
79
78
  # Verify that it's square
80
79
  transposed = raw.transpose
@@ -22,6 +22,7 @@ if Cucumber::WINDOWS_MRI
22
22
  end
23
23
 
24
24
  Term::ANSIColor.coloring = false if !STDOUT.tty? && !ENV.has_key?("AUTOTEST")
25
+ Term::ANSIColor.coloring = true if ENV.has_key?("FORCE_COLOR")
25
26
 
26
27
  module Cucumber
27
28
  module Formatter
@@ -21,17 +21,21 @@ module Cucumber
21
21
  @file_names = []
22
22
  @file_colon_lines = Hash.new{|h,k| h[k] = []}
23
23
  end
24
-
25
- # features() is never executed at all... ?
26
- def after_features(features)
27
- files = @file_names.uniq.map do |file|
28
- lines = @file_colon_lines[file]
29
- "#{file}:#{lines.join(':')}"
24
+
25
+ def before_feature(*)
26
+ @lines = []
27
+ @file = nil
28
+ end
29
+
30
+ def after_feature(*)
31
+ after_first_time do
32
+ @io.print ' '
30
33
  end
31
- @io.puts files.join(' ')
32
-
33
- # Flusing output to rerun tempfile here...
34
+ @io.print "#{@file}:#{@lines.join(':')}"
34
35
  @io.flush
36
+ end
37
+
38
+ def after_features(features)
35
39
  @io.close
36
40
  end
37
41
 
@@ -42,14 +46,21 @@ module Cucumber
42
46
  def after_feature_element(feature_element)
43
47
  if @rerun
44
48
  file, line = *feature_element.file_colon_line.split(':')
45
- @file_colon_lines[file] << line
46
- @file_names << file
49
+ @lines << line
50
+ @file = file
47
51
  end
48
52
  end
49
53
 
50
54
  def step_name(keyword, step_match, status, source_indent, background)
51
55
  @rerun = true if [:failed, :pending, :undefined].index(status)
52
56
  end
57
+
58
+ private
59
+
60
+ def after_first_time
61
+ yield if @not_first_time
62
+ @not_first_time = true
63
+ end
53
64
  end
54
65
  end
55
66
  end
@@ -19,7 +19,8 @@ module Cucumber
19
19
  Ast::Comment.new(feature.comments.map{|comment| comment.value}.join("\n")),
20
20
  Ast::Tags.new(nil, feature.tags.map{|tag| tag.name}),
21
21
  feature.keyword,
22
- legacy_name_for(feature.name, feature.description),
22
+ feature.name.lstrip,
23
+ feature.description.rstrip,
23
24
  []
24
25
  )
25
26
  @feature.gherkin_statement(feature)
@@ -31,7 +32,8 @@ module Cucumber
31
32
  Ast::Comment.new(background.comments.map{|comment| comment.value}.join("\n")),
32
33
  background.line,
33
34
  background.keyword,
34
- legacy_name_for(background.name, background.description),
35
+ background.name,
36
+ background.description,
35
37
  steps=[]
36
38
  )
37
39
  @feature.background = @background
@@ -47,7 +49,8 @@ module Cucumber
47
49
  Ast::Tags.new(nil, statement.tags.map{|tag| tag.name}),
48
50
  statement.line,
49
51
  statement.keyword,
50
- legacy_name_for(statement.name, statement.description),
52
+ statement.name,
53
+ statement.description,
51
54
  steps=[]
52
55
  )
53
56
  @feature.add_feature_element(scenario)
@@ -63,7 +66,8 @@ module Cucumber
63
66
  Ast::Tags.new(nil, statement.tags.map{|tag| tag.name}),
64
67
  statement.line,
65
68
  statement.keyword,
66
- legacy_name_for(statement.name, statement.description),
69
+ statement.name,
70
+ statement.description,
67
71
  steps=[],
68
72
  example_sections=[]
69
73
  )
@@ -81,7 +85,8 @@ module Cucumber
81
85
  Ast::Comment.new(examples.comments.map{|comment| comment.value}.join("\n")),
82
86
  examples.line,
83
87
  examples.keyword,
84
- legacy_name_for(examples.name, examples.description),
88
+ examples.name,
89
+ examples.description,
85
90
  matrix(examples.rows)
86
91
  ]
87
92
  @step_container.add_examples(examples_fields, examples)
@@ -109,12 +114,6 @@ module Cucumber
109
114
 
110
115
  private
111
116
 
112
- def legacy_name_for(name, description)
113
- s = name
114
- s += "\n#{description}" if description != ""
115
- s
116
- end
117
-
118
117
  def matrix(gherkin_table)
119
118
  gherkin_table.map do |gherkin_row|
120
119
  row = gherkin_row.cells
@@ -4,7 +4,7 @@ require 'rbconfig'
4
4
 
5
5
  module Cucumber
6
6
  unless defined?(Cucumber::VERSION)
7
- VERSION = '0.10.6'
7
+ VERSION = '0.10.7'
8
8
  BINARY = File.expand_path(File.dirname(__FILE__) + '/../../bin/cucumber')
9
9
  LIBDIR = File.expand_path(File.dirname(__FILE__) + '/../../lib')
10
10
  JRUBY = defined?(JRUBY_VERSION)
@@ -1,4 +1,5 @@
1
1
  require 'cucumber/platform'
2
+ require 'gherkin/formatter/ansi_escapes'
2
3
 
3
4
  begin
4
5
  # Support Rake > 0.8.7
@@ -32,6 +33,8 @@ module Cucumber
32
33
  #
33
34
  # See the attributes for additional configuration possibilities.
34
35
  class Task
36
+ include Gherkin::Formatter::AnsiEscapes
37
+
35
38
  class InProcessCucumberRunner #:nodoc:
36
39
  attr_reader :args
37
40
 
@@ -137,6 +140,12 @@ module Cucumber
137
140
  # Run cucumber with RCov? Defaults to false. If you set this to
138
141
  # true, +fork+ is implicit.
139
142
  attr_accessor :rcov
143
+ def rcov=(flag)
144
+ if(flag && Cucumber::RUBY_1_9)
145
+ raise failed + "RCov only works on Ruby 1.8.x. You may want to use SimpleCov: https://github.com/colszowka/simplecov" + reset
146
+ end
147
+ @rcov = flag
148
+ end
140
149
 
141
150
  # Extra options to pass to rcov.
142
151
  # It's recommended to pass an Array, but if it's a String it will be #split by ' '.
@@ -29,7 +29,8 @@ module Cucumber
29
29
  comment=Comment.new(''),
30
30
  line=2,
31
31
  keyword="",
32
- name="",
32
+ title="",
33
+ description="",
33
34
  steps=[
34
35
  Step.new(7, "Given", "y is 5")
35
36
  ])
@@ -40,7 +41,8 @@ module Cucumber
40
41
  tags=Tags.new(98,[]),
41
42
  line=99,
42
43
  keyword="",
43
- name="",
44
+ title="",
45
+ description="",
44
46
  steps=[]
45
47
  )
46
48
  background.feature = @feature
@@ -55,7 +57,8 @@ module Cucumber
55
57
  comment=Comment.new(''),
56
58
  line=2,
57
59
  keyword="",
58
- name="background name",
60
+ title="background name",
61
+ description="",
59
62
  steps=[])
60
63
  lambda{ background.name }.should_not raise_error
61
64
  background.name.should == 'background name'
@@ -65,7 +68,8 @@ module Cucumber
65
68
  comment=Comment.new(''),
66
69
  line=2,
67
70
  keyword="",
68
- name=nil,
71
+ title="",
72
+ description="",
69
73
  steps=[])
70
74
  lambda{ background.name }.should_not raise_error
71
75
  end
@@ -85,7 +89,8 @@ module Cucumber
85
89
  comment=Comment.new(''),
86
90
  line=2,
87
91
  keyword="",
88
- name="",
92
+ title="",
93
+ description="",
89
94
  steps=[
90
95
  Step.new(7, "Given", "y is 5")
91
96
  ])
@@ -26,7 +26,7 @@ module Cucumber
26
26
  ])
27
27
  doc_string = Ast::DocString.new(%{\n I like\nCucumber sandwich\n})
28
28
 
29
- background = Ast::Background.new(Ast::Comment.new(""), 2, "Background:", "",
29
+ background = Ast::Background.new(Ast::Comment.new(""), 2, "Background:", "", "",
30
30
  [
31
31
  Step.new(3, "Given", "a passing step")
32
32
  ]
@@ -38,12 +38,13 @@ module Cucumber
38
38
  Ast::Tags.new(6, ['one', 'two']),
39
39
  "Feature",
40
40
  "Pretty printing",
41
+ "",
41
42
  [Ast::Scenario.new(
42
43
  background,
43
44
  Ast::Comment.new(" # My scenario comment \n# On two lines \n"),
44
45
  Ast::Tags.new(8, ['three', 'four']),
45
46
  9,
46
- "Scenario:", "A Scenario",
47
+ "Scenario:", "A Scenario", "",
47
48
  [
48
49
  Step.new(10, "Given", "a passing step with an inline arg:", table),
49
50
  Step.new(11, "Given", "a happy step with an inline arg:", doc_string),
@@ -31,7 +31,7 @@ module Cucumber
31
31
  Comment.new(""),
32
32
  Tags.new(18, []),
33
33
  19,
34
- "Scenario:", "My outline",
34
+ "Scenario:", "My outline", "",
35
35
  [
36
36
  Step.new(20, 'Given', 'there are <start> cucumbers'),
37
37
  Step.new(21, 'When', 'I eat <eat> cucumbers'),
@@ -45,6 +45,7 @@ module Cucumber
45
45
  24,
46
46
  'Examples:',
47
47
  'First table',
48
+ '',
48
49
  [
49
50
  %w{start eat left},
50
51
  %w{12 5 7},
@@ -26,7 +26,8 @@ module Cucumber
26
26
  tags=Tags.new(98, []),
27
27
  line=99,
28
28
  keyword="",
29
- name="",
29
+ title="",
30
+ description="",
30
31
  steps=[
31
32
  Step.new(7, "Given", "this is missing"),
32
33
  Step.new(8, "Given", "y is 5")
@@ -8,4 +8,4 @@ Bundler.setup
8
8
 
9
9
  require 'cucumber'
10
10
  $KCODE='u' unless Cucumber::RUBY_1_9
11
- Term::ANSIColor.coloring = true
11
+ ENV['FORCE_COLOR'] = 'true'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cucumber
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.10.6
5
+ version: 0.10.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - "Aslak Helles\xC3\xB8y"
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-07 00:00:00 +01:00
13
+ date: 2011-06-17 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -76,7 +76,7 @@ dependencies:
76
76
  requirements:
77
77
  - - ">="
78
78
  - !ruby/object:Gem::Version
79
- version: 0.3.7
79
+ version: 0.4.1
80
80
  type: :development
81
81
  version_requirements: *id006
82
82
  - !ruby/object:Gem::Dependency
@@ -190,60 +190,71 @@ dependencies:
190
190
  type: :development
191
191
  version_requirements: *id016
192
192
  - !ruby/object:Gem::Dependency
193
- name: ramaze
193
+ name: bcat
194
194
  prerelease: false
195
195
  requirement: &id017 !ruby/object:Gem::Requirement
196
196
  none: false
197
197
  requirements:
198
- - - ">="
198
+ - - "="
199
199
  - !ruby/object:Gem::Version
200
- version: "0"
200
+ version: 0.6.1
201
201
  type: :development
202
202
  version_requirements: *id017
203
203
  - !ruby/object:Gem::Dependency
204
- name: rack-test
204
+ name: ramaze
205
205
  prerelease: false
206
206
  requirement: &id018 !ruby/object:Gem::Requirement
207
207
  none: false
208
208
  requirements:
209
209
  - - ">="
210
210
  - !ruby/object:Gem::Version
211
- version: 0.5.7
211
+ version: "0"
212
212
  type: :development
213
213
  version_requirements: *id018
214
214
  - !ruby/object:Gem::Dependency
215
- name: webrat
215
+ name: rack-test
216
216
  prerelease: false
217
217
  requirement: &id019 !ruby/object:Gem::Requirement
218
218
  none: false
219
219
  requirements:
220
220
  - - ">="
221
221
  - !ruby/object:Gem::Version
222
- version: 0.7.3
222
+ version: 0.5.7
223
223
  type: :development
224
224
  version_requirements: *id019
225
225
  - !ruby/object:Gem::Dependency
226
- name: sinatra
226
+ name: webrat
227
227
  prerelease: false
228
228
  requirement: &id020 !ruby/object:Gem::Requirement
229
229
  none: false
230
230
  requirements:
231
231
  - - ">="
232
232
  - !ruby/object:Gem::Version
233
- version: 1.2.6
233
+ version: 0.7.3
234
234
  type: :development
235
235
  version_requirements: *id020
236
236
  - !ruby/object:Gem::Dependency
237
- name: capybara
237
+ name: sinatra
238
238
  prerelease: false
239
239
  requirement: &id021 !ruby/object:Gem::Requirement
240
240
  none: false
241
241
  requirements:
242
242
  - - ">="
243
243
  - !ruby/object:Gem::Version
244
- version: 1.0.0.rc1
244
+ version: 1.2.6
245
245
  type: :development
246
246
  version_requirements: *id021
247
+ - !ruby/object:Gem::Dependency
248
+ name: capybara
249
+ prerelease: false
250
+ requirement: &id022 !ruby/object:Gem::Requirement
251
+ none: false
252
+ requirements:
253
+ - - ">="
254
+ - !ruby/object:Gem::Version
255
+ version: 1.0.0
256
+ type: :development
257
+ version_requirements: *id022
247
258
  description: Behaviour Driven Development with elegance and joy
248
259
  email: cukes@googlegroups.com
249
260
  executables:
@@ -255,6 +266,7 @@ extra_rdoc_files: []
255
266
  files:
256
267
  - .gitattributes
257
268
  - .gitignore
269
+ - .gitmodules
258
270
  - .rspec
259
271
  - .rvmrc
260
272
  - .travis.yml
@@ -523,6 +535,7 @@ files:
523
535
  - features/iso-8859-1.feature
524
536
  - features/json_formatter.feature
525
537
  - features/stats_formatters.feature
538
+ - features/step_definitions/cucumber-features/core_steps.rb
526
539
  - features/step_definitions/cucumber_steps.rb
527
540
  - features/step_definitions/iso-8859-1_steps.rb
528
541
  - features/support/env.rb
@@ -604,6 +617,7 @@ files:
604
617
  - gem_tasks/flog.rake
605
618
  - gem_tasks/rspec.rake
606
619
  - gem_tasks/sass.rake
620
+ - gem_tasks/stats
607
621
  - gem_tasks/versions.txt
608
622
  - gem_tasks/yard.rake
609
623
  - gem_tasks/yard/default/layout/html/bubble_32x32.png
@@ -682,6 +696,7 @@ files:
682
696
  - lib/cucumber/ast/feature.rb
683
697
  - lib/cucumber/ast/feature_element.rb
684
698
  - lib/cucumber/ast/features.rb
699
+ - lib/cucumber/ast/names.rb
685
700
  - lib/cucumber/ast/outline_table.rb
686
701
  - lib/cucumber/ast/scenario.rb
687
702
  - lib/cucumber/ast/scenario_outline.rb
@@ -797,7 +812,6 @@ files:
797
812
  - spec/cucumber/formatter/spec_helper.rb
798
813
  - spec/cucumber/rake/forked_spec.rb
799
814
  - spec/cucumber/rake/rcov_spec.rb
800
- - spec/cucumber/rake/task_spec.rb
801
815
  - spec/cucumber/rb_support/rb_language_spec.rb
802
816
  - spec/cucumber/rb_support/rb_step_definition_spec.rb
803
817
  - spec/cucumber/rb_support/rb_transform_spec.rb
@@ -820,7 +834,7 @@ licenses: []
820
834
 
821
835
  post_install_message: "\n\
822
836
  (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n\
823
- Thank you for installing cucumber-0.10.6.\n\
837
+ Thank you for installing cucumber-0.10.7.\n\
824
838
  Please be sure to read http://wiki.github.com/cucumber/cucumber/upgrading\n\
825
839
  for important information about this release. Happy cuking!\n\n\
826
840
  (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n"
@@ -846,7 +860,7 @@ rubyforge_project:
846
860
  rubygems_version: 1.6.2
847
861
  signing_key:
848
862
  specification_version: 3
849
- summary: cucumber-0.10.6
863
+ summary: cucumber-0.10.7
850
864
  test_files:
851
865
  - features/background.feature
852
866
  - features/bootstrap.feature
@@ -856,6 +870,7 @@ test_files:
856
870
  - features/iso-8859-1.feature
857
871
  - features/json_formatter.feature
858
872
  - features/stats_formatters.feature
873
+ - features/step_definitions/cucumber-features/core_steps.rb
859
874
  - features/step_definitions/cucumber_steps.rb
860
875
  - features/step_definitions/iso-8859-1_steps.rb
861
876
  - features/support/env.rb
@@ -887,7 +902,6 @@ test_files:
887
902
  - spec/cucumber/formatter/spec_helper.rb
888
903
  - spec/cucumber/rake/forked_spec.rb
889
904
  - spec/cucumber/rake/rcov_spec.rb
890
- - spec/cucumber/rake/task_spec.rb
891
905
  - spec/cucumber/rb_support/rb_language_spec.rb
892
906
  - spec/cucumber/rb_support/rb_step_definition_spec.rb
893
907
  - spec/cucumber/rb_support/rb_transform_spec.rb
@@ -1,22 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
- require 'cucumber/rake/task'
3
- require 'rake'
4
-
5
- module Cucumber
6
- module Rake
7
-
8
- describe Task do
9
-
10
- context "when running rcov" do
11
- let(:task) { Task.new { |t| t.rcov = true } }
12
-
13
- it "correctly builds an RCovCucumberRunner" do
14
- runner = task.runner
15
- runner.should be_a(Task::RCovCucumberRunner)
16
- end
17
-
18
- end
19
- end
20
-
21
- end
22
- end