cucumber 1.2.2 → 1.2.3

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/README.md CHANGED
@@ -15,8 +15,8 @@ Where to get more info:
15
15
  * Support forum: https://groups.google.com/forum/?fromgroups#!forum/cukes
16
16
  * IRC channel: irc://irc.freenode.net/cucumber
17
17
 
18
- See [DEVELOPERS.md](DEVELOPERS.md) for info on contributing to Cucumber.
18
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for info on contributing to Cucumber.
19
19
 
20
20
  ## Copyright
21
21
 
22
- Copyright (c) 2008,2009,2010,2011,2012 Aslak Hellesøy and Contributors. See LICENSE for details.
22
+ Copyright (c) 2008,2009,2010,2011,2012,2013 Aslak Hellesøy and Contributors. See LICENSE for details.
@@ -1,10 +1,10 @@
1
- require 'cucumber/ast/feature_element'
1
+ require 'cucumber/ast/has_steps'
2
2
  require 'cucumber/ast/names'
3
3
 
4
4
  module Cucumber
5
5
  module Ast
6
6
  class Background #:nodoc:
7
- include FeatureElement
7
+ include HasSteps
8
8
  include Names
9
9
  attr_reader :feature_elements
10
10
 
@@ -3,7 +3,7 @@ require 'gherkin/tag_expression'
3
3
 
4
4
  module Cucumber
5
5
  module Ast
6
- module FeatureElement #:nodoc:
6
+ module HasSteps #:nodoc:
7
7
  attr_accessor :feature
8
8
 
9
9
  attr_reader :gherkin_statement, :raw_steps, :title, :description
@@ -1,10 +1,10 @@
1
- require 'cucumber/ast/feature_element'
1
+ require 'cucumber/ast/has_steps'
2
2
  require 'cucumber/ast/names'
3
3
 
4
4
  module Cucumber
5
5
  module Ast
6
6
  class Scenario #:nodoc:
7
- include FeatureElement
7
+ include HasSteps
8
8
  include Names
9
9
 
10
10
  attr_reader :line
@@ -86,9 +86,6 @@ module Cucumber
86
86
 
87
87
  def skip_invoke!
88
88
  @steps.each{|step_invocation| step_invocation.skip_invoke!}
89
- @feature.next_feature_element(self) do |next_one|
90
- next_one.skip_invoke!
91
- end
92
89
  end
93
90
 
94
91
  def to_sexp
@@ -1,10 +1,10 @@
1
- require 'cucumber/ast/feature_element'
1
+ require 'cucumber/ast/has_steps'
2
2
  require 'cucumber/ast/names'
3
3
 
4
4
  module Cucumber
5
5
  module Ast
6
6
  class ScenarioOutline #:nodoc:
7
- include FeatureElement
7
+ include HasSteps
8
8
  include Names
9
9
 
10
10
  module ExamplesArray #:nodoc:
@@ -67,7 +67,7 @@ module Cucumber
67
67
  def before_examples(examples)
68
68
  @gf.examples(examples.gherkin_statement)
69
69
  end
70
-
70
+
71
71
  #used for capturing duration
72
72
  def after_step(step)
73
73
  step_finish = (Time.now - @step_time)
@@ -83,7 +83,7 @@ module Cucumber
83
83
  end
84
84
 
85
85
  def embed(file, mime_type, label)
86
- data = File.read(file)
86
+ data = File.open(file, 'rb') { |f| f.read }
87
87
  if defined?(JRUBY_VERSION)
88
88
  data = data.to_java_bytes
89
89
  end
@@ -4,7 +4,7 @@ require 'rbconfig'
4
4
 
5
5
  module Cucumber
6
6
  unless defined?(Cucumber::VERSION)
7
- VERSION = '1.2.2'
7
+ VERSION = '1.2.3'
8
8
  BINARY = File.expand_path(File.dirname(__FILE__) + '/../../bin/cucumber')
9
9
  LIBDIR = File.expand_path(File.dirname(__FILE__) + '/../../lib')
10
10
  JRUBY = defined?(JRUBY_VERSION)
@@ -92,8 +92,7 @@ module Cucumber
92
92
 
93
93
  def cmd
94
94
  if use_bundler
