aslakhellesoy-cucumber 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
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
- begin
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
- puts <<-EOS
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
- desc "Run the specs under spec/models"
18
- Spec::Rake::SpecTask.new do |t|
19
- t.spec_opts = ['--options', "spec/spec.opts"]
20
- t.spec_files = FileList['spec/**/*_spec.rb']
21
- end
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
- system cmd
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
@@ -1,7 +1,6 @@
1
1
  $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
- require 'jcode'
5
4
  require 'cucumber/platform'
6
5
  require 'rubygems'
7
6
  require 'treetop/runtime'
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 = Kernel.const_get(format)
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
@@ -19,4 +19,11 @@ class String
19
19
  end
20
20
  s
21
21
  end
22
+
23
+ if $CUCUMBER_JRUBY && $CUCUMBER_RAILS
24
+ # Workaround for http://tinyurl.com/55uu3u
25
+ alias jlength length
26
+ else
27
+ require 'jcode'
28
+ end
22
29
  end
@@ -1,5 +1,3 @@
1
- require 'cucumber/core_ext/proc'
2
-
3
1
  module Cucumber
4
2
  class Executor
5
3
  attr_reader :failed
@@ -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"
@@ -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
@@ -1,6 +1,4 @@
1
1
  %w{features feature scenario step given_scenario table top_down_visitor}.each{|f| require "cucumber/tree/#{f}"}
2
- require 'cucumber/core_ext/proc'
3
- require 'cucumber/core_ext/string'
4
2
 
5
3
  module Cucumber
6
4
  module Tree
@@ -43,6 +43,7 @@ module Cucumber
43
43
  attr_reader :name, :line
44
44
 
45
45
  def initialize(feature, name, line, &proc)
46
+ require 'cucumber/core_ext/string'
46
47
  @feature, @name, @line = feature, name, line
47
48
  @steps_and_given_scenarios = []
48
49
  instance_eval(&proc) if block_given?
@@ -2,7 +2,7 @@ module Cucumber #:nodoc:
2
2
  class VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 10
5
+ TINY = 11
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -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
- # Comment out the next line if you're not using RSpec's matchers (should / should_not) in your steps.
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
- clicks_button(button)
5
+ click_button(button)
8
6
  end
9
7
 
10
8
  When /^I follow "(.*)"$/ do |link|
11
- clicks_link(link)
9
+ click_link(link)
12
10
  end
13
11
 
14
12
  When /^I fill in "(.*)" with "(.*)"$/ do |field, value|
15
- fills_in(field, :with => value)
13
+ fill_in(field, :with => value)
16
14
  end
17
15
 
18
16
  When /^I select "(.*)" from "(.*)"$/ do |value, field|
19
- selects(value, :from => field)
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
- selects_datetime(time)
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
- selects_datetime(datetime, :from => datetime_label)
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
- selects_time(time)
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
- selects_time(time, :from => time_label)
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
- selects_date(date)
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
- selects_date(date, :from => date_label)
64
+ select_date(date, :from => date_label)
67
65
  end
68
66
 
69
67
  When /^I check "(.*)"$/ do |field|
70
- checks(field)
68
+ check(field)
71
69
  end
72
70
 
73
71
  When /^I uncheck "(.*)"$/ do |field|
74
- unchecks(field)
72
+ uncheck(field)
75
73
  end
76
74
 
77
75
  When /^I choose "(.*)"$/ do |field|
78
- chooses(field)
76
+ choose(field)
79
77
  end
80
78
 
81
79
  When /^I attach the file at "(.*)" to "(.*)" $/ do |path, field|
82
- attaches_file(field, path)
80
+ attach_file(field, path)
83
81
  end
84
82
 
85
83
  Then /^I should see "(.*)"$/ do |text|
@@ -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
- describe "external formatter" do
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
- Kernel.stub!(:const_get).and_return(@mock_formatter_class)
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
- Kernel.stub!(:const_get).and_return(mock_formatter_class)
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.10
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-11-25 00:00:00 -08:00
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: