aslakhellesoy-cucumber 0.1.99.22 → 0.1.99.23

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.
Files changed (30) hide show
  1. data/History.txt +5 -1
  2. data/Manifest.txt +7 -1
  3. data/examples/i18n/ar/features/addition.feature +10 -11
  4. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +0 -4
  5. data/examples/i18n/et/features/liitmine.feature +2 -3
  6. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +3 -3
  7. data/examples/i18n/et/lib/kalkulaator.rb +5 -1
  8. data/examples/i18n/ru/Rakefile +6 -0
  9. data/examples/i18n/ru/features/addition.feature +10 -0
  10. data/examples/i18n/ru/features/consecutive_calculations.feature +16 -0
  11. data/examples/i18n/ru/features/division.feature +15 -0
  12. data/examples/i18n/ru/features/step_definitons/calculator_steps.rb +19 -0
  13. data/examples/i18n/ru/features/support/env.rb +6 -0
  14. data/examples/i18n/ru/features/support/world.rb +7 -0
  15. data/examples/i18n/ru/lib/calculator.rb +24 -0
  16. data/examples/self_test/features/failing_expectation.feature +4 -0
  17. data/examples/sinatra/features/step_definitions/add_steps.rb +1 -1
  18. data/examples/sinatra/features/support/env.rb +4 -4
  19. data/features/cucumber_cli.feature +18 -0
  20. data/features/cucumber_cli_diff_disabled.feature +45 -0
  21. data/lib/cucumber/ast/table.rb +64 -11
  22. data/lib/cucumber/cli/main.rb +1 -1
  23. data/lib/cucumber/languages.yml +10 -2
  24. data/lib/cucumber/rake/task.rb +3 -3
  25. data/lib/cucumber/version.rb +1 -1
  26. data/spec/cucumber/ast/table_spec.rb +35 -4
  27. data/spec/cucumber/cli/main_spec.rb +1 -1
  28. data/spec/cucumber/formatter/color_io_spec.rb +26 -0
  29. metadata +13 -2
  30. data/examples/selenium/features/step_definitons/stories_steps.rb +0 -40
data/History.txt CHANGED
@@ -79,6 +79,8 @@ pure Ruby users have been enjoying for a while.
79
79
  ** Full jar and simple jar
80
80
 
81
81
  == Bugfixes