95
- bundle_cmd = Gem.default_exec_format % 'bundle'
96
- [ Cucumber::RUBY_BINARY, '-S', bundle_cmd, 'exec', 'cucumber', @cucumber_opts,
95
+ [ Cucumber::RUBY_BINARY, '-S', 'bundle', 'exec', 'cucumber', @cucumber_opts,
97
96
  @feature_files ].flatten
98
97
  else
99
98
  [ Cucumber::RUBY_BINARY, '-I', load_path(@libs), quoted_binary(@cucumber_bin),
@@ -157,6 +157,12 @@ module Cucumber
157
157
  end
158
158
  end
159
159
 
160
+ # Returns Ast::DocString for +string_without_triple_quotes+.
161
+ #
162
+ def doc_string(string_without_triple_quotes, content_type='', line_offset=0)
163
+ Ast::DocString.new(string_without_triple_quotes,content_type)
164
+ end
165
+
160
166
  private
161
167
 
162
168
  def fire_after_configuration_hook #:nodoc
@@ -4,19 +4,29 @@ require 'erb'
4
4
  module Cucumber
5
5
  module WireSupport
6
6
  class Configuration
7
- attr_reader :host, :port
7
+ attr_reader :host, :port, :unix
8
8
 
9
- def initialize(wire_file)
10
- params = YAML.load(ERB.new(File.read(wire_file)).result)
11
- @host = params['host']
12
- @port = params['port']
13
- @timeouts = DEFAULT_TIMEOUTS.merge(params['timeout'] || {})
9
+ def self.from_file(wire_file)
10
+ settings = YAML.load(ERB.new(File.read(wire_file)).result)
11
+ new(settings)
12
+ end
13
+
14
+ def initialize(args)
15
+ @host = args['host']
16
+ @port = args['port']
17
+ @unix = args['unix'] if RUBY_PLATFORM !~ /mingw|mswin/
18
+ @timeouts = DEFAULT_TIMEOUTS.merge(args['timeout'] || {})
14
19
  end
15
20
 
16
21
  def timeout(message = nil)
17
22
  return @timeouts[message.to_s] || 3
18
23
  end
19
24
 
25
+ def to_s
26
+ return @unix if @unix
27
+ "#{@host}:#{@port}"
28
+ end
29
+
20
30
  DEFAULT_TIMEOUTS = {
21
31
  'connect' => 11,
22
32
  'invoke' => 120,
@@ -26,7 +26,7 @@ module Cucumber
26
26
  end
27
27
 
28
28
  def exception(params)
29
- WireException.new(params, @config.host, @config.port)
29
+ WireException.new(params, @config)
30
30
  end
31
31
 
32
32
  private
@@ -47,9 +47,14 @@ module Cucumber
47
47
  end
48
48
 
49
49
  def socket
50
- @socket ||= TCPSocket.new(@config.host, @config.port)
50
+ return @socket if @socket
51
+ if @config.unix
52
+ @socket = UNIXSocket.new(@config.unix)
53
+ else
54
+ @socket = TCPSocket.new(@config.host, @config.port)
55
+ end
51
56
  rescue Errno::ECONNREFUSED => exception
52
- raise(ConnectionError, "Unable to contact the wire server at #{@config.host}:#{@config.port}. Is it up?")
57
+ raise(ConnectionError, "Unable to contact the wire server at #{@config}. Is it up?")
53
58
  end
54
59
  end
55
60
  end
@@ -9,11 +9,11 @@ module Cucumber
9
9
  end
10
10
  end
11
11
 
12
- def initialize(args, host, port)
12
+ def initialize(args, config)
13
13
  super args['message']
14
14
  if args['exception']
15
15
  self.class.extend(CanSetName)
16
- self.class.exception_name = "#{args['exception']} from #{host}:#{port}"
16
+ self.class.exception_name = "#{args['exception']} from #{config}"
17
17
  end
18
18
  if args['backtrace']
19
19
  @backtrace = if args['backtrace'].is_a?(String)
@@ -22,7 +22,7 @@ module Cucumber
22
22
  end
23
23
 
24
24
  def load_code_file(wire_file)
25
- config = Configuration.new(wire_file)
25
+ config = Configuration.from_file(wire_file)
26
26
  @connections << Connection.new(config)
27
27
  end
28
28
 
@@ -24,22 +24,9 @@ module Cucumber
24
24
  end
25
25
 
26
26
  it "uses bundle exec to find cucumber and libraries" do
27
- bundle_cmd = Gem.default_exec_format % 'bundle'
28
-
29
- subject.cmd.should == [Cucumber::RUBY_BINARY,
30
- '-S',
31
- bundle_cmd,
32
- 'exec',
33
- 'cucumber',
34
- '--cuke-option'] + feature_files
35
- end
36
-
37
- it "obeys program suffix for bundler" do
38
- Gem::ConfigMap.stub(:[]).with(:ruby_install_name).and_return('XrubyY')
39
-
40
27
  subject.cmd.should == [Cucumber::RUBY_BINARY,
41
28
  '-S',
42
- 'XbundleY',
29
+ 'bundle',
43
30
  'exec',
44
31
  'cucumber',
45
32
  '--cuke-option'] + feature_files
@@ -35,6 +35,10 @@ describe Runtime do
35
35
  subject.configure(new_configuration)
36
36
  subject.features_paths.should == some_new_paths
37
37
  end
38
+
39
+ it '#doc_string' do
40
+ subject.doc_string('Text').should == 'Text'
41
+ end
38
42
  end
39
43
 
40
44
  end
@@ -6,7 +6,7 @@ module Cucumber
6
6
  module WireSupport
7
7
  describe Configuration do
8
8
  let(:wire_file) { Tempfile.new('wire') }
9
- let(:config) { Configuration.new(wire_file.path) }
9
+ let(:config) { Configuration.from_file(wire_file.path) }
10
10
 
11
11
  def write_wire_file(contents)
12
12
  wire_file << contents
@@ -5,10 +5,10 @@ module Cucumber
5
5
  module WireSupport
6
6
  describe WireException do
7
7
  before(:each) do
8
- @host, @port = 'localhost', '54321'
8
+ @config = Configuration.new('host' => 'localhost', 'port' => 54321)
9
9
  end
10
10
  def exception
11
- WireException.new(@data, @host, @port)
11
+ WireException.new(@data, @config)
12
12
  end
13
13
  describe "with just a message" do
14
14
  before(:each) do
@@ -5,7 +5,7 @@ module Cucumber
5
5
  module WireSupport
6
6
  describe WireLanguage do
7
7
  def stub_wire_file!(filename, config)
8
- Configuration.stub!(:new).with(filename).and_return config
8
+ Configuration.stub!(:from_file).with(filename).and_return config
9
9
  end
10
10
 
11
11
  describe "#load_code_file" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-02 00:00:00.000000000 Z
12
+ date: 2013-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder
@@ -342,7 +342,7 @@ files:
342
342
  - .rspec
343
343
  - .rvmrc
344
344
  - .travis.yml
345
- - DEVELOPERS.md
345
+ - CONTRIBUTING.md
346
346
  - Gemfile
347
347
  - History.md
348
348
  - LICENSE
@@ -771,8 +771,8 @@ files:
771
771
  - lib/cucumber/ast/doc_string.rb
772
772
  - lib/cucumber/ast/examples.rb
773
773
  - lib/cucumber/ast/feature.rb
774
- - lib/cucumber/ast/feature_element.rb
775
774
  - lib/cucumber/ast/features.rb
775
+ - lib/cucumber/ast/has_steps.rb
776
776
  - lib/cucumber/ast/multiline_argument.rb
777
777
  - lib/cucumber/ast/names.rb
778
778
  - lib/cucumber/ast/outline_table.rb
@@ -924,7 +924,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
924
924
  version: '0'
925
925
  segments:
926
926
  - 0
927
- hash: 4532349198793312029
927
+ hash: 4201914282574794420
928
928
  required_rubygems_version: !ruby/object:Gem::Requirement
929
929
  none: false
930
930
  requirements:
@@ -933,12 +933,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
933
933
  version: '0'
934
934
  segments:
935
935
  - 0
936
- hash: 4532349198793312029
936
+ hash: 4201914282574794420
937
937
  requirements: []
938
938
  rubyforge_project:
939
939
  rubygems_version: 1.8.24
940
940
  signing_key:
941
941
  specification_version: 3
942
- summary: cucumber-1.2.2
942
+ summary: cucumber-1.2.3
943
943
  test_files: []
944
944
  has_rdoc: