kosmas58-cucumber 0.2.0.1 → 0.2.2.1
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/History.txt +32 -1
- data/Manifest.txt +4 -11
- data/examples/dos_line_endings/features/dos_line_endings.feature +9 -9
- data/examples/pure_java/README.textile +5 -0
- data/examples/self_test/features/tons_of_cukes.feature +52 -0
- data/examples/sinatra/features/support/env.rb +6 -2
- data/examples/tickets/features/248.feature +11 -0
- data/examples/tickets/features/step_definitons/248_steps.rb +15 -0
- data/features/cucumber_cli.feature +1 -1
- data/features/custom_formatter.feature +2 -2
- data/features/usage.feature +108 -0
- data/gem_tasks/features.rake +18 -6
- data/lib/autotest/cucumber_mixin.rb +1 -1
- data/lib/cucumber/ast/feature.rb +1 -1
- data/lib/cucumber/ast/features.rb +6 -0
- data/lib/cucumber/ast/step.rb +4 -0
- data/lib/cucumber/ast/step_invocation.rb +10 -2
- data/lib/cucumber/ast/table.rb +4 -0
- data/lib/cucumber/cli/configuration.rb +11 -14
- data/lib/cucumber/cli/main.rb +14 -21
- data/lib/cucumber/core_ext/exception.rb +1 -1
- data/lib/cucumber/formatter.rb +1 -1
- data/lib/cucumber/formatter/html.rb +47 -8
- data/lib/cucumber/formatter/pretty.rb +1 -2
- data/lib/cucumber/formatter/rerun.rb +8 -0
- data/lib/cucumber/formatter/usage.rb +69 -0
- data/lib/cucumber/languages.yml +7 -2
- data/lib/cucumber/rails/world.rb +22 -21
- data/lib/cucumber/step_definition.rb +65 -54
- data/lib/cucumber/step_match.rb +10 -2
- data/lib/cucumber/step_mother.rb +4 -10
- data/lib/cucumber/version.rb +1 -1
- data/rails_generators/cucumber/templates/env.rb +2 -0
- data/rails_generators/feature/templates/steps.erb +1 -1
- data/spec/cucumber/ast/feature_spec.rb +2 -1
- data/spec/cucumber/cli/configuration_spec.rb +18 -6
- data/spec/cucumber/cli/main_spec.rb +1 -14
- data/spec/cucumber/parser/feature_parser_spec.rb +15 -15
- data/spec/cucumber/step_definition_spec.rb +21 -9
- data/spec/cucumber/step_mother_spec.rb +17 -1
- metadata +8 -13
- data/examples/jbehave/README.textile +0 -20
- data/examples/jbehave/features/support/env.rb +0 -7
- data/examples/jbehave/features/trading.feature +0 -28
- data/examples/jbehave/pom.xml +0 -53
- data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/converters/TraderConverter.java +0 -32
- data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Stock.java +0 -42
- data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Trader.java +0 -29
- data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/persistence/TraderPersister.java +0 -22
- data/examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java +0 -70
- data/gem_tasks/jar.rake +0 -67
- data/lib/cucumber/jbehave.rb +0 -97
data/gem_tasks/jar.rake
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
# http://blog.nicksieger.com/articles/2009/01/10/jruby-1-1-6-gems-in-a-jar
|
2
|
-
|
3
|
-
USE_JRUBY_VERSION = '1.1.6'
|
4
|
-
USE_JBEHAVE_VERSION = '2.1'
|
5
|
-
USE_JUNIT_VERSION = '4.5'
|
6
|
-
USE_HAMCREST_VERSION = '1.1'
|
7
|
-
CUCUMBER_VERSIONED = "cucumber-#{Cucumber::VERSION::STRING}"
|
8
|
-
|
9
|
-
task :jar => [
|
10
|
-
:clean,
|
11
|
-
'jar:download_jruby',
|
12
|
-
'jar:install_gems',
|
13
|
-
'jar:bundle_gems',
|
14
|
-
'jar:download_jars_deps',
|
15
|
-
'jar:unpack_jar_deps',
|
16
|
-
'jar:bundle_jars',
|
17
|
-
'jar:fix_gem_binaries',
|
18
|
-
'jar:test_jar'
|
19
|
-
]
|
20
|
-
|
21
|
-
namespace :jar do
|
22
|
-
task :download_jruby do
|
23
|
-
sh "wget http://dist.codehaus.org/jruby/#{USE_JRUBY_VERSION}/jruby-complete-#{USE_JRUBY_VERSION}.jar -O #{CUCUMBER_VERSIONED}.jar"
|
24
|
-
end
|
25
|
-
|
26
|
-
task :install_gems => :gem do
|
27
|
-
mkdir 'pkg/jar_gems'
|
28
|
-
sh "java -jar #{CUCUMBER_VERSIONED}.jar -S gem install -i ./pkg/jar_gems pkg/#{CUCUMBER_VERSIONED}.gem --no-ri --no-rdoc"
|
29
|
-
end
|
30
|
-
|
31
|
-
task :bundle_gems do
|
32
|
-
sh "jar uf #{CUCUMBER_VERSIONED}.jar -C pkg/jar_gems ."
|
33
|
-
end
|
34
|
-
|
35
|
-
task :download_jars_deps do
|
36
|
-
mkdir 'pkg/jar_deps'
|
37
|
-
sh "wget http://repository.codehaus.org/org/jbehave/jbehave-core/#{USE_JBEHAVE_VERSION}/jbehave-core-#{USE_JBEHAVE_VERSION}.jar -O pkg/jar_deps/jbehave-core-#{USE_JBEHAVE_VERSION}.jar"
|
38
|
-
sh "wget http://mirrors.ibiblio.org/pub/mirrors/maven2/junit/junit/#{USE_JUNIT_VERSION}/junit-#{USE_JUNIT_VERSION}.jar -O pkg/jar_deps/junit-#{USE_JUNIT_VERSION}.jar"
|
39
|
-
sh "wget http://hamcrest.googlecode.com/files/hamcrest-all-#{USE_HAMCREST_VERSION}.jar -O pkg/jar_deps/hamcrest-all-#{USE_HAMCREST_VERSION}.jar"
|
40
|
-
end
|
41
|
-
|
42
|
-
task :unpack_jar_deps do
|
43
|
-
Dir.chdir 'pkg/jar_deps' do
|
44
|
-
Dir['*.jar'].each do |jar|
|
45
|
-
sh "jar xvf #{jar}"
|
46
|
-
rm_rf jar
|
47
|
-
rm_rf 'META-INF'
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
task :bundle_jars do
|
53
|
-
sh "jar uf #{CUCUMBER_VERSIONED}.jar -C pkg/jar_deps ."
|
54
|
-
end
|
55
|
-
|
56
|
-
task :fix_gem_binaries do
|
57
|
-
mkdir_p 'pkg/gem_binaries/META-INF/jruby.home'
|
58
|
-
Dir.chdir 'pkg/gem_binaries/META-INF/jruby.home' do
|
59
|
-
sh "jar xvf ../../../../#{CUCUMBER_VERSIONED}.jar bin"
|
60
|
-
end
|
61
|
-
sh "jar uf #{CUCUMBER_VERSIONED}.jar -C pkg/gem_binaries ."
|
62
|
-
end
|
63
|
-
|
64
|
-
task :test_jar do
|
65
|
-
sh "java -cp examples/jbehave/target/classes -jar #{CUCUMBER_VERSIONED}.jar -S cucumber examples/jbehave/features"
|
66
|
-
end
|
67
|
-
end
|
data/lib/cucumber/jbehave.rb
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
if defined?(JRUBY_VERSION)
|
2
|
-
require 'java'
|
3
|
-
|
4
|
-
Exception::CUCUMBER_FILTER_PATTERNS.unshift(/^org\/jruby|^org\/jbehave|^org\/junit|^java\/|^sun\/|^\$_dot_dot_/)
|
5
|
-
|
6
|
-
module Cucumber
|
7
|
-
module JBehave
|
8
|
-
# Register an instance of org.jbehave.scenario.steps.Steps
|
9
|
-
def JBehave(jbehave_steps)
|
10
|
-
jbehave_steps.getSteps.each do |jbehave_candidate_step|
|
11
|
-
step_definitions << JBehaveStepDefinition.new(jbehave_steps, jbehave_candidate_step)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
# Open up so we can get the pattern....
|
16
|
-
JBehaveCandidateStep = org.jbehave.scenario.steps.CandidateStep
|
17
|
-
class JBehaveCandidateStep
|
18
|
-
field_reader :pattern
|
19
|
-
end
|
20
|
-
|
21
|
-
# Adapter for JBehave org.jbehave.scenario.steps.CandidateStep
|
22
|
-
class JBehaveStepDefinition
|
23
|
-
def initialize(jbehave_steps, jbehave_candidate_step)
|
24
|
-
@jbehave_steps = jbehave_steps
|
25
|
-
@jbehave_candidate_step = jbehave_candidate_step
|
26
|
-
@regexp = Regexp.new(jbehave_candidate_step.pattern.pattern)
|
27
|
-
end
|
28
|
-
|
29
|
-
def step_match(name_to_match, name_to_report)
|
30
|
-
if(match = name_to_match.match(@regexp))
|
31
|
-
StepMatch.new(self, name_to_match, name_to_report, match.captures)
|
32
|
-
else
|
33
|
-
nil
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def file_colon_line
|
38
|
-
@jbehave_steps.java_class.name
|
39
|
-
end
|
40
|
-
|
41
|
-
def format_args(step_name, format)
|
42
|
-
step_name.gzub(@regexp, format)
|
43
|
-
end
|
44
|
-
|
45
|
-
def invoke(world, args, step_name)
|
46
|
-
step = @jbehave_candidate_step.createFrom("Given #{step_name}") # JBehave doesn't care about the adverb.
|
47
|
-
step = @jbehave_candidate_step.__send__(:createStep, "Given #{step_name}", args) # JBehave doesn't care about the adverb.
|
48
|
-
|
49
|
-
result = step.perform
|
50
|
-
result.describeTo(Reporter)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# Implements the org.jbehave.scenario.reporters.ScenarioReporter methods
|
55
|
-
class Reporter
|
56
|
-
def self.successful(step_text)
|
57
|
-
# noop
|
58
|
-
end
|
59
|
-
|
60
|
-
def self.failed(step, java_exception)
|
61
|
-
raise java_exception_to_ruby_exception(java_exception)
|
62
|
-
end
|
63
|
-
|
64
|
-
private
|
65
|
-
|
66
|
-
def self.java_exception_to_ruby_exception(java_exception)
|
67
|
-
# OK, this is a little funky - JRuby weirdness
|
68
|
-
ruby_exception = org.jruby.NativeException.new(JRuby.runtime, JBehaveException, java_exception)
|
69
|
-
ruby_exception.set_backtrace([]) # work around backtrace bug in jruby
|
70
|
-
exception = JBehaveException.new("#{java_exception.getClass.getName}: #{java_exception.getMessage}")
|
71
|
-
bt = ruby_exception.backtrace
|
72
|
-
Exception.cucumber_strip_backtrace!(bt, nil, nil)
|
73
|
-
exception.set_backtrace(bt)
|
74
|
-
exception
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
class JBehaveException < Exception
|
79
|
-
end
|
80
|
-
|
81
|
-
def self.snippet_text(step_keyword, step_name)
|
82
|
-
camel = step_name.gsub(/(\s.)/) {$1.upcase.strip}
|
83
|
-
method = camel[0..0].downcase + camel[1..-1]
|
84
|
-
snippet = %{ @#{step_keyword}("#{step_name}")
|
85
|
-
public void #{method}() {
|
86
|
-
throw new RuntimeException("pending");
|
87
|
-
}}
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
self.extend(Cucumber::JBehave)
|
93
|
-
self.snippet_generator = Cucumber::JBehave
|
94
|
-
else
|
95
|
-
STDERR.puts "ERROR: cucumber/jbehave only works with JRuby"
|
96
|
-
Kernel.exit(1)
|
97
|
-
end
|