cucumber 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a8c84c24005a3a9e0b4f434206b98e3c1d2125b
4
- data.tar.gz: 8b96677e8af4daa48cc8d2df36e371a93f4831e4
3
+ metadata.gz: 54a19c3d70484ac7ded68c6ccf6a9b3b482598cc
4
+ data.tar.gz: 359760639e06c251399202275219bb763b2de0b9
5
5
  SHA512:
6
- metadata.gz: 6a1786e8f0a9773428a3cc9abbb7c7c5a1d8b8a6251976d80ad741ac822615c023fe565ad65c363ab00833993c9dc63c91977dbfdf1f1324a3777e48086285fc
7
- data.tar.gz: 19108ede29917929398c580c3a83d88471654baae66a26de7cdc58aec09aed1fa00df33214bbe77579ec2fc41bd408e21c36c06d1b310d58a1924efb6edc0313
6
+ metadata.gz: 4737148210ae32c40a5bba409f85cf4bf6c4312d2d2ddfc8812aae0476d14e0423271ed72ef35e6ad8e4ad93273f05acd915155d4e161c775ae6e71ed92819fe
7
+ data.tar.gz: ef7867ae75f81da2e36ca1c45d5d27b24520ca176685532c64c5e8cc74933a700711e4ec3fb64313b194011bb8aa206f454fb22011a6a1aeef22b86ab819432e
data/History.md CHANGED
@@ -1,8 +1,14 @@
1
- ## [In Git](https://github.com/cucumber/cucumber-ruby/compare/v2.0.1...master)
1
+ ## [In Git](https://github.com/cucumber/cucumber-ruby/compare/v2.0.2...master)
2
2
 
3
- ...
4
3
 
