aslakhellesoy-cucumber 0.1.99.14 → 0.1.99.15
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +1 -2
- data/Manifest.txt +2 -0
- data/config/hoe.rb +1 -1
- data/examples/jbehave/features/support/env.rb +4 -4
- data/lib/cucumber/formatter/console.rb +1 -1
- data/lib/cucumber/jbehave.rb +77 -79
- data/lib/cucumber/parser.rb +2 -1
- data/lib/cucumber/version.rb +1 -1
- metadata +3 -3
data/History.txt
CHANGED
@@ -59,8 +59,7 @@ pure Ruby users have been enjoying for a while.
|
|
59
59
|
== TODO Before 0.2 release
|
60
60
|
* Verify that custom formatters work - write a feature for it
|
61
61
|
* Implement at least a basic HTML formatter
|
62
|
-
*
|
63
|
-
mvn compile && java -classpath /usr/local/jruby/lib/jruby-complete.jar:target/classes:/usr/local/jruby/lib/ruby/gems/1.8/gems/treetop-1.2.4/lib:/usr/local/jruby/lib/ruby/gems/1.8/gems/polyglot-0.2.3/lib:/usr/local/jruby/lib/ruby/gems/1.8/gems/term-ansicolor-1.0.3/lib:. cukes.Cucumber --help
|
62
|
+
* Run a single cucumber feature from rake "rake features FEATURE=/path/to/feature:line"
|
64
63
|
|
65
64
|
== Bugfixes
|
66
65
|
* -n option does not suppress the line info for a Scenario Outline (#175 Aslak Hellesøy)
|
data/Manifest.txt
CHANGED
@@ -113,6 +113,7 @@ examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Stock.java
|
|
113
113
|
examples/jbehave/src/main/java/cukes/jbehave/examples/trader/model/Trader.java
|
114
114
|
examples/jbehave/src/main/java/cukes/jbehave/examples/trader/persistence/TraderPersister.java
|
115
115
|
examples/jbehave/src/main/java/cukes/jbehave/examples/trader/scenarios/TraderSteps.java
|
116
|
+
examples/jbehave/target/maven-archiver/pom.properties
|
116
117
|
examples/selenium/Rakefile
|
117
118
|
examples/selenium/features/search.feature
|
118
119
|
examples/selenium/features/step_definitons/stories_steps.rb
|
@@ -161,6 +162,7 @@ gem_tasks/features.rake
|
|
161
162
|
gem_tasks/fix_cr_lf.rake
|
162
163
|
gem_tasks/flog.rake
|
163
164
|
gem_tasks/gemspec.rake
|
165
|
+
gem_tasks/jar.rake
|
164
166
|
gem_tasks/rspec.rake
|
165
167
|
gem_tasks/yard.rake
|
166
168
|
lib/autotest/cucumber.rb
|
data/config/hoe.rb
CHANGED
@@ -5,7 +5,7 @@ AUTHOR = 'Aslak Hellesøy' # can also be an array of Authors
|
|
5
5
|
EMAIL = "aslak.hellesoy@gmail.com"
|
6
6
|
DESCRIPTION = "Executable Feature scenarios"
|
7
7
|
GEM_NAME = 'cucumber' # what ppl will type to install your gem
|
8
|
-
HOMEPATH = "http://
|
8
|
+
HOMEPATH = "http://cukes.info"
|
9
9
|
RUBYFORGE_PROJECT = 'rspec'
|
10
10
|
|
11
11
|
@config_file = "~/.rubyforge/user-config.yml"
|
@@ -1,7 +1,7 @@
|
|
1
|
-
$:.unshift(File.dirname(__FILE__) + '/../../target')
|
2
|
-
require 'jbehave-example-0.2-SNAPSHOT.jar'
|
3
|
-
|
4
1
|
require 'cucumber/jbehave'
|
5
2
|
|
3
|
+
project_code = File.expand_path(File.dirname(__FILE__) + '/../../target/jbehave-example-0.2-SNAPSHOT.jar')
|
4
|
+
require project_code
|
5
|
+
|
6
6
|
import 'cukes.jbehave.examples.trader.scenarios.TraderSteps'
|
7
|
-
JBehave(TraderSteps.new)
|
7
|
+
JBehave(TraderSteps.new)
|
@@ -7,7 +7,7 @@ module Cucumber
|
|
7
7
|
FORMATS = Hash.new{|hash, format| hash[format] = method(format).to_proc}
|
8
8
|
|
9
9
|
def format_step(keyword, step_name, status, step_definition, source_indent)
|
10
|
-
comment = if source_indent
|
10
|
+
comment = if source_indent && step_definition
|
11
11
|
c = (' # ' + step_definition.file_colon_line).indent(source_indent)
|
12
12
|
format_string(c, :comment)
|
13
13
|
else
|
data/lib/cucumber/jbehave.rb
CHANGED
@@ -1,104 +1,102 @@
|
|
1
|
-
|
1
|
+
if defined?(JRUBY_VERSION)
|
2
|
+
require 'java'
|
2
3
|
|
3
|
-
|
4
|
-
$:.unshift(ENV['HOME'] + '/.m2/repository/junit/junit/4.4')
|
5
|
-
$:.unshift(ENV['HOME'] + '/.m2/repository/org/jbehave/jbehave-core/2.1')
|
4
|
+
Exception::CUCUMBER_FILTER_PATTERNS.unshift(/^org\/jruby|^org\/jbehave|^org\/junit|^java\/|^sun\/|^\$_dot_dot_/)
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
module JBehave
|
15
|
-
# Register an instance of org.jbehave.scenario.steps.Steps
|
16
|
-
def JBehave(jbehave_steps)
|
17
|
-
jbehave_steps.getSteps.each do |jbehave_candidate_step|
|
18
|
-
step_definitions << JBehaveStepDefinition.new(jbehave_steps, jbehave_candidate_step)
|
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
|
19
13
|
end
|
20
|
-
end
|
21
|
-
|
22
|
-
# Open up so we can get the pattern....
|
23
|
-
JBehaveCandidateStep = org.jbehave.scenario.steps.CandidateStep
|
24
|
-
class JBehaveCandidateStep
|
25
|
-
field_reader :pattern
|
26
|
-
end
|
27
14
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
@jbehave_candidate_step = jbehave_candidate_step
|
15
|
+
# Open up so we can get the pattern....
|
16
|
+
JBehaveCandidateStep = org.jbehave.scenario.steps.CandidateStep
|
17
|
+
class JBehaveCandidateStep
|
18
|
+
field_reader :pattern
|
33
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
|
+
end
|
34
27
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
28
|
+
def match(step_name)
|
29
|
+
full_text = "Given #{step_name}" # JBehave doesn't distinguish GWT internally :-)
|
30
|
+
@jbehave_candidate_step.matches(full_text)
|
31
|
+
end
|
39
32
|
|
40
|
-
|
41
|
-
|
42
|
-
|
33
|
+
def file_colon_line
|
34
|
+
@jbehave_steps.java_class.name
|
35
|
+
end
|
43
36
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
37
|
+
def format_args(step_name, format)
|
38
|
+
java_pattern = @jbehave_candidate_step.pattern.pattern
|
39
|
+
regexp = Regexp.new(java_pattern)
|
40
|
+
step_name.gzub(regexp, format)
|
41
|
+
end
|
49
42
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
43
|
+
def matched_args(step_name)
|
44
|
+
java_pattern = @jbehave_candidate_step.pattern.pattern
|
45
|
+
regexp = Regexp.new(java_pattern)
|
46
|
+
step_name.match(regexp).captures
|
47
|
+
end
|
55
48
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
49
|
+
def execute(step_name, world, *args)
|
50
|
+
step = @jbehave_candidate_step.createFrom("Given #{step_name}")
|
51
|
+
result = step.perform
|
52
|
+
result.describeTo(JBehave::REPORTER)
|
53
|
+
end
|
60
54
|
end
|
61
|
-
end
|
62
|
-
|
63
|
-
class JBehaveException < Exception
|
64
|
-
end
|
65
55
|
|
66
|
-
|
67
|
-
class Reporter
|
68
|
-
def successful(step_text)
|
69
|
-
# noop
|
56
|
+
class JBehaveException < Exception
|
70
57
|
end
|
71
58
|
|
72
|
-
|
73
|
-
|
74
|
-
|
59
|
+
# Implements the org.jbehave.scenario.reporters.ScenarioReporter methods
|
60
|
+
class Reporter
|
61
|
+
def successful(step_text)
|
62
|
+
# noop
|
63
|
+
end
|
64
|
+
|
65
|
+
def failed(step, java_exception)
|
66
|
+
raise java_exception_to_ruby_exception(java_exception)
|
67
|
+
end
|
75
68
|
|
76
|
-
|
69
|
+
private
|
77
70
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
71
|
+
def java_exception_to_ruby_exception(java_exception)
|
72
|
+
# OK, this is a little funky - JRuby weirdness
|
73
|
+
ruby_exception = org.jruby.NativeException.new(JRuby.runtime, JBehaveException, java_exception)
|
74
|
+
ruby_exception.set_backtrace([]) # work around backtrace bug in jruby
|
82
75
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
76
|
+
exception = JBehaveException.new(java_exception.getMessage)
|
77
|
+
bt = ruby_exception.backtrace
|
78
|
+
Exception.cucumber_strip_backtrace!(bt, nil, nil)
|
79
|
+
exception.set_backtrace(bt)
|
80
|
+
exception
|
81
|
+
end
|
88
82
|
end
|
89
|
-
end
|
90
83
|
|
91
|
-
|
84
|
+
REPORTER = Reporter.new
|
92
85
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
86
|
+
def self.snippet_text(step_keyword, step_name)
|
87
|
+
camel = step_name.gsub(/(\s.)/) {$1.upcase.strip}
|
88
|
+
method = camel[0..0].downcase + camel[1..-1]
|
89
|
+
snippet = %{ @#{step_keyword}("#{step_name}")
|
97
90
|
public void #{method}() {
|
91
|
+
throw new RuntimeException("pending");
|
98
92
|
}}
|
93
|
+
end
|
99
94
|
end
|
100
95
|
end
|
101
|
-
end
|
102
96
|
|
103
|
-
self.extend(Cucumber::JBehave)
|
104
|
-
self.snippet_generator = Cucumber::JBehave
|
97
|
+
self.extend(Cucumber::JBehave)
|
98
|
+
self.snippet_generator = Cucumber::JBehave
|
99
|
+
else
|
100
|
+
STDERR.puts "ERROR: cucumber/jbehave only works with JRuby"
|
101
|
+
Kernel.exit(1)
|
102
|
+
end
|
data/lib/cucumber/parser.rb
CHANGED
@@ -26,7 +26,8 @@ module Cucumber
|
|
26
26
|
class Loader
|
27
27
|
def initialize(keywords)
|
28
28
|
@keywords = keywords
|
29
|
-
|
29
|
+
i18n_tt = File.expand_path(File.dirname(__FILE__) + '/parser/i18n.tt')
|
30
|
+
template = File.open(i18n_tt, Cucumber.file_mode('r')).read
|
30
31
|
erb = ERB.new(template)
|
31
32
|
grammar = erb.result(binding)
|
32
33
|
Treetop.load_from_string(grammar)
|
data/lib/cucumber/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.99.15
|
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-01-
|
12
|
+
date: 2009-01-29 00:00:00 -08:00
|
13
13
|
default_executable: cucumber
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -337,7 +337,7 @@ files:
|
|
337
337
|
- spec/spec.opts
|
338
338
|
- spec/spec_helper.rb
|
339
339
|
has_rdoc: true
|
340
|
-
homepage: http://
|
340
|
+
homepage: http://cukes.info
|
341
341
|
post_install_message:
|
342
342
|
rdoc_options:
|
343
343
|
- --main
|