82
+ * --strict always exits with status 1 (#230 Tim Cuthbertson)
83
+ * Fix error with nil values in tables raising an exception (#227 Joseph Wilk)
82
84
  * Add support for using << in formatters to ensure the html formatter works (#210 Joseph Wilk)
83
85
  * Explicitly require env.rb files first to avoid potential load order problems. (#213, Ben Mabey, Randy Harmon)
84
86
  * Depend on polyglot version (0.2.4) to avoid masking require errors. (Aslak Hellesøy).
@@ -94,9 +96,11 @@ pure Ruby users have been enjoying for a while.
94
96
  * Pending steps in > steps called from steps (#65 Aslak Hellesøy)
95
97
 
96
98
  === New features
99
+ * Added Table#transpose to to allow use of vertically aligned table keys (Torbjørn Vatn, Aslak Hellesøy)
100
+ * Added Table#map_headers to to allow use of more readable headers (Rob Holland)
97
101
  * New -S/--step-definitions option. Useful (among other things) for tools that implement automcompletion. (#208 Aslak Hellesøy).
98
102
  * The cucumber.rake file defines a dummy :features task if Cucumber is not installed (#225 Josh Nichols)
99
- * Added map_column to AST tables to ease casting of cell values into relevant types (#223 Rob Holland)
103
+ * Added map_column! to AST tables to ease casting of cell values into relevant types (#223 Rob Holland)
100
104
  Given /^an expense report for (.*) with the following posts:$/ do |date, posts_table|
101
105
  posts_table.map_column!('amount') { |a| a.to_i }
102
106
  posts_table.hashes.each do |post|
data/Manifest.txt CHANGED
@@ -40,6 +40,7 @@ examples/i18n/es/features/adicion.feature
40
40
  examples/i18n/es/features/step_definitons/calculador_steps.rb
41
41
  examples/i18n/es/lib/calculador.rb
42
42
  examples/i18n/et/Rakefile
43
+ examples/i18n/et/features/jagamine.feature
43
44
  examples/i18n/et/features/liitmine.feature
44
45
  examples/i18n/et/features/step_definitions/kalkulaator_steps.rb
45
46
  examples/i18n/et/lib/kalkulaator.rb
@@ -128,7 +129,12 @@ examples/jbehave/src/main/java/cukes/jbehave/examples/trader/persistence/TraderP
128
129
  examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java
129
130
  examples/selenium/Rakefile
130
131
  examples/selenium/features/search.feature
131
- examples/selenium/features/step_definitons/stories_steps.rb
132
+ examples/selenium/features/step_definitons/search_steps.rb
133
+ examples/selenium/features/support/env.rb
134
+ examples/selenium_webrat/Rakefile
135
+ examples/selenium_webrat/features/search.feature
136
+ examples/selenium_webrat/features/step_definitons/search_steps.rb
137
+ examples/selenium_webrat/features/support/env.rb
132
138
  examples/self_test/README.textile
133
139
  examples/self_test/Rakefile
134
140
  examples/self_test/features/background/failing_background.feature
@@ -3,15 +3,14 @@
3
3
  كشخص غبي في الرياضيات
4
4
  اريد معرفة ناتج جمع عددين
5
5
 
6
- سيناريو: جمع عددين
7
- بفرض كتابة ٥٠ في الآلة الحاسبة
8
- و كتابة ٧٠ في الآلة الحاسبة
9
- متى يتم الضغط على جمع
10
- اذاً يظهر ١٢ على الشاشة
11
- و الناتج يجب ان يكون Fixnum
6
+ سيناريو مخطط: جمع عددين
7
+ بفرض كتابة <input_1> في الآلة الحاسبة
8
+ و كتابة <input_2> في الآلة الحاسبة
9
+ متى يتم الضغط على <button>
10
+ اذاً يظهر <output> على الشاشة
12
11
 
13
- امثلة اكثر:
14
- | input_1 | input_2 | button | output | class |
15
- | 20 | 30 | جمع | 50 | Fixnum |
16
- | 2 | 5 | جمع | 7 | Fixnum |
17
- | 0 | 40 | جمع | 40 | Fixnum |
12
+ امثلة:
13
+ | input_1 | input_2 | button | output |
14
+ | 20 | 30 | جمع | 50 |
15
+ | 2 | 5 | جمع | 7 |
16
+ | 0 | 40 | جمع | 40 |
@@ -22,7 +22,3 @@ end
22
22
  Then /يظهر (.*) على الشاشة/ do |result|
23
23
  @result.should == result.to_f
24
24
  end
25
-
26
- Then /يجب ان يكون (\w*)/ do |class_name|
27
- @result.class.name.should == class_name
28
- end
@@ -3,14 +3,13 @@ Omadus: Liitmine
3
3
  Olles matemaatika-puupea
4
4
  Tahan et mulle öeldaks kahe numbri summa
5
5
 
6
- # Someone please translate this in languages.yml
7
- Scenario Outline: Liida kaks numbrit
6
+ Raamstsenaarium: Liida kaks numbrit
8
7
  Eeldades et olen sisestanud kalkulaatorisse numbri <input_1>
9
8
  Ja olen sisestanud kalkulaatorisse numbri <input_2>
10
9
  Kui ma vajutan <button>
11
10
  Siis vastuseks peab ekraanil kuvatama <output>
12
11
 
13
- Examples:
12
+ Juhtumid:
14
13
  | input_1 | input_2 | button | output |
15
14
  | 20 | 30 | liida | 50 |
16
15
  | 2 | 5 | liida | 7 |
@@ -15,10 +15,10 @@ Given /olen sisestanud kalkulaatorisse numbri (\d+)/ do |n|
15
15
  @calc.push n.to_i
16
16
  end
17
17
 
18
- When /ma vajutan (.*)/ do |op|
18
+ When /ma vajutan (\w+)/ do |op|
19
19
  @result = @calc.send op
20
20
  end
21
21
 
22
- Then /vastuseks peab ekraanil kuvatama (\d*)/ do |result|
23
- @result.should == result.to_i
22
+ Then /vastuseks peab ekraanil kuvatama (.*)/ do |result|
23
+ @result.should == result.to_f
24
24
  end
@@ -5,6 +5,10 @@ class Kalkulaator
5
5
  end
6
6
 
7
7
  def liida
8
- @args.inject(0) {|n,sum| sum+n}
8
+ @args.inject(0){|n,sum| sum+=n}
9
9
  end
10
+
11
+ def jaga
12
+ @args[0].to_f / @args[1].to_f
13
+ end
10
14
  end
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../../../lib')
2
+ require 'cucumber/rake/task'
3
+
4
+ Cucumber::Rake::Task.new do |t|
5
+ t.cucumber_opts = "--language ru"
6
+ end
@@ -0,0 +1,10 @@
1
+ Функционал: Сложение чисел
2
+ Чтобы не складывать в уме
3
+ Все, у кого с этим туго
4
+ Хотят автоматическое сложение целых чисел
5
+
6
+ Сценарий: Сложение двух целых чисел
7
+ Допустим я ввожу число 50
8
+ И затем ввожу число 70
9
+ Если я нажимаю "+"
10
+ То результатом должно быть число 120
@@ -0,0 +1,16 @@
1
+ Функционал: Последовательные вычисления
2
+ Чтобы вычислять сложные выражения
3
+ Пользователи хотят проводить вычисления над результатом предыдущей операций
4
+
5
+ Предыстория:
6
+ Допустим я сложил 3 и 5
7
+
8
+ Сценарий: сложение с результатом последней операций
9
+ Если я ввожу число 4
10
+ И нажимаю "+"
11
+ То результатом должно быть число 12
12
+
13
+ Сценарий: деление результата последней операции
14
+ Если я ввожу число 2
15
+ И нажимаю "/"
16
+ То результатом должно быть число 4
@@ -0,0 +1,15 @@
1
+ Функционал: Деление чисел
2
+ Поскольку деление сложный процесс и люди часто допускают ошибки
3
+ Нужно дать им возможность делить на калькуляторе
4
+
5
+ Структура сценария: Целочисленное деление
6
+ Допустим я ввожу число <делимое>
7
+ И затем ввожу число <делитель>
8
+ Если я нажимаю "/"
9
+ То результатом должно быть число <частное>
10
+
11
+ Значения:
12
+ | делимое | делитель | частное |
13
+ | 100 | 2 | 50 |
14
+ | 28 | 7 | 4 |
15
+ | 0 | 5 | 0 |
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+
3
+ Допустим /ввожу число (\d+)/ do |число|
4
+ calc.push число.to_i
5
+ end
6
+
7
+ Если /нажимаю "(.*)"/ do |операция|
8
+ calc.send операция
9
+ end
10
+
11
+ То /результатом должно быть число (\d+)/ do |результат|
12
+ calc.result.should == результат.to_f
13
+ end
14
+
15
+ Допустим /я сложил (\d+) и (\d+)/ do |слагаемое1, слагаемое2|
16
+ Допустим %{я ввожу число #{слагаемое1}}
17
+ Допустим %{затем ввожу число #{слагаемое2}}
18
+ Допустим %{я нажимаю "+"}
19
+ end
@@ -0,0 +1,6 @@
1
+ # encoding: utf-8
2
+ require 'spec/expectations'
3
+ $:.unshift(File.dirname(__FILE__) + '/../../lib')
4
+ require 'cucumber/formatters/unicode'
5
+ require 'calculator'
6
+ $KCODE='u' unless Cucumber::RUBY_1_9
@@ -0,0 +1,7 @@
1
+ # encoding: utf-8
2
+
3
+ World do
4
+ def calc
5
+ @calc ||= Calculator.new
6
+ end
7
+ end
@@ -0,0 +1,24 @@
1
+ # encoding: utf-8
2
+
3
+ class Calculator
4
+ def initialize
5
+ @stack = []
6
+ end
7
+
8
+ def push(arg)
9
+ @stack.push arg
10
+ end
11
+
12
+ def result
13
+ @stack.last
14
+ end
15
+
16
+ def +
17
+ @stack.push @stack.pop + @stack.pop
18
+ end
19
+
20
+ def /
21
+ divisor, dividend = [@stack.pop, @stack.pop] # Hm, @stack.pop(2) doesn't work
22
+ @stack.push dividend / divisor
23
+ end
24
+ end
@@ -0,0 +1,4 @@
1
+ Feature: Failing expectation
2
+
3
+ Scenario: Failing expectation
4
+ Given failing expectation
@@ -11,5 +11,5 @@ When /^I press '(.*)'$/ do |name|
11
11
  end
12
12
 
13
13
  Then /^I should see '(.*)'$/ do |text|
14
- response.body.should =~ /#{text}/m
14
+ response.should contain(/#{text}/m)
15
15
  end
@@ -13,8 +13,8 @@ Webrat.configure do |config|
13
13
  end
14
14
 
15
15
  World do
16
- include Webrat::Matchers
17
- include Webrat::HaveTagMatcher
18
-
19
- Webrat::SinatraSession.new
16
+ session = Webrat::SinatraSession.new
17
+ session.extend(Webrat::Matchers)
18
+ session.extend(Webrat::HaveTagMatcher)
19
+ session
20
20
  end
@@ -36,6 +36,24 @@ Feature: Cucumber command line
36
36
 
37
37
  """
38
38
 
39
+ Scenario: Succeed with --strict
40
+ When I run cucumber -q features/sample.feature:9 --strict
41
+ Then it should pass with
42
+ """
43
+ @one
44
+ Feature: Sample
45
+
46
+ @three
47
+ Scenario: Passing
48
+ Given passing
49
+ | a | b |
50
+ | c | d |
51
+
52
+ 1 scenario
53
+ 1 passed step
54
+
55
+ """
56
+
39
57
  Scenario: Specify 2 line numbers where one is a tag
40
58
  When I run cucumber -q features/sample.feature:5:14
41
59
  Then it should fail with
@@ -0,0 +1,45 @@
1
+ Feature: Cucumber command line
2
+ In order to write better software
3
+ Developers should be able to execute requirements as tests
4
+
5
+ Scenario: Run single failing scenario with default diff enabled
6
+ When I run cucumber -q features/failing_expectation.feature
7
+ Then it should fail with
8
+ """
9
+ Feature: Failing expectation
10
+
11
+ Scenario: Failing expectation
12
+ Given failing expectation
13
+ expected: "that",
14
+ got: "this" (using ==)
15
+ Diff:
16
+ @@ -1,2 +1,2 @@
17
+ -that
18
+ +this
19
+ (Spec::Expectations::ExpectationNotMetError)
20
+ ./features/step_definitions/sample_steps.rb:63:in `/^failing expectation$/'
21
+ features/failing_expectation.feature:4:in `Given failing expectation'
22
+
23
+ 1 scenario
24
+ 1 failed step
25
+
26
+ """
27
+
28
+ Scenario: Run single failing scenario with diff output disabled
29
+ When I run cucumber -q --no-diff features/failing_expectation.feature
30
+ Then it should fail with
31
+ """
32
+ Feature: Failing expectation
33
+
34
+ Scenario: Failing expectation
35
+ Given failing expectation
36
+ expected: "that",
37
+ got: "this" (using ==) (Spec::Expectations::ExpectationNotMetError)
38
+ ./features/step_definitions/sample_steps.rb:63:in `/^failing expectation$/'
39
+ features/failing_expectation.feature:4:in `Given failing expectation'
40
+
41
+ 1 scenario
42
+ 1 failed step
43
+
44
+ """
45
+
@@ -8,26 +8,37 @@ module Cucumber
8
8
  # This gets parsed into a Table holding the values <tt>[['a', 'b'], ['c', 'd']]</tt>
9
9
  #
10
10
  class Table
11
+ NULL_CONVERSIONS = Hash.new(lambda{ |cell_value| cell_value }).freeze
12
+
11
13
  attr_accessor :file
12
14
 
13
- def initialize(raw)
15
+ def initialize(raw, conversions = NULL_CONVERSIONS.dup)
14
16
  # Verify that it's square
15
17
  raw.transpose
16
18
  @raw = raw
17
19
  @cells_class = Cells
18
20
  @cell_class = Cell
19
- @conversion_procs = Hash.new(lambda{|cell_value| cell_value})
21
+ @conversion_procs = conversions
20
22
  end
21
23
 
22
- def at_lines?(lines)
23
- cells_rows.detect { |row| row.at_lines?(lines) }
24
+ # Creates a copy of this table, inheriting the column mappings.
25
+ def dup
26
+ self.class.new(@raw.dup, @conversion_procs.dup)
24
27
  end
25
28
 
26
- def accept(visitor, status)
27
- cells_rows.each do |row|
28
- visitor.visit_table_row(row, status)
29
- end
30
- nil
29
+ # Returns a new, transposed table. Example:
30
+ #
31
+ # | a | 7 | 4 |
32
+ # | b | 9 | 2 |
33
+ #
34
+ # Gets converted into the following:
35
+ #
36
+ # | a | b |
37
+ # | 7 | 9 |
38
+ # | 4 | 2 |
39
+ #
40
+ def transpose
41
+ self.class.new(@raw.transpose, @conversion_procs.dup)
31
42
  end
32
43
 
33
44
  # Converts this table into an Array of Hash where the keys of each
@@ -73,15 +84,45 @@ module Cucumber
73
84
  cells_rows.each(&proc)
74
85
  end
75
86
 
87
+ def at_lines?(lines)
88
+ cells_rows.detect { |row| row.at_lines?(lines) }
89
+ end
90
+
91
+ def accept(visitor, status)
92
+ cells_rows.each do |row|
93
+ visitor.visit_table_row(row, status)
94
+ end
95
+ nil
96
+ end
97
+
76
98
  # For testing only
77
99
  def to_sexp #:nodoc:
78
100
  [:table, *cells_rows.map{|row| row.to_sexp}]
79
101
  end
80
102
 
103
+ # Returns a new Table where the headers are redefined. This makes it
104
+ # possible to use prettier header names in the features. Example:
105
+ #
106
+ # | Phone Number | Address |
107
+ # | 123456 | xyz |
108
+ # | 345678 | abc |
109
+ #
110
+ # A StepDefinition receiving this table can then map the columns:
111
+ #
112
+ # mapped_table = table.map_columns('Phone Number' => :phone, 'Address' => :address)
113
+ # hashes = mapped_table.hashes
114
+ # # => [{:phone => '123456', :address => 'xyz'}, {:phone => '345678', :address => 'abc'}]
115
+ #
116
+ def map_headers(mappings)
117
+ table = self.dup
118
+ table.map_headers!(mappings)
119
+ table
120
+ end
121
+
81
122
  # Change how #hashes converts column values. The +column_name+ argument identifies the column
82
123
  # and +conversion_proc+ performs the conversion for each cell in that column. If +strict+ is
83
124
  # true, an error will be raised if the column named +column_name+ is not found. If +strict+
84
- # is false, no error will be raised.
125
+ # is false, no error will be raised.
85
126
  def map_column!(column_name, strict=true, &conversion_proc)
86
127
  verify_column(column_name) if strict
87
128
  @conversion_procs[column_name] = conversion_proc
@@ -111,7 +152,7 @@ module Cucumber
111
152
  row.map do |cell|
112
153
  cell_with_replaced_args = cell
113
154
  arguments.each do |name, value|
114
- cell_with_replaced_args = value ? cell_with_replaced_args.gsub(name, value) : nil
155
+ cell_with_replaced_args = value && !cell.nil? ? cell_with_replaced_args.gsub(name, value) : nil
115
156
  end
116
157
  cell_with_replaced_args
117
158
  end
@@ -124,6 +165,18 @@ module Cucumber
124
165
  cells_rows.detect{|row| row.at_lines?(lines)}
125
166
  end
126
167
 
168
+ protected
169
+
170
+ def map_headers!(mappings)
171
+ headers = @raw[0]
172
+ mappings.each_pair do |pre, post|
173
+ headers[headers.index(pre)] = post
174
+ if @conversion_procs.has_key?(pre)
175
+ @conversion_procs[post] = @conversion_procs.delete(pre)
176
+ end
177
+ end
178
+ end
179
+
127
180
  private
128
181
 
129
182
  def col_width(col)
@@ -46,7 +46,7 @@ module Cucumber
46
46
  visitor = configuration.build_formatter_broadcaster(step_mother)
47
47
  visitor.visit_features(features)
48
48
 
49
- failure = features.steps[:failed].any? || (configuration.strict? && features.steps[:undefined].length)
49
+ failure = features.steps[:failed].any? || (configuration.strict? && features.steps[:undefined].any?)
50
50
  Kernel.exit(failure ? 1 : 0)
51
51
  end
52
52
 
@@ -31,10 +31,13 @@
31
31
  native: العربية
32
32
  encoding: UTF-8
33
33
  feature: خاصية
34
+ background: الخلفية
34
35
  scenario: سيناريو
36
+ scenario_outline: سيناريو مخطط
37
+ examples: امثلة
35
38
  given: بفرض
36
- when: متى
37
- then: اذاً
39
+ when: متى|عندما
40
+ then: اذاً|ثم
38
41
  and: و
39
42
  but: لكن
40
43
  "cy":
@@ -110,6 +113,7 @@
110
113
  native: Texan
111
114
  encoding: UTF-8
112
115
  feature: Feature
116
+ background: Background
113
117
  scenario: Scenario
114
118
  scenario_outline: Scenario Outline
115
119
  examples: Examples
@@ -137,7 +141,10 @@
137
141
  native: eesti keel
138
142
  encoding: UTF-8
139
143
  feature: Omadus
144
+ background: Taust
140
145
  scenario: Stsenaarium
146
+ scenario_outline: Raamstsenaarium
147
+ examples: Juhtumid
141
148
  given: Eeldades
142
149
  when: Kui
143
150
  then: Siis
@@ -148,6 +155,7 @@
148
155
  native: suomi
149
156
  encoding: UTF-8
150
157
  feature: Ominaisuus
158
+ background: Tausta
151
159
  scenario: Tapaus
152
160
  scenario_outline: Tapausaihio
153
161
  examples: Tapaukset
@@ -28,14 +28,14 @@ module Cucumber
28
28
  class Task
29
29
  LIB = File.expand_path(File.dirname(__FILE__) + '/../..') # :nodoc:
30
30
 
31
- # Directories to add to the load path
31
+ # Directories to add to the Ruby $LOAD_PATH
32
32
  attr_accessor :libs
33
33
  # Name of the cucumber binary to use for running features. Defaults to Cucumber::BINARY
34
34
  attr_accessor :binary
35
- # Array of paths to specific steps to use
35
+ # Array of paths to specific step definition files to use
36
36
  attr_accessor :step_list
37
37
  # File pattern for finding step definitions. Defaults to
38
- # 'features/**/*.rb'. Can be overriden by the SPEC environment variable.
38
+ # 'features/**/*.rb'.
39
39
  attr_accessor :step_pattern
40
40
  # Array of paths to specific features to run.
41
41
  attr_accessor :feature_list
@@ -3,7 +3,7 @@ module Cucumber #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
5
  TINY = 99
6
- PATCH = 22 # Set to nil for official release
6
+ PATCH = 23 # Set to nil for official release
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
9
9
  end
@@ -9,9 +9,6 @@ module Cucumber
9
9
  %w{one four seven},
10
10
  %w{4444 55555 666666}
11
11
  ])
12
- @table.extend(Module.new{
13
- attr_reader :raw
14
- })
15
12
  def @table.cells_rows; super; end
16
13
  def @table.columns; super; end
17
14
  end
@@ -60,6 +57,30 @@ module Cucumber
60
57
  }.should raise_error('The column named "two" does not exist')
61
58
  end
62
59
 
60
+ describe ".transpose" do
61
+ before(:each) do
62
+ @table = Table.new([
63
+ %w{one 1111},
64
+ %w{two 22222}
65
+ ])
66
+ end
67
+
68
+ it "should be convertible in to an array where each row is a hash" do
69
+ @table.transpose.hashes[0].should == {'one' => '1111', 'two' => '22222'}
70
+ end
71
+ end
72
+
73
+ it "should allow renaming columns" do
74
+ table2 = @table.map_headers('one' => :three)
75
+ table2.hashes.first[:three].should == '4444'
76
+ end
77
+
78
+ it "should copy column mappings when mapping headers" do
79
+ @table.map_column!('one') { |v| v.to_i }
80
+ table2 = @table.map_headers('one' => 'three')
81
+ table2.hashes.first['three'].should == 4444
82
+ end
83
+
63
84
  describe "replacing arguments" do
64
85
 
65
86
  before(:each) do
@@ -83,11 +104,21 @@ module Cucumber
83
104
  end
84
105
 
85
106
  it "should not change the original table" do
86
- table_with_replaced_args = @table.arguments_replaced({'<book>' => 'Unbearable lightness of being'})
107
+ @table.arguments_replaced({'<book>' => 'Unbearable lightness of being'})
87
108
 
88
109
  @table.hashes[0]['book'].should_not == 'Unbearable lightness of being'
89
110
  end
90
111
 
112
+ it "should not raise an error when there are nil values in the table" do
113
+ table = Table.new([
114
+ ['book'],
115
+ [nil]
116
+ ])
117
+ lambda{
118
+ table.arguments_replaced({'<book>' => 'The great sheep chase'})
119
+ }.should_not raise_error
120
+ end
121
+
91
122
  end
92
123
 
93
124
  it "should convert to sexp" do
@@ -1,10 +1,10 @@
1
1
  require File.dirname(__FILE__) + '/../../spec_helper'
2
2
  require 'yaml'
3
+ require 'spec/expectations/differs/default'
3
4
 
4
5
  module Cucumber
5
6
  module Cli
6
7
  describe Main do
7
-
8
8
  before(:each) do
9
9
  @out = StringIO.new
10
10
  Kernel.stub!(:exit).and_return(nil)
@@ -0,0 +1,26 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ module Cucumber
4
+ module Formatter
5
+ describe ColorIO do
6
+ describe "<<" do
7
+ it "should convert to a print using kernel" do
8
+ color_io = ColorIO.new
9
+
10
+ Kernel.should_receive(:print).with("monkeys")
11
+
12
+ color_io << "monkeys"
13
+ end
14
+
15
+ it "should allow chained <<" do
16
+ color_io = ColorIO.new
17
+
18
+ Kernel.should_receive(:print).with("monkeys")
19
+ Kernel.should_receive(:print).with(" are tasty")
20
+
21
+ color_io << "monkeys" << " are tasty"
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aslakhellesoy-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.99.22
4
+ version: 0.1.99.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Aslak Helles\xC3\xB8y"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-10 00:00:00 -07:00
12
+ date: 2009-03-13 00:00:00 -07:00
13
13
  default_executable: cucumber
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -176,6 +176,14 @@ files:
176
176
  - examples/i18n/ro/features/step_definitons/calculator_steps.rb
177
177
  - examples/i18n/ro/features/suma.feature
178
178
  - examples/i18n/ro/lib/calculator.rb
179
+ - examples/i18n/ru/Rakefile
180
+ - examples/i18n/ru/features/addition.feature
181
+ - examples/i18n/ru/features/consecutive_calculations.feature
182
+ - examples/i18n/ru/features/division.feature
183
+ - examples/i18n/ru/features/step_definitons/calculator_steps.rb
184
+ - examples/i18n/ru/features/support/env.rb
185
+ - examples/i18n/ru/features/support/world.rb
186
+ - examples/i18n/ru/lib/calculator.rb
179
187
  - examples/i18n/se/Rakefile
180
188
  - examples/i18n/se/features/step_definitons/kalkulator_steps.rb
181
189
  - examples/i18n/se/features/summering.feature
@@ -218,6 +226,7 @@ files:
218
226
  - examples/self_test/features/background/scenario_outline_failing_background.feature
219
227
  - examples/self_test/features/background/scenario_outline_passing_background.feature
220
228
  - examples/self_test/features/call_undefined_step_from_step_def.feature
229
+ - examples/self_test/features/failing_expectation.feature
221
230
  - examples/self_test/features/lots_of_undefined.feature
222
231
  - examples/self_test/features/outline_sample.feature
223
232
  - examples/self_test/features/sample.feature
@@ -254,6 +263,7 @@ files:
254
263
  - examples/watir/features/support/env.rb
255
264
  - features/background.feature
256
265
  - features/cucumber_cli.feature
266
+ - features/cucumber_cli_diff_disabled.feature
257
267
  - features/cucumber_cli_outlines.feature
258
268
  - features/custom_formatter.feature
259
269
  - features/report_called_undefined_steps.feature
@@ -356,6 +366,7 @@ files:
356
366
  - spec/cucumber/core_ext/proc_spec.rb
357
367
  - spec/cucumber/core_ext/string_spec.rb
358
368
  - spec/cucumber/formatter/ansicolor_spec.rb
369
+ - spec/cucumber/formatter/color_io_spec.rb
359
370
  - spec/cucumber/formatter/html/cucumber.css
360
371
  - spec/cucumber/formatter/html/cucumber.js
361
372
  - spec/cucumber/formatter/html/index.html
@@ -1,40 +0,0 @@
1
- require 'spec/expectations'
2
- require 'selenium'
3
-
4
- class GoogleSearch
5
- def initialize(browser)
6
- @browser = browser
7
- end
8
-
9
- def goto
10
- @browser.open 'http://www.google.com/'
11
- end
12
-
13
- def search(text)
14
- @browser.type('q',text)
15
- @browser.click 'btnG'
16
- @browser.wait_for_page_to_load
17
- end
18
- end
19
-
20
- Before do
21
- @browser = Selenium::SeleniumDriver.new("localhost", 4444, "*chrome", "http://localhost", 15000)
22
- @browser.start
23
- end
24
-
25
- After do
26
- @browser.stop
27
- end
28
-
29
- Given 'I am on the Google search page' do
30
- @page = GoogleSearch.new(@browser)
31
- @page.goto
32
- end
33
-
34
- When /I search for "(.*)"/ do |query|
35
- @page.search(query)
36
- end
37
-
38
- Then /I should see a link to (.*)/ do |expected_url|
39
- @browser.is_element_present("css=a[href='#{expected_url}']").should be_true
40
- end