aslakhellesoy-cucumber 0.3.3.6 → 0.3.4
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 +5 -1
- data/Manifest.txt +1 -1
- data/examples/cs/features/addition.feature +5 -5
- data/examples/cs/features/step_definitons/calculator_steps.rb +2 -2
- data/examples/java/README.textile +2 -6
- data/examples/java/build.xml +26 -0
- data/examples/java/features/step_definitons/hello_steps.rb +0 -2
- data/lib/cucumber/core_ext/proc.rb +9 -13
- data/lib/cucumber/formatter/junit.rb +1 -1
- data/lib/cucumber/step_mother.rb +3 -0
- data/lib/cucumber/version.rb +2 -2
- metadata +2 -2
- data/examples/java/Rakefile +0 -13
data/History.txt
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
== 0.3.4
|
1
|
+
== 0.3.4 2009-05-14
|
2
2
|
|
3
3
|
A couple of great new features in this release. Running with Rake is faster than before,
|
4
4
|
and there is a brand new JUnit formatter - great for Continuous Integration reports!
|
5
5
|
|
6
|
+
This release was made especially for the Oslo XP Meetup today.
|
7
|
+
|
6
8
|
** IMPORTANT UPGRADE NOTES FOR RAILS USERS **
|
7
9
|
|
8
10
|
Running Cucumber features in the same Ruby interpreter as Rake doesn't seem to work,
|
@@ -22,6 +24,7 @@ Alternatively you can omit forking and run features like this:
|
|
22
24
|
However, setting the RAILS_ENV is easy to forget, so I don't recommend relying on this.
|
23
25
|
|
24
26
|
=== Bugfixes
|
27
|
+
* Hooks (World, Before, After) are no longer executed when --dry-run (Aslak Hellesøy)
|
25
28
|
* Proper UTF8 use in HTML formatter (Herminio Torres)
|
26
29
|
* Problem with multiple terms in languages.yml (#321 Aslak Hellesøy)
|
27
30
|
|
@@ -32,6 +35,7 @@ However, setting the RAILS_ENV is easy to forget, so I don't recommend relying o
|
|
32
35
|
* Support for Catalan (Francesc Esplugas)
|
33
36
|
|
34
37
|
=== Changed features
|
38
|
+
* The Java example under examples/java uses Ant instead of Rake - and the new JUnit formatter.
|
35
39
|
* Rake task should not shell out (#297 Aslak Hellesøy)
|
36
40
|
The Cucumber Rake task will run Cucumber in the same Ruby interpreter as Rake itself
|
37
41
|
unless explicitly told to fork a new interpreter. This is to increase speed. You can
|
data/Manifest.txt
CHANGED
@@ -151,7 +151,7 @@ examples/i18n/zh-TW/features/division.feature
|
|
151
151
|
examples/i18n/zh-TW/features/step_definitons/calculator_steps.rb
|
152
152
|
examples/i18n/zh-TW/lib/calculator.rb
|
153
153
|
examples/java/README.textile
|
154
|
-
examples/java/
|
154
|
+
examples/java/build.xml
|
155
155
|
examples/java/features/hello.feature
|
156
156
|
examples/java/features/step_definitons/hello_steps.rb
|
157
157
|
examples/java/features/step_definitons/tree_steps.rb
|
@@ -3,13 +3,13 @@ Feature: Addition
|
|
3
3
|
As a math idiot
|
4
4
|
I want to be told the sum of two numbers
|
5
5
|
|
6
|
-
Scenario: Add two numbers
|
7
|
-
Given I have entered
|
8
|
-
And I have entered
|
6
|
+
Scenario Outline: Add two numbers
|
7
|
+
Given I have entered <input_1> into the calculator
|
8
|
+
And I have entered <input_2> into the calculator
|
9
9
|
When I press add
|
10
|
-
Then the result should be
|
10
|
+
Then the result should be <output> on the screen
|
11
11
|
|
12
|
-
|
12
|
+
Examples:
|
13
13
|
| input_1 | input_2 | output |
|
14
14
|
| 20 | 30 | 50 |
|
15
15
|
| 2 | 5 | 7 |
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec/expectations'
|
2
2
|
$:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project
|
3
|
-
require 'Calculator'
|
3
|
+
require 'Calculator' # Calculator.dll
|
4
4
|
|
5
5
|
Before do
|
6
|
-
@calc = Demo::Calculator.new
|
6
|
+
@calc = Demo::Calculator.new # A .NET class in Calculator.dll
|
7
7
|
end
|
8
8
|
|
9
9
|
Given "I have entered $n into the calculator" do |n|
|
@@ -1,11 +1,10 @@
|
|
1
1
|
h1. Using Cucumber with Java
|
2
2
|
|
3
3
|
This directory contains code to demonstrate how Cucumber can be used to develop Java code.
|
4
|
-
You need JRuby 1.1.3 or higher installed and JRuby's bin directory on your PATH.
|
5
4
|
|
6
5
|
h2. Installing required gems
|
7
6
|
|
8
|
-
jruby -S gem install
|
7
|
+
jruby -S gem install cucumber
|
9
8
|
jruby -S gem install diff-lcs
|
10
9
|
|
11
10
|
h2. Running the scenarios
|
@@ -13,10 +12,7 @@ h2. Running the scenarios
|
|
13
12
|
Open a shell in this directory (java) and execute the following command:
|
14
13
|
|
15
14
|
<pre><code>
|
16
|
-
|
15
|
+
ant
|
17
16
|
</code></pre>
|
18
17
|
|
19
|
-
This will compile the java code and package it in a jar file, and then run Cucumber against
|
20
|
-
that code.
|
21
|
-
|
22
18
|
There is a deliberate error. See if you can fix it!
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<project name="Cucumber Demo" default="cucumber" basedir=".">
|
2
|
+
<target name ="compile" description="Compile classes">
|
3
|
+
<mkdir dir="build" />
|
4
|
+
<javac srcdir="src" destdir="build" />
|
5
|
+
</target>
|
6
|
+
|
7
|
+
<target name="cucumber" depends="compile" description="Run Cucumber">
|
8
|
+
<property environment="ENV" />
|
9
|
+
<java classname="org.jruby.Main" fork="true" failonerror="true">
|
10
|
+
<classpath>
|
11
|
+
<pathelement path="${ENV.JRUBY_HOME}/lib/jruby.jar"/>
|
12
|
+
<pathelement path="build"/>
|
13
|
+
</classpath>
|
14
|
+
<jvmarg value="-Djruby.home=${ENV.JRUBY_HOME}"/>
|
15
|
+
<arg value="-S"/>
|
16
|
+
<arg value="cucumber"/>
|
17
|
+
<arg value="--format"/>
|
18
|
+
<arg value="pretty"/>
|
19
|
+
<arg value="--format"/>
|
20
|
+
<arg value="junit"/>
|
21
|
+
<arg value="--out"/>
|
22
|
+
<arg value="build"/>
|
23
|
+
<arg value="features"/>
|
24
|
+
</java>
|
25
|
+
</target>
|
26
|
+
</project>
|
@@ -2,15 +2,15 @@
|
|
2
2
|
class Proc
|
3
3
|
PROC_PATTERN = /[\d\w]+@(.*):(.*)>/
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
end
|
5
|
+
def to_comment_line
|
6
|
+
"# #{file_colon_line}"
|
7
|
+
end
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
def backtrace_line(name)
|
10
|
+
"#{file_colon_line}:in `#{name}'"
|
11
|
+
end
|
13
12
|
|
13
|
+
if Proc.new{}.to_s =~ PROC_PATTERN
|
14
14
|
def file_colon_line
|
15
15
|
path, line = *to_s.match(PROC_PATTERN)[1..2]
|
16
16
|
path = File.expand_path(path)
|
@@ -22,12 +22,8 @@ class Proc
|
|
22
22
|
# This Ruby implementation doesn't implement Proc#to_s correctly
|
23
23
|
STDERR.puts "*** THIS RUBY IMPLEMENTATION DOESN'T REPORT FILE AND LINE FOR PROCS ***"
|
24
24
|
|
25
|
-
def
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def to_comment_line
|
30
|
-
""
|
25
|
+
def file_colon_line
|
26
|
+
"UNKNOWN:-1"
|
31
27
|
end
|
32
28
|
end
|
33
29
|
end
|
@@ -66,7 +66,7 @@ module Cucumber
|
|
66
66
|
private
|
67
67
|
|
68
68
|
def convert_to_file_name(feature_name)
|
69
|
-
@reportdir
|
69
|
+
File.join(@reportdir, "TEST-" + feature_name.gsub(/[^\w_\.]/, '_') + ".xml")
|
70
70
|
end
|
71
71
|
|
72
72
|
def format_exception(exception)
|
data/lib/cucumber/step_mother.rb
CHANGED
@@ -262,6 +262,7 @@ module Cucumber
|
|
262
262
|
|
263
263
|
# Creates a new world instance
|
264
264
|
def new_world!
|
265
|
+
return if options[:dry_run]
|
265
266
|
create_world!
|
266
267
|
extend_world
|
267
268
|
connect_world
|
@@ -309,12 +310,14 @@ module Cucumber
|
|
309
310
|
end
|
310
311
|
|
311
312
|
def execute_before(scenario)
|
313
|
+
return if options[:dry_run]
|
312
314
|
hooks_for(:before, scenario).each do |hook|
|
313
315
|
hook.execute_in(@current_world, scenario, 'Before')
|
314
316
|
end
|
315
317
|
end
|
316
318
|
|
317
319
|
def execute_after(scenario)
|
320
|
+
return if options[:dry_run]
|
318
321
|
hooks_for(:after, scenario).each do |hook|
|
319
322
|
hook.execute_in(@current_world, scenario, 'After')
|
320
323
|
end
|
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.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Aslak Helles\xC3\xB8y"
|
@@ -228,7 +228,7 @@ files:
|
|
228
228
|
- examples/i18n/zh-TW/features/step_definitons/calculator_steps.rb
|
229
229
|
- examples/i18n/zh-TW/lib/calculator.rb
|
230
230
|
- examples/java/README.textile
|
231
|
-
- examples/java/
|
231
|
+
- examples/java/build.xml
|
232
232
|
- examples/java/features/hello.feature
|
233
233
|
- examples/java/features/step_definitons/hello_steps.rb
|
234
234
|
- examples/java/features/step_definitons/tree_steps.rb
|
data/examples/java/Rakefile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
2
|
-
require 'cucumber/rake/task'
|
3
|
-
|
4
|
-
raise "This example only works with JRuby" unless Cucumber::JRUBY
|
5
|
-
Cucumber::Rake::Task.new(:features) do |t|
|
6
|
-
t.cucumber_opts = %w{--format pretty}
|
7
|
-
end
|
8
|
-
|
9
|
-
task :features => :compile
|
10
|
-
|
11
|
-
task :compile do
|
12
|
-
sh "javac src/cucumber/demo/Hello.java && jar cf src/cucumber_demo.jar -C src cucumber/demo/Hello.class"
|
13
|
-
end
|