5
- ## [In Git](https://github.com/cucumber/cucumber-ruby/compare/v2.0.0...v2.0.1)
4
+ ## [v2.0.2](https://github.com/cucumber/cucumber-ruby/compare/v2.0.1...v2.0.2)
5
+
6
+ ### Bugfixes
7
+
8
+ * Revert interface change in Cucumber::Formatter::Console (which can break custom formatters in v2.0.1) ([893](https://github.com/cucumber/cucumber-ruby/issues/893) @brasmusson).
9
+ * Calculate the locations of hooks properly (so it also work between drives on Windows) ([885](https://github.com/cucumber/cucumber-ruby/issues/885) @brasmusson).
10
+
11
+ ## [v2.0.1](https://github.com/cucumber/cucumber-ruby/compare/v2.0.0...v2.0.1)
6
12
 
7
13
  ### New Features
8
14
 
@@ -1,31 +1,31 @@
1
1
  Feature: Doc strings
2
2
 
3
- If you need to specify information in a scenario that won't fit on a single line,
3
+ If you need to specify information in a scenario that won't fit on a single line,
4
4
  you can use a DocString.
5
-
5
+
6
6
  A DocString follows a step, and starts and ends with three double quotes, like this:
7
-
7
+
8
8
  ```gherkin
9
9
  When I ask to reset my password
10
10
  Then I should receive an email with:
11
11
  """
12
12
  Dear bozo,
13
-
13
+
14
14
  Please click this link to reset your password
15
15
  """
16
16
  ```
17
-
17
+
18
18
  It's possible to annotate the DocString with the type of content it contains. This is used by
19
19
  formatting tools like http://relishapp.com which will render the contents of the DocString
20
20
  appropriately. You specify the content type after the triple quote, like this:
21
-
21
+
22
22
  ```gherkin
23
23
  Given there is some Ruby code:
24
24
  """ruby
25
25
  puts "hello world"
26
26
  """
27
27
  ```
28
-
28
+
29
29
  You can read the content type from the argument passed into your step definition, as shown
30
30
  in the example below.
31
31
 
@@ -33,11 +33,11 @@ Feature: Doc strings
33
33
  Given a scenario with a step that looks like this:
34
34
  """gherkin
35
35
  Given I have a lot to say:
36
- \"\"\"
37
- One
38
- Two
39
- Three
40
- \"\"\"
36
+ \"\"\"
37
+ One
38
+ Two
39
+ Three
40
+ \"\"\"
41
41
  """
42
42
  And a step definition that looks like this:
43
43
  """ruby
@@ -57,9 +57,9 @@ Feature: Doc strings
57
57
  Given a scenario with a step that looks like this:
58
58
  """gherkin
59
59
  Given I have some code for you:
60
- \"\"\"ruby
61
- # hello
62
- \"\"\"
60
+ \"\"\"ruby
61
+ # hello
62
+ \"\"\"
63
63
  """
64
64
  And a step definition that looks like this:
65
65
  """ruby
@@ -1,6 +1,6 @@
1
1
  require 'cucumber/core/filter'
2
+ require 'cucumber/core/ast/location'
2
3
  require 'cucumber/running_test_case'
3
- require 'cucumber/hooks'
4
4
 
5
5
  module Cucumber
6
6
  module Filters
@@ -25,7 +25,8 @@ module Cucumber
25
25
  around_hooks = [init_scenario] + @original_test_case.around_hooks
26
26
 
27
27
  empty_hook = proc {} #no op - legacy format adapter expects a before hooks
28
- default_hook = Cucumber::Hooks.before_hook(@original_test_case.source, Cucumber::Hooks.location(empty_hook), &empty_hook)
28
+ file, line = *empty_hook.source_location
29
+ default_hook = Cucumber::Hooks.before_hook(@original_test_case.source, Cucumber::Core::Ast::Location.new(file, line), &empty_hook)
29
30
  steps = [default_hook] + @original_test_case.test_steps
30
31
 
31
32
  @original_test_case.with_around_hooks(around_hooks).with_steps(steps)
@@ -76,7 +76,12 @@ module Cucumber
76
76
  end
77
77
  end
78
78
 
79
- def print_stats(duration, options)
79
+ def print_stats(features, options)
80
+ duration = features ? features.duration : nil
81
+ print_statistics(duration, options)
82
+ end
83
+
84
+ def print_statistics(duration, options)
80
85
  failures = collect_failing_scenarios(runtime)
81
86
  if !failures.empty?
82
87
  print_failing_scenarios(failures, options.custom_profiles, options[:source])
@@ -240,8 +240,7 @@ module Cucumber
240
240
  end
241
241
 
242
242
  def print_summary(features)
243
- duration = features ? features.duration : nil
244
- print_stats(duration, @options)
243
+ print_stats(features, @options)
245
244
  print_snippets(@options)
246
245
  print_passing_wip(@options)
247
246
  end
@@ -46,7 +46,7 @@ module Cucumber
46
46
  def print_summary
47
47
  print_steps(:pending)
48
48
  print_steps(:failed)
49
- print_stats(@total_duration, @options)
49
+ print_statistics(@total_duration, @options)
50
50
  print_snippets(@options)
51
51
  print_passing_wip(@options)
52
52
  end
@@ -26,13 +26,6 @@ module Cucumber
26
26
  Core::Test::AroundHook.new(&block)
27
27
  end
28
28
 
29
- def location(hook)
30
- filepath, line = *hook.source_location
31
- Core::Ast::Location.new(
32
- Pathname.new(filepath).relative_path_from(Pathname.new(Dir.pwd)).to_path,
33
- line)
34
- end
35
-
36
29
  private
37
30
 
38
31
  def build_hook_step(source, location, block, hook_type, action_type)
@@ -4,7 +4,7 @@ require 'rbconfig'
4
4
 
5
5
  module Cucumber
6
6
  unless defined?(Cucumber::VERSION)
7
- VERSION = '2.0.1'
7
+ VERSION = '2.0.2'
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)
@@ -2,12 +2,14 @@ module Cucumber
2
2
  module RbSupport
3
3
  # Wrapper for Before, After and AfterStep hooks
4
4
  class RbHook
5
- attr_reader :tag_expressions
5
+ attr_reader :tag_expressions, :location
6
6
 
7
7
  def initialize(rb_language, tag_expressions, proc)
8
8
  @rb_language = rb_language
9
9
  @tag_expressions = tag_expressions
10
10
  @proc = proc
11
+ file, line = @proc.file_colon_line.match(/(.*):(\d+)/)[1..2]
12
+ @location = Core::Ast::Location.new(file, line)
11
13
  end
12
14
 
13
15
  def source_location
@@ -51,10 +51,16 @@ module Cucumber
51
51
  end
52
52
 
53
53
  def patch_location_onto(block)
54
- file, line = caller[5].split(':')[0..1]
55
- location = Core::Ast::Location.new(
56
- Pathname.new(file).relative_path_from(Pathname.new(Dir.pwd)),
57
- line)
54
+ file, line = caller[5].match(/(.*):(\d+)/)[1..2]
55
+ file = File.expand_path(file)
56
+ pwd = File.expand_path(Dir.pwd)
57
+ pwd.force_encoding(file.encoding)
58
+ if file.index(pwd)
59
+ file = file[pwd.length+1..-1]
60
+ elsif file =~ /.*\/gems\/(.*\.rb)$/
61
+ file = $1
62
+ end
63
+ location = Core::Ast::Location.new(file, line)
58
64
  block.define_singleton_method(:file_colon_line) { location.to_s }
59
65
  block
60
66
  end
@@ -17,7 +17,7 @@ module Cucumber
17
17
  def after_hooks(source)
18
18
  @hooks.map do |hook|
19
19
  action = ->(result) { hook.invoke('After', @scenario.with_result(result)) }
20
- Hooks.after_hook(source, Hooks.location(hook), &action)
20
+ Hooks.after_hook(source, hook.location, &action)
21
21
  end
22
22
  end
23
23
  end
@@ -19,7 +19,7 @@ module Cucumber
19
19
  def before_hooks(source)
20
20
  @hooks.map do |hook|
21
21
  action_block = ->(result) { hook.invoke('Before', @scenario.with_result(result)) }
22
- Hooks.before_hook(source, Hooks.location(hook), &action_block)
22
+ Hooks.before_hook(source, hook.location, &action_block)
23
23
  end
24
24
  end
25
25
  end
@@ -15,7 +15,7 @@ module Cucumber
15
15
  def after_step_hooks(test_step)
16
16
  @hooks.map do |hook|
17
17
  action = ->(*args) { hook.invoke('AfterStep', args) }
18
- Hooks.after_step_hook(test_step.source, Hooks.location(hook), &action)
18
+ Hooks.after_step_hook(test_step.source, hook.location, &action)
19
19
  end
20
20
  end
21
21
  end
@@ -51,6 +51,10 @@ module Cucumber
51
51
  @proc.source_location
52
52
  end
53
53
 
54
+ def location
55
+ source_location
56
+ end
57
+
54
58
  def invoke(pseudo_method, arguments, &block)
55
59
  @proc.call
56
60
  end
@@ -70,13 +74,13 @@ module Cucumber
70
74
  # The adapter is built on the assumption that each test case will have at least one step. This is annoying
71
75
  # for tests, but a safe assumption for production use as we always add one hook to initialize the world.
72
76
  hook = proc {}
73
- [ Hooks.before_hook(source, Hooks.location(hook), &hook) ]
77
+ [ Hooks.before_hook(source, hook.source_location, &hook) ]
74
78
  end
75
79
 
76
80
  def after_hooks(source)
77
81
  # We add an after hook to make sure the adapter can cope with it
78
82
  hook = proc {}
79
- [ Hooks.after_hook(source, Hooks.location(hook), &hook) ]
83
+ [ Hooks.after_hook(source, hook.source_location, &hook) ]
80
84
  end
81
85
  end
82
86
 
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: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aslak Hellesøy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-07-08 00:00:00.000000000 Z
13
+ date: 2015-07-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cucumber-core
@@ -838,7 +838,7 @@ rubyforge_project:
838
838
  rubygems_version: 2.2.2
839
839
  signing_key:
840
840
  specification_version: 4
841
- summary: cucumber-2.0.1
841
+ summary: cucumber-2.0.2
842
842
  test_files:
843
843
  - features/docs/api/list_step_defs_as_json.feature
844
844
  - features/docs/api/run_cli_main_with_existing_runtime.feature