cucumber 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rvmrc +1 -1
- data/.travis.yml +3 -2
- data/DEVELOPERS.md +48 -0
- data/History.md +22 -3
- data/README.md +13 -31
- data/Rakefile +1 -0
- data/cucumber.gemspec +18 -17
- data/cucumber.yml +3 -2
- data/examples/i18n/cs/Rakefile +6 -0
- data/examples/i18n/cs/features/addition.feature +17 -0
- data/examples/i18n/cs/features/division.feature +11 -0
- data/examples/i18n/cs/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/cs/lib/calculator.rb +14 -0
- data/examples/i18n/hi/Rakefile +6 -0
- data/examples/i18n/hi/features/addition.feature +16 -0
- data/examples/i18n/hi/features/division.feature +10 -0
- data/examples/i18n/hi/features/step_definitons/calculator_steps.rb +24 -0
- data/examples/i18n/hi/lib/calculator.rb +15 -0
- data/examples/python/README.textile +2 -1
- data/examples/ruby2python/README.textile +2 -1
- data/features/.cucumber/stepdefs.json +1688 -445
- data/features/assertions.feature +69 -0
- data/features/formatter_callbacks.feature +189 -0
- data/features/html_formatter.feature +19 -0
- data/features/json_formatter.feature +8 -4
- data/features/nested_steps_with_second_arg.feature +73 -0
- data/features/step_definitions.feature +65 -0
- data/features/step_definitions/cucumber_steps.rb +18 -3
- data/fixtures/self_test/features/support/env.rb +1 -1
- data/gem_tasks/cucumber.rake +5 -3
- data/gem_tasks/downloads.rb +3 -3
- data/gem_tasks/stats +4 -2
- data/gem_tasks/yard.rake +31 -13
- data/legacy_features/default_snippets.feature +3 -3
- data/legacy_features/language_help.feature +4 -0
- data/legacy_features/report_called_undefined_steps.feature +1 -1
- data/legacy_features/snippet.feature +3 -3
- data/legacy_features/snippets_when_using_star_keyword.feature +1 -1
- data/legacy_features/step_definitions/cucumber_steps.rb +4 -3
- data/legacy_features/support/env.rb +1 -1
- data/legacy_features/support/fake_wire_server.rb +9 -9
- data/lib/autotest/cucumber_mixin.rb +14 -14
- data/lib/autotest/discover.rb +2 -0
- data/lib/cucumber.rb +2 -2
- data/lib/cucumber/ast.rb +1 -1
- data/lib/cucumber/ast/background.rb +11 -7
- data/lib/cucumber/ast/comment.rb +2 -2
- data/lib/cucumber/ast/doc_string.rb +1 -1
- data/lib/cucumber/ast/examples.rb +1 -1
- data/lib/cucumber/ast/feature.rb +2 -2
- data/lib/cucumber/ast/feature_element.rb +1 -1
- data/lib/cucumber/ast/multiline_argument.rb +2 -2
- data/lib/cucumber/ast/names.rb +2 -2
- data/lib/cucumber/ast/outline_table.rb +4 -5
- data/lib/cucumber/ast/scenario.rb +14 -14
- data/lib/cucumber/ast/scenario_outline.rb +4 -4
- data/lib/cucumber/ast/step.rb +3 -3
- data/lib/cucumber/ast/step_collection.rb +5 -5
- data/lib/cucumber/ast/step_invocation.rb +8 -8
- data/lib/cucumber/ast/table.rb +40 -27
- data/lib/cucumber/ast/tree_walker.rb +9 -8
- data/lib/cucumber/ast/visitor.rb +1 -1
- data/lib/cucumber/cli/configuration.rb +10 -10
- data/lib/cucumber/cli/drb_client.rb +1 -1
- data/lib/cucumber/cli/main.rb +3 -3
- data/lib/cucumber/cli/options.rb +3 -2
- data/lib/cucumber/cli/profile_loader.rb +1 -1
- data/lib/cucumber/configuration.rb +12 -12
- data/lib/cucumber/constantize.rb +11 -2
- data/lib/cucumber/core_ext/disable_mini_and_test_unit_autorun.rb +1 -1
- data/lib/cucumber/core_ext/instance_exec.rb +4 -4
- data/lib/cucumber/core_ext/proc.rb +3 -3
- data/lib/cucumber/errors.rb +1 -1
- data/lib/cucumber/feature_file.rb +1 -1
- data/lib/cucumber/formatter/ansicolor.rb +36 -23
- data/lib/cucumber/formatter/console.rb +45 -25
- data/lib/cucumber/formatter/debug.rb +7 -7
- data/lib/cucumber/formatter/duration.rb +1 -1
- data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +7 -0
- data/lib/cucumber/formatter/gpretty.rb +1 -1
- data/lib/cucumber/formatter/html.rb +52 -53
- data/lib/cucumber/formatter/interceptor.rb +2 -2
- data/lib/cucumber/formatter/json.rb +1 -1
- data/lib/cucumber/formatter/json_pretty.rb +2 -1
- data/lib/cucumber/formatter/junit.rb +1 -1
- data/lib/cucumber/formatter/ordered_xml_markup.rb +1 -1
- data/lib/cucumber/formatter/pretty.rb +12 -12
- data/lib/cucumber/formatter/progress.rb +5 -5
- data/lib/cucumber/formatter/rerun.rb +5 -5
- data/lib/cucumber/formatter/stepdefs.rb +1 -1
- data/lib/cucumber/formatter/steps.rb +6 -6
- data/lib/cucumber/formatter/summary.rb +6 -6
- data/lib/cucumber/formatter/unicode.rb +18 -18
- data/lib/cucumber/formatter/usage.rb +7 -7
- data/lib/cucumber/js_support/js_dsl.js +1 -1
- data/lib/cucumber/language_support.rb +1 -1
- data/lib/cucumber/parser/gherkin_builder.rb +33 -33
- data/lib/cucumber/platform.rb +3 -2
- data/lib/cucumber/py_support/py_dsl.py +2 -2
- data/lib/cucumber/py_support/py_language.py +2 -2
- data/lib/cucumber/py_support/py_language.rb +2 -2
- data/lib/cucumber/rake/task.rb +4 -3
- data/lib/cucumber/rb_support/rb_dsl.rb +10 -10
- data/lib/cucumber/rb_support/rb_language.rb +27 -19
- data/lib/cucumber/rb_support/rb_step_definition.rb +39 -11
- data/lib/cucumber/rb_support/rb_transform.rb +3 -3
- data/lib/cucumber/rb_support/rb_world.rb +15 -15
- data/lib/cucumber/rb_support/regexp_argument_matcher.rb +1 -1
- data/lib/cucumber/rspec/disable_option_parser.rb +1 -1
- data/lib/cucumber/rspec/doubles.rb +1 -1
- data/lib/cucumber/runtime.rb +11 -10
- data/lib/cucumber/runtime/features_loader.rb +6 -6
- data/lib/cucumber/runtime/for_programming_languages.rb +8 -15
- data/lib/cucumber/runtime/results.rb +6 -6
- data/lib/cucumber/runtime/support_code.rb +37 -28
- data/lib/cucumber/runtime/user_interface.rb +4 -4
- data/lib/cucumber/step_definition_light.rb +4 -4
- data/lib/cucumber/step_definitions.rb +2 -3
- data/lib/cucumber/step_match.rb +6 -6
- data/lib/cucumber/step_mother.rb +1 -1
- data/lib/cucumber/term/ansicolor.rb +22 -22
- data/lib/cucumber/wire_support/configuration.rb +11 -14
- data/lib/cucumber/wire_support/connection.rb +10 -9
- data/lib/cucumber/wire_support/request_handler.rb +3 -3
- data/lib/cucumber/wire_support/wire_exception.rb +3 -3
- data/lib/cucumber/wire_support/wire_language.rb +11 -11
- data/lib/cucumber/wire_support/wire_packet.rb +7 -5
- data/lib/cucumber/wire_support/wire_protocol.rb +6 -6
- data/lib/cucumber/wire_support/wire_protocol/requests.rb +20 -20
- data/lib/cucumber/wire_support/wire_step_definition.rb +4 -4
- data/spec/cucumber/ast/background_spec.rb +4 -4
- data/spec/cucumber/ast/doc_string_spec.rb +8 -8
- data/spec/cucumber/ast/feature_factory.rb +4 -4
- data/spec/cucumber/ast/feature_spec.rb +18 -18
- data/spec/cucumber/ast/outline_table_spec.rb +3 -3
- data/spec/cucumber/ast/step_spec.rb +4 -4
- data/spec/cucumber/ast/table_spec.rb +50 -29
- data/spec/cucumber/ast/tree_walker_spec.rb +12 -4
- data/spec/cucumber/broadcaster_spec.rb +1 -1
- data/spec/cucumber/cli/configuration_spec.rb +10 -4
- data/spec/cucumber/cli/drb_client_spec.rb +1 -1
- data/spec/cucumber/cli/main_spec.rb +28 -7
- data/spec/cucumber/cli/options_spec.rb +3 -3
- data/spec/cucumber/configuration_spec.rb +4 -4
- data/spec/cucumber/constantize_spec.rb +2 -0
- data/spec/cucumber/core_ext/proc_spec.rb +7 -7
- data/spec/cucumber/formatter/ansicolor_spec.rb +2 -2
- data/spec/cucumber/formatter/duration_spec.rb +2 -2
- data/spec/cucumber/formatter/html_spec.rb +31 -31
- data/spec/cucumber/formatter/interceptor_spec.rb +10 -0
- data/spec/cucumber/formatter/progress_spec.rb +1 -1
- data/spec/cucumber/formatter/spec_helper.rb +7 -7
- data/spec/cucumber/rake/forked_spec.rb +15 -2
- data/spec/cucumber/rake/rcov_spec.rb +2 -2
- data/spec/cucumber/rb_support/rb_language_spec.rb +34 -17
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +45 -35
- data/spec/cucumber/rb_support/rb_transform_spec.rb +3 -3
- data/spec/cucumber/runtime/for_programming_languages_spec.rb +31 -0
- data/spec/cucumber/runtime/results_spec.rb +5 -5
- data/spec/cucumber/runtime/support_code_spec.rb +13 -2
- data/spec/cucumber/runtime_spec.rb +7 -7
- data/spec/cucumber/step_match_spec.rb +2 -2
- data/spec/cucumber/wire_support/configuration_spec.rb +16 -6
- data/spec/cucumber/wire_support/connection_spec.rb +25 -11
- data/spec/cucumber/wire_support/wire_exception_spec.rb +3 -3
- data/spec/cucumber/wire_support/wire_language_spec.rb +3 -3
- data/spec/cucumber/wire_support/wire_packet_spec.rb +4 -4
- data/spec/cucumber/wire_support/wire_step_definition_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +98 -128
- data/legacy_features/html_formatter.feature +0 -8
- data/legacy_features/html_formatter/a.html +0 -561
@@ -2,16 +2,31 @@ When /^I run cucumber "(.+)"$/ do |cmd|
|
|
2
2
|
run_simple(unescape("cucumber #{cmd}"), false)
|
3
3
|
end
|
4
4
|
|
5
|
+
Then 'it should pass' do
|
6
|
+
assert_exit_status 0
|
7
|
+
end
|
8
|
+
|
5
9
|
Then /^it should (pass|fail) with JSON:$/ do |pass_fail, json|
|
6
10
|
# Need to store it in a variable. With JRuby we can only do this once it seems :-/
|
7
11
|
stdout = all_stdout
|
8
|
-
|
12
|
+
|
9
13
|
# JRuby has weird traces sometimes (?)
|
10
|
-
stdout = stdout.gsub(/ `\(root\)':in/, '')
|
14
|
+
stdout = stdout.gsub(/ `\(root\)':in/, '')
|
11
15
|
|
12
16
|
actual = JSON.parse(stdout)
|
13
17
|
expected = JSON.parse(json)
|
14
|
-
|
18
|
+
|
19
|
+
#make sure duration was captured (should be >= 0)
|
20
|
+
#then set it to what is "expected" since duration is dynamic
|
21
|
+
actual.each do |feature|
|
22
|
+
feature['elements'].each do |scenario|
|
23
|
+
scenario['steps'].each do |step|
|
24
|
+
step['result']['duration'].should be >= 0
|
25
|
+
step['result']['duration'] = 1
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
15
30
|
actual.should == expected
|
16
31
|
assert_success(pass_fail == 'pass')
|
17
32
|
end
|
data/gem_tasks/cucumber.rake
CHANGED
@@ -3,12 +3,14 @@ require 'cucumber/platform'
|
|
3
3
|
|
4
4
|
class Cucumber::Rake::Task
|
5
5
|
def set_profile_for_current_ruby
|
6
|
-
self.profile = if
|
6
|
+
self.profile = if Cucumber::JRUBY
|
7
7
|
Cucumber::WINDOWS ? 'jruby_win' : 'jruby'
|
8
|
-
elsif
|
8
|
+
elsif Cucumber::WINDOWS_MRI
|
9
9
|
'windows_mri'
|
10
|
-
elsif
|
10
|
+
elsif Cucumber::RUBY_1_9
|
11
11
|
'ruby_1_9'
|
12
|
+
elsif Cucumber::RUBY_2_0
|
13
|
+
'ruby_2_0'
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
data/gem_tasks/downloads.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require 'json'
|
2
1
|
require 'httparty'
|
2
|
+
require 'multi_json'
|
3
3
|
|
4
4
|
IO.read(File.dirname(__FILE__) + '/versions.txt').each_line do |version|
|
5
5
|
json = HTTParty.get("http://rubygems.org/api/v1/downloads/cucumber-#{version.strip}.json")
|
6
|
-
puts
|
7
|
-
end
|
6
|
+
puts MultiJson.load(json.body)['version_downloads']
|
7
|
+
end
|
data/gem_tasks/stats
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
#!/usr/bin/env sh
|
2
|
+
|
1
3
|
echo 'Commits'
|
2
4
|
git log --pretty=format:'' | wc -l
|
3
5
|
|
@@ -8,7 +10,7 @@ echo 'Resolved bugs/feature requests'
|
|
8
10
|
egrep -e '^\*' History.md | wc -l
|
9
11
|
|
10
12
|
echo 'Open tickets'
|
11
|
-
curl -s
|
13
|
+
curl -s https://api.github.com/repos/cucumber/cucumber/issues?state=open | ruby -e "require 'multi_json'; puts MultiJson.load(STDIN.read).length"
|
12
14
|
|
13
15
|
echo 'Group members'
|
14
|
-
curl -s http://groups.google.com/group/cukes | grep Members
|
16
|
+
curl -s http://groups.google.com/group/cukes | grep Members
|
data/gem_tasks/yard.rake
CHANGED
@@ -1,18 +1,36 @@
|
|
1
1
|
require 'yard'
|
2
2
|
require 'yard/rake/yardoc_task'
|
3
|
-
require 'cucumber/platform'
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../lib/cucumber/platform')
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
t.options = %w{--no-private --title Cucumber}
|
8
|
-
t.files = %w{lib - README.md History.md LICENSE}
|
9
|
-
end
|
5
|
+
SITE_DIR = File.expand_path(File.dirname(__FILE__) + '/../../cucumber.github.com')
|
6
|
+
API_DIR = File.join(SITE_DIR, 'api', 'cucumber', 'ruby', 'yardoc')
|
10
7
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
namespace :api do
|
9
|
+
file :dir do
|
10
|
+
unless File.directory?(SITE_DIR)
|
11
|
+
raise "You need to git clone git@github.com:cucumber/cucumber.github.com.git #{SITE_DIR}"
|
12
|
+
end
|
13
|
+
sh('git pull -u')
|
14
|
+
mkdir_p API_DIR
|
15
|
+
end
|
16
|
+
|
17
|
+
template_path = File.expand_path(File.join(File.dirname(__FILE__), 'yard'))
|
18
|
+
YARD::Templates::Engine.register_template_path(template_path)
|
19
|
+
YARD::Rake::YardocTask.new(:yard) do |yard|
|
20
|
+
dir = API_DIR
|
21
|
+
mkdir_p dir
|
22
|
+
yard.options = ["--out", dir]
|
23
|
+
end
|
24
|
+
task :yard => :dir
|
17
25
|
|
18
|
-
|
26
|
+
task :release do
|
27
|
+
Dir.chdir(SITE_DIR) do
|
28
|
+
sh('git add .')
|
29
|
+
sh("git commit -m 'Update API docs for Cucumber-Ruby v#{Cucumber::VERSION}'")
|
30
|
+
sh('git push')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Generate YARD docs for Cucumber's API"
|
35
|
+
task :doc => [:yard, :release]
|
36
|
+
end
|
@@ -26,11 +26,11 @@ Feature: Print snippets
|
|
26
26
|
|
27
27
|
You can implement step definitions for undefined steps with these snippets:
|
28
28
|
|
29
|
-
Given
|
29
|
+
Given(/^Z$/) do
|
30
30
|
pending # express the regexp above with the code you wish you had
|
31
31
|
end
|
32
32
|
|
33
|
-
Given
|
33
|
+
Given(/^Q$/) do
|
34
34
|
pending # express the regexp above with the code you wish you had
|
35
35
|
end
|
36
36
|
|
@@ -40,4 +40,4 @@ Feature: Print snippets
|
|
40
40
|
|
41
41
|
|
42
42
|
"""
|
43
|
-
|
43
|
+
|
@@ -46,9 +46,11 @@ Feature: Language help
|
|
46
46
|
| eo | Esperanto | Esperanto |
|
47
47
|
| es | Spanish | español |
|
48
48
|
| et | Estonian | eesti keel |
|
49
|
+
| fa | Persian | فارسی |
|
49
50
|
| fi | Finnish | suomi |
|
50
51
|
| fr | French | français |
|
51
52
|
| he | Hebrew | עברית |
|
53
|
+
| hi | Hindi | हिंदी |
|
52
54
|
| hr | Croatian | hrvatski |
|
53
55
|
| hu | Hungarian | magyar |
|
54
56
|
| id | Indonesian | Bahasa Indonesia |
|
@@ -69,7 +71,9 @@ Feature: Language help
|
|
69
71
|
| sr-Cyrl | Serbian | Српски |
|
70
72
|
| sr-Latn | Serbian (Latin) | Srpski (Latinica) |
|
71
73
|
| sv | Swedish | Svenska |
|
74
|
+
| tl | Telugu | తెలుగు |
|
72
75
|
| tr | Turkish | Türkçe |
|
76
|
+
| tt | Tatar | Татарча |
|
73
77
|
| uk | Ukrainian | Українська |
|
74
78
|
| uz | Uzbek | Узбекча |
|
75
79
|
| vi | Vietnamese | Tiếng Việt |
|
@@ -25,7 +25,7 @@ Feature: Cucumber command line
|
|
25
25
|
|
26
26
|
You can implement step definitions for undefined steps with these snippets:
|
27
27
|
|
28
|
-
Given
|
28
|
+
Given(/^this does not exist$/) do
|
29
29
|
pending # express the regexp above with the code you wish you had
|
30
30
|
end
|
31
31
|
|
@@ -7,7 +7,7 @@ Feature: Snippets
|
|
7
7
|
When I run cucumber features/undefined_multiline_args.feature:3 -s
|
8
8
|
Then the output should contain
|
9
9
|
"""
|
10
|
-
Given
|
10
|
+
Given(/^a pystring$/) do |string|
|
11
11
|
pending # express the regexp above with the code you wish you had
|
12
12
|
end
|
13
13
|
"""
|
@@ -16,8 +16,8 @@ Feature: Snippets
|
|
16
16
|
When I run cucumber features/undefined_multiline_args.feature:9 -s
|
17
17
|
Then the output should contain
|
18
18
|
"""
|
19
|
-
Given
|
19
|
+
Given(/^a table$/) do |table|
|
20
20
|
# table is a Cucumber::Ast::Table
|
21
21
|
pending # express the regexp above with the code you wish you had
|
22
22
|
end
|
23
|
-
"""
|
23
|
+
"""
|
@@ -25,7 +25,7 @@ Feature: Use * keywords and still get snippets
|
|
25
25
|
|
26
26
|
You can implement step definitions for undefined steps with these snippets:
|
27
27
|
|
28
|
-
Given
|
28
|
+
Given(/^I have some cukes$/) do
|
29
29
|
pending # express the regexp above with the code you wish you had
|
30
30
|
end
|
31
31
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
require 'multi_json'
|
2
3
|
require 'tempfile'
|
3
4
|
|
4
5
|
Given /^I am in (.*)$/ do |example_dir_relative_path|
|
@@ -95,7 +96,7 @@ Then /^the output should be$/ do |text|
|
|
95
96
|
end
|
96
97
|
|
97
98
|
Then /^it should (fail|pass) with JSON$/ do |success, text|
|
98
|
-
|
99
|
+
MultiJson.load(last_stdout).should == MultiJson.load(text)
|
99
100
|
Then("it should #{success}")
|
100
101
|
end
|
101
102
|
|
@@ -105,7 +106,7 @@ end
|
|
105
106
|
|
106
107
|
Then /^"([^"]*)" with junit duration "([^"]*)" should contain$/ do |actual_file, duration_replacement, text|
|
107
108
|
actual = IO.read(actual_file)
|
108
|
-
actual = replace_junit_duration(actual, duration_replacement)
|
109
|
+
actual = replace_junit_duration(actual, duration_replacement)
|
109
110
|
actual = strip_ruby186_extra_trace(actual)
|
110
111
|
actual.should == text
|
111
112
|
end
|
@@ -168,5 +169,5 @@ Then /^print output$/ do
|
|
168
169
|
end
|
169
170
|
|
170
171
|
Then /^the output should contain the following JSON:$/ do |json_string|
|
171
|
-
|
172
|
+
MultiJson.load(last_stdout).should == MultiJson.load(json_string)
|
172
173
|
end
|
@@ -101,7 +101,7 @@ class CucumberWorld
|
|
101
101
|
stderr_file = Tempfile.new('cucumber')
|
102
102
|
stderr_file.close
|
103
103
|
in_current_dir do
|
104
|
-
mode = Cucumber::
|
104
|
+
mode = Cucumber::RUBY_1_8_7 ? 'r' : {:external_encoding=>"UTF-8"}
|
105
105
|
IO.popen("#{command} 2> #{stderr_file.path}", mode) do |io|
|
106
106
|
@last_stdout = io.read
|
107
107
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
+
require 'multi_json'
|
1
2
|
require 'socket'
|
2
|
-
require 'json'
|
3
3
|
|
4
4
|
class FakeWireServer
|
5
5
|
def initialize(port, protocol_table)
|
@@ -11,7 +11,7 @@ class FakeWireServer
|
|
11
11
|
@server = TCPServer.open(@port)
|
12
12
|
loop { handle_connections }
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def delay_response(message, delay)
|
16
16
|
@delays[message] = delay
|
17
17
|
end
|
@@ -31,7 +31,7 @@ class FakeWireServer
|
|
31
31
|
socket.close
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
class SocketSession
|
36
36
|
def initialize(socket, protocol, delays)
|
37
37
|
@socket = socket
|
@@ -46,7 +46,7 @@ class FakeWireServer
|
|
46
46
|
end
|
47
47
|
|
48
48
|
private
|
49
|
-
|
49
|
+
|
50
50
|
def handle(data)
|
51
51
|
if protocol_entry = response_to(data.strip)
|
52
52
|
sleep delay(data)
|
@@ -60,18 +60,18 @@ class FakeWireServer
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def response_to(data)
|
63
|
-
@protocol.detect do |entry|
|
64
|
-
|
63
|
+
@protocol.detect do |entry|
|
64
|
+
MultiJson.load(entry['request']) == MultiJson.load(data)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
68
|
def send_response(response)
|
69
69
|
@socket.puts response + "\n"
|
70
70
|
end
|
71
|
-
|
71
|
+
|
72
72
|
def delay(data)
|
73
|
-
message =
|
73
|
+
message = MultiJson.load(data.strip)[0]
|
74
74
|
@delays[message.to_sym] || 0
|
75
75
|
end
|
76
76
|
end
|
77
|
-
end
|
77
|
+
end
|
@@ -7,14 +7,14 @@ module Autotest::CucumberMixin
|
|
7
7
|
def self.included(receiver)
|
8
8
|
receiver::ALL_HOOKS << [:run_features, :ran_features]
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
attr_accessor :features_to_run
|
12
|
-
|
12
|
+
|
13
13
|
def initialize
|
14
14
|
super
|
15
15
|
reset_features
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
def run
|
19
19
|
hook :initialize
|
20
20
|
reset
|
@@ -44,11 +44,11 @@ module Autotest::CucumberMixin
|
|
44
44
|
end
|
45
45
|
hook :quit
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
def all_features_good
|
49
49
|
features_to_run == ""
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
def get_to_green
|
53
53
|
begin
|
54
54
|
super
|
@@ -56,16 +56,16 @@ module Autotest::CucumberMixin
|
|
56
56
|
wait_for_changes unless all_features_good
|
57
57
|
end until all_features_good
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
def rerun_all_features
|
61
61
|
reset_features
|
62
62
|
run_features
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
def reset_features
|
66
66
|
self.features_to_run = :all
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
69
|
def run_features
|
70
70
|
hook :run_features
|
71
71
|
Tempfile.open('autotest-cucumber') do |dirty_features_file|
|
@@ -104,16 +104,16 @@ module Autotest::CucumberMixin
|
|
104
104
|
end
|
105
105
|
hook :ran_features
|
106
106
|
end
|
107
|
-
|
107
|
+
|
108
108
|
def make_cucumber_cmd(features_to_run, dirty_features_filename)
|
109
109
|
return '' if features_to_run == ''
|
110
|
-
|
110
|
+
|
111
111
|
profile_loader = Cucumber::Cli::ProfileLoader.new
|
112
|
-
|
112
|
+
|
113
113
|
profile ||= "autotest-all" if profile_loader.has_profile?("autotest-all") && features_to_run == :all
|
114
114
|
profile ||= "autotest" if profile_loader.has_profile?("autotest")
|
115
115
|
profile ||= nil
|
116
|
-
|
116
|
+
|
117
117
|
if profile
|
118
118
|
args = ["--profile", profile]
|
119
119
|
else
|
@@ -122,12 +122,12 @@ module Autotest::CucumberMixin
|
|
122
122
|
# No --color option as some IDEs (Netbeans) don't output them very well ([31m1 failed step[0m)
|
123
123
|
args += %w{--format rerun --out} << dirty_features_filename
|
124
124
|
args << (features_to_run == :all ? "" : features_to_run)
|
125
|
-
|
125
|
+
|
126
126
|
# Unless I do this, all the steps turn up undefined during the rerun...
|
127
127
|
unless features_to_run == :all
|
128
128
|
args << 'features/step_definitions' << 'features/support'
|
129
129
|
end
|
130
|
-
|
130
|
+
|
131
131
|
args = args.join(' ')
|
132
132
|
|
133
133
|
return "#{Cucumber::RUBY_BINARY} #{Cucumber::BINARY} #{args}"
|
data/lib/autotest/discover.rb
CHANGED
data/lib/cucumber.rb
CHANGED
@@ -13,14 +13,14 @@ require 'cucumber/term/ansicolor'
|
|
13
13
|
module Cucumber
|
14
14
|
class << self
|
15
15
|
attr_accessor :wants_to_quit
|
16
|
-
|
16
|
+
|
17
17
|
def logger
|
18
18
|
return @log if @log
|
19
19
|
@log = Logger.new(STDOUT)
|
20
20
|
@log.level = Logger::INFO
|
21
21
|
@log
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def logger=(logger)
|
25
25
|
@log = logger
|
26
26
|
end
|
data/lib/cucumber/ast.rb
CHANGED
@@ -22,7 +22,7 @@ module Cucumber
|
|
22
22
|
|
23
23
|
def step_collection(step_invocations)
|
24
24
|
init
|
25
|
-
unless(@first_collection_created)
|
25
|
+
unless((defined? @first_collection_created) and @first_collection_created)
|
26
26
|
@first_collection_created = true
|
27
27
|
@step_invocations.dup(step_invocations)
|
28
28
|
else
|
@@ -36,14 +36,14 @@ module Cucumber
|
|
36
36
|
visitor.visit_comment(@comment) unless @comment.empty?
|
37
37
|
visitor.visit_background_name(@keyword, name, file_colon_line(@line), source_indent(first_line_length))
|
38
38
|
with_visitor(hook_context, visitor) do
|
39
|
-
visitor.
|
39
|
+
visitor.runtime.before(hook_context)
|
40
40
|
skip_invoke! if failed?
|
41
41
|
visitor.visit_steps(@step_invocations)
|
42
42
|
@failed = @step_invocations.detect{|step_invocation| step_invocation.exception || step_invocation.status != :passed }
|
43
|
-
visitor.
|
43
|
+
visitor.runtime.after(hook_context) if @failed || @feature_elements.empty?
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
def with_visitor(scenario, visitor)
|
48
48
|
@current_visitor = visitor
|
49
49
|
init
|
@@ -55,7 +55,7 @@ module Cucumber
|
|
55
55
|
yield
|
56
56
|
end
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
def accept_hook?(hook)
|
60
60
|
init
|
61
61
|
if hook_context != self
|
@@ -71,7 +71,11 @@ module Cucumber
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def failed?
|
74
|
-
@failed
|
74
|
+
if defined? @failed
|
75
|
+
return @failed
|
76
|
+
else
|
77
|
+
return nil
|
78
|
+
end
|
75
79
|
end
|
76
80
|
|
77
81
|
def hook_context
|
@@ -92,7 +96,7 @@ module Cucumber
|
|
92
96
|
def fail!(exception)
|
93
97
|
@failed = true
|
94
98
|
@exception = exception
|
95
|
-
@current_visitor.visit_exception(@exception, :failed)
|
99
|
+
@current_visitor.visit_exception(@exception, :failed)
|
96
100
|
end
|
97
101
|
|
98
102
|
|