aslakhellesoy-cucumber 0.1.10 → 0.1.11
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 -0
- data/Manifest.txt +1 -0
- data/Rakefile +1 -2
- data/config/hoe.rb +0 -1
- data/gem_tasks/rspec.rake +28 -14
- data/lib/autotest/cucumber_mixin.rb +23 -1
- data/lib/cucumber.rb +0 -1
- data/lib/cucumber/cli.rb +13 -2
- data/lib/cucumber/core_ext/string.rb +7 -0
- data/lib/cucumber/executor.rb +0 -2
- data/lib/cucumber/platform.rb +1 -0
- data/lib/cucumber/step_mother.rb +1 -1
- data/lib/cucumber/tree.rb +0 -2
- data/lib/cucumber/tree/scenario.rb +1 -0
- data/lib/cucumber/version.rb +1 -1
- data/rails_generators/cucumber/templates/env.rb +4 -1
- data/rails_generators/cucumber/templates/webrat_steps.rb +14 -16
- data/spec/cucumber/cli_spec.rb +24 -5
- metadata +2 -11
data/History.txt
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
== 0.1.11 (In Git)
|
2
2
|
|
3
3
|
== New features
|
4
|
+
* Capture output from cucumber in Autotest (Alan Larkin)
|
5
|
+
* Update cucumber generator to work with latest Webrat (Bryan Helkamp)
|
4
6
|
* CUCUMBR LIKEZ 2 SPEEK WIF KATS. KTHXBAI (Aimee Daniells)
|
5
7
|
* Support for dynamically pluggable formatters (#99 Joseph Wilk)
|
6
8
|
* --verbose mode to see ruby files and feature files loaded by Cucumber (#106 Joseph Wilk)
|
7
9
|
|
8
10
|
== Bugfixes
|
11
|
+
* The jcode library is not loaded on JRuby/Rails. Workaround for http://tinyurl.com/55uu3u. (Aslak Hellesøy)
|
12
|
+
* Support including modules for class passed to --format (#109 Joseph Wilk)
|
9
13
|
|
10
14
|
== Removed features
|
15
|
+
* The cucumber gem no longer depends on the rspec gem. It must be downloaded manually if RSpec is used.
|
11
16
|
|
12
17
|
== 0.1.10 2008-11-25
|
13
18
|
|
data/Manifest.txt
CHANGED
@@ -166,6 +166,7 @@ lib/cucumber/treetop_parser/feature_ar.rb
|
|
166
166
|
lib/cucumber/treetop_parser/feature_cy.rb
|
167
167
|
lib/cucumber/treetop_parser/feature_da.rb
|
168
168
|
lib/cucumber/treetop_parser/feature_de.rb
|
169
|
+
lib/cucumber/treetop_parser/feature_en-lol.rb
|
169
170
|
lib/cucumber/treetop_parser/feature_en-tx.rb
|
170
171
|
lib/cucumber/treetop_parser/feature_en.rb
|
171
172
|
lib/cucumber/treetop_parser/feature_es.rb
|
data/Rakefile
CHANGED
@@ -5,5 +5,4 @@ require 'config/hoe' # setup Hoe + all gem configuration
|
|
5
5
|
Dir['gem_tasks/**/*.rake'].each { |rake| load rake }
|
6
6
|
|
7
7
|
# Hoe gives us :default => :test, but we don't have Test::Unit tests.
|
8
|
-
Rake::Task[:default].clear_prerequisites
|
9
|
-
task :default => [:spec, :features]
|
8
|
+
Rake::Task[:default].clear_prerequisites
|
data/config/hoe.rb
CHANGED
@@ -58,7 +58,6 @@ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
58
58
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
59
59
|
#p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
60
60
|
p.extra_deps = [ ['term-ansicolor', '>= 1.0.3'], ['treetop', '>= 1.2.4'], ['diff-lcs', '>= 1.1.2'] ]
|
61
|
-
p.extra_dev_deps = [ ['rspec', '>= 1.1.11'] ]
|
62
61
|
|
63
62
|
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
64
63
|
|
data/gem_tasks/rspec.rake
CHANGED
@@ -1,21 +1,35 @@
|
|
1
|
-
|
1
|
+
def unable_to_load
|
2
|
+
STDERR.puts <<-EOS
|
3
|
+
To use rspec for testing you must install rspec gem:
|
4
|
+
gem install rspec
|
5
|
+
|
6
|
+
EOS
|
7
|
+
nil
|
8
|
+
end
|
9
|
+
|
10
|
+
def require_spec
|
2
11
|
require 'spec'
|
3
12
|
rescue LoadError
|
13
|
+
require_spec_with_rubygems
|
14
|
+
end
|
15
|
+
|
16
|
+
def require_spec_with_rubygems
|
4
17
|
require 'rubygems'
|
5
18
|
require 'spec'
|
6
|
-
end
|
7
|
-
begin
|
8
|
-
require 'spec/rake/spectask'
|
9
19
|
rescue LoadError
|
10
|
-
|
11
|
-
To use rspec for testing you must install rspec gem:
|
12
|
-
gem install rspec
|
13
|
-
EOS
|
14
|
-
exit(0)
|
20
|
+
unable_to_load
|
15
21
|
end
|
16
22
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
23
|
+
if require_spec
|
24
|
+
begin
|
25
|
+
require 'spec/rake/spectask'
|
26
|
+
rescue LoadError
|
27
|
+
unable_to_load
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "Run the Cucumber specs"
|
31
|
+
Spec::Rake::SpecTask.new do |t|
|
32
|
+
t.spec_opts = ['--options', "spec/spec.opts"]
|
33
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
34
|
+
end
|
35
|
+
end
|
@@ -70,7 +70,29 @@ module Autotest::CucumberMixin
|
|
70
70
|
cmd = self.make_cucumber_cmd self.scenarios_to_run, dirty_scenarios_file.path
|
71
71
|
return if cmd.empty?
|
72
72
|
puts cmd unless $q
|
73
|
-
|
73
|
+
old_sync = $stdout.sync
|
74
|
+
$stdout.sync = true
|
75
|
+
self.results = []
|
76
|
+
line = []
|
77
|
+
begin
|
78
|
+
open("| #{cmd}", "r") do |f|
|
79
|
+
until f.eof? do
|
80
|
+
c = f.getc
|
81
|
+
putc c
|
82
|
+
line << c
|
83
|
+
if c == ?\n then
|
84
|
+
self.results << if RUBY_VERSION >= "1.9" then
|
85
|
+
line.join
|
86
|
+
else
|
87
|
+
line.pack "c*"
|
88
|
+
end
|
89
|
+
line.clear
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
ensure
|
94
|
+
$stdout.sync = old_sync
|
95
|
+
end
|
74
96
|
self.scenarios_to_run = dirty_scenarios_file.readlines.map { |l| l.chomp }
|
75
97
|
self.tainted = true unless self.scenarios_to_run == []
|
76
98
|
end
|
data/lib/cucumber.rb
CHANGED
data/lib/cucumber/cli.rb
CHANGED
@@ -256,13 +256,13 @@ Defined profiles in cucumber.yml:
|
|
256
256
|
formatter_broadcaster.register(Formatters::AutotestFormatter.new(output_broadcaster))
|
257
257
|
else
|
258
258
|
begin
|
259
|
-
formatter_class =
|
259
|
+
formatter_class = constantize(format)
|
260
260
|
formatter_broadcaster.register(formatter_class.new(output_broadcaster, step_mother, @options))
|
261
261
|
rescue NameError => e
|
262
262
|
@error_stream.puts "Invalid format: #{format}\n"
|
263
263
|
exit_with_help
|
264
264
|
rescue Exception => e
|
265
|
-
exit_with_error("Error creating formatter: #{format}\n#{e}")
|
265
|
+
exit_with_error("Error creating formatter: #{format}\n#{e}\n")
|
266
266
|
end
|
267
267
|
end
|
268
268
|
end
|
@@ -279,6 +279,17 @@ Defined profiles in cucumber.yml:
|
|
279
279
|
|
280
280
|
private
|
281
281
|
|
282
|
+
def constantize(camel_cased_word)
|
283
|
+
names = camel_cased_word.split('::')
|
284
|
+
names.shift if names.empty? || names.first.empty?
|
285
|
+
|
286
|
+
constant = Object
|
287
|
+
names.each do |name|
|
288
|
+
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
|
289
|
+
end
|
290
|
+
constant
|
291
|
+
end
|
292
|
+
|
282
293
|
def verbose_log(string)
|
283
294
|
@out_stream.puts(string) if @options[:verbose]
|
284
295
|
end
|
data/lib/cucumber/executor.rb
CHANGED
data/lib/cucumber/platform.rb
CHANGED
@@ -6,6 +6,7 @@ $CUCUMBER_JRUBY = defined?(JRUBY_VERSION)
|
|
6
6
|
$CUCUMBER_IRONRUBY = Config::CONFIG['sitedir'] =~ /IronRuby/
|
7
7
|
$CUCUMBER_WINDOWS = Config::CONFIG['host_os'] =~ /mswin|mingw/
|
8
8
|
$CUCUMBER_WINDOWS_MRI = $CUCUMBER_WINDOWS && !$CUCUMBER_JRUBY && !$CUCUMBER_IRONRUBY
|
9
|
+
$CUCUMBER_RAILS = defined?(Rails)
|
9
10
|
|
10
11
|
if $CUCUMBER_IRONRUBY
|
11
12
|
ENV['GEM_PATH'] ||= "C:/ruby/lib/ruby/gems/1.8"
|
data/lib/cucumber/step_mother.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'cucumber/tree/top_down_visitor'
|
2
|
-
require 'cucumber/core_ext/proc'
|
3
2
|
|
4
3
|
module Cucumber
|
5
4
|
class Pending < StandardError
|
@@ -21,6 +20,7 @@ module Cucumber
|
|
21
20
|
PENDING = lambda do |*_|
|
22
21
|
raise Pending
|
23
22
|
end
|
23
|
+
require 'cucumber/core_ext/proc'
|
24
24
|
PENDING.extend(CoreExt::CallIn)
|
25
25
|
PENDING.name = "PENDING"
|
26
26
|
|
data/lib/cucumber/tree.rb
CHANGED
data/lib/cucumber/version.rb
CHANGED
@@ -4,5 +4,8 @@ require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
|
4
4
|
require 'cucumber/rails/world'
|
5
5
|
Cucumber::Rails.use_transactional_fixtures
|
6
6
|
|
7
|
-
|
7
|
+
require 'webrat/rails'
|
8
|
+
|
9
|
+
# Comment out the next two lines if you're not using RSpec's matchers (should / should_not) in your steps.
|
8
10
|
require 'cucumber/rails/rspec'
|
11
|
+
require 'webrat/rspec-rails'
|
@@ -1,28 +1,26 @@
|
|
1
1
|
# Commonly used webrat steps
|
2
2
|
# http://github.com/brynary/webrat
|
3
3
|
|
4
|
-
require 'webrat' if !defined?(Webrat) # Because some people have it installed as a Gem
|
5
|
-
|
6
4
|
When /^I press "(.*)"$/ do |button|
|
7
|
-
|
5
|
+
click_button(button)
|
8
6
|
end
|
9
7
|
|
10
8
|
When /^I follow "(.*)"$/ do |link|
|
11
|
-
|
9
|
+
click_link(link)
|
12
10
|
end
|
13
11
|
|
14
12
|
When /^I fill in "(.*)" with "(.*)"$/ do |field, value|
|
15
|
-
|
13
|
+
fill_in(field, :with => value)
|
16
14
|
end
|
17
15
|
|
18
16
|
When /^I select "(.*)" from "(.*)"$/ do |value, field|
|
19
|
-
|
17
|
+
select(value, :from => field)
|
20
18
|
end
|
21
19
|
|
22
20
|
# Use this step in conjunction with Rail's datetime_select helper. For example:
|
23
21
|
# When I select "December 25, 2008 10:00" as the date and time
|
24
22
|
When /^I select "(.*)" as the date and time$/ do |time|
|
25
|
-
|
23
|
+
select_datetime(time)
|
26
24
|
end
|
27
25
|
|
28
26
|
# Use this step when using multiple datetime_select helpers on a page or
|
@@ -35,7 +33,7 @@ end
|
|
35
33
|
# When I select "November 23, 2004 11:20" as the "Preferred" data and time
|
36
34
|
# And I select "November 25, 2004 10:30" as the "Alternative" data and time
|
37
35
|
When /^I select "(.*)" as the "(.*)" date and time$/ do |datetime, datetime_label|
|
38
|
-
|
36
|
+
select_datetime(datetime, :from => datetime_label)
|
39
37
|
end
|
40
38
|
|
41
39
|
# Use this step in conjuction with Rail's time_select helper. For example:
|
@@ -43,43 +41,43 @@ end
|
|
43
41
|
# Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
|
44
42
|
# will convert the 2:20PM to 14:20 and then select it.
|
45
43
|
When /^I select "(.*)" as the time$/ do |time|
|
46
|
-
|
44
|
+
select_time(time)
|
47
45
|
end
|
48
46
|
|
49
47
|
# Use this step when using multiple time_select helpers on a page or you want to
|
50
48
|
# specify the name of the time on the form. For example:
|
51
49
|
# When I select "7:30AM" as the "Gym" time
|
52
50
|
When /^I select "(.*)" as the "(.*)" time$/ do |time, time_label|
|
53
|
-
|
51
|
+
select_time(time, :from => time_label)
|
54
52
|
end
|
55
53
|
|
56
54
|
# Use this step in conjuction with Rail's date_select helper. For example:
|
57
55
|
# When I select "February 20, 1981" as the date
|
58
56
|
When /^I select "(.*)" as the date$/ do |date|
|
59
|
-
|
57
|
+
select_date(date)
|
60
58
|
end
|
61
59
|
|
62
60
|
# Use this step when using multiple date_select helpers on one page or
|
63
61
|
# you want to specify the name of the date on the form. For example:
|
64
62
|
# When I select "April 26, 1982" as the "Date of Birth" date
|
65
63
|
When /^I select "(.*)" as the "(.*)" date$/ do |date, date_label|
|
66
|
-
|
64
|
+
select_date(date, :from => date_label)
|
67
65
|
end
|
68
66
|
|
69
67
|
When /^I check "(.*)"$/ do |field|
|
70
|
-
|
68
|
+
check(field)
|
71
69
|
end
|
72
70
|
|
73
71
|
When /^I uncheck "(.*)"$/ do |field|
|
74
|
-
|
72
|
+
uncheck(field)
|
75
73
|
end
|
76
74
|
|
77
75
|
When /^I choose "(.*)"$/ do |field|
|
78
|
-
|
76
|
+
choose(field)
|
79
77
|
end
|
80
78
|
|
81
79
|
When /^I attach the file at "(.*)" to "(.*)" $/ do |path, field|
|
82
|
-
|
80
|
+
attach_file(field, path)
|
83
81
|
end
|
84
82
|
|
85
83
|
Then /^I should see "(.*)"$/ do |text|
|
data/spec/cucumber/cli_spec.rb
CHANGED
@@ -217,14 +217,32 @@ Defined profiles in cucumber.yml:
|
|
217
217
|
|
218
218
|
cli.execute!(stub('step mother'), mock_executor, stub('features'))
|
219
219
|
end
|
220
|
+
|
221
|
+
describe "--format with class" do
|
222
|
+
|
223
|
+
describe "in module" do
|
224
|
+
|
225
|
+
it "should resolve each module until it gets Formatter class" do
|
226
|
+
cli = CLI.new
|
227
|
+
mock_module = mock('module')
|
228
|
+
cli.parse_options!(%w{--format ZooModule::MonkeyFormatterClass})
|
229
|
+
Object.stub!(:const_defined?).and_return(true)
|
230
|
+
mock_module.stub!(:const_defined?).and_return(true)
|
220
231
|
|
221
|
-
|
232
|
+
Object.should_receive(:const_get).with('ZooModule').and_return(mock_module)
|
233
|
+
mock_module.should_receive(:const_get).with('MonkeyFormatterClass').and_return(mock('formatter class', :new => nil))
|
234
|
+
|
235
|
+
cli.execute!(stub('step mother'), mock_executor, stub('features'))
|
236
|
+
end
|
222
237
|
|
238
|
+
end
|
239
|
+
|
223
240
|
describe "exists and valid constructor" do
|
224
|
-
|
241
|
+
|
225
242
|
before(:each) do
|
226
243
|
@mock_formatter_class = mock('formatter class')
|
227
|
-
|
244
|
+
Object.stub!(:const_get).and_return(@mock_formatter_class)
|
245
|
+
Object.stub!(:const_defined?).with('magical').and_return(true)
|
228
246
|
end
|
229
247
|
|
230
248
|
it "should create the formatter" do
|
@@ -236,7 +254,7 @@ Defined profiles in cucumber.yml:
|
|
236
254
|
|
237
255
|
cli.execute!(stub('step mother'), mock_executor, stub('features'))
|
238
256
|
end
|
239
|
-
|
257
|
+
|
240
258
|
it "should register the formatter with broadcaster" do
|
241
259
|
cli = CLI.new
|
242
260
|
broadcaster = Broadcaster.new
|
@@ -261,7 +279,8 @@ Defined profiles in cucumber.yml:
|
|
261
279
|
|
262
280
|
mock_formatter_class = stub('formatter class')
|
263
281
|
mock_formatter_class.stub!(:new).and_raise("No such method")
|
264
|
-
|
282
|
+
Object.stub!(:const_get).and_return(mock_formatter_class)
|
283
|
+
Object.stub!(:const_defined?).with('exists_but_evil').and_return(true)
|
265
284
|
|
266
285
|
@cli.parse_options!(%w{--format exists_but_evil})
|
267
286
|
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.
|
4
|
+
version: 0.1.11
|
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: 2008-
|
12
|
+
date: 2008-12-02 00:00:00 -08:00
|
13
13
|
default_executable: cucumber
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -39,15 +39,6 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.1.2
|
41
41
|
version:
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: rspec
|
44
|
-
version_requirement:
|
45
|
-
version_requirements: !ruby/object:Gem::Requirement
|
46
|
-
requirements:
|
47
|
-
- - ">="
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: 1.1.11
|
50
|
-
version:
|
51
42
|
- !ruby/object:Gem::Dependency
|
52
43
|
name: hoe
|
53
44
|
version_requirement:
|