fuubar-cucumber 0.0.22 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0cababd56b6e02801a28012eeef7f6117297e8155146003b8621abc2126d8680
4
+ data.tar.gz: 0ec7390a99a35a5afbe33135047718cef1bb8bd574477e3e3065b455f66c070b
5
+ SHA512:
6
+ metadata.gz: 8e2f55bd90dfea7cdc8bc320a8daccff18446323b69ff5cb5cd3ef261c9dcb54bca99aa437909d201b7fd9782d55901d440ec8f5f5ed50f0c9ed590cb7364dc7
7
+ data.tar.gz: 74a9bfd5e05c793c43614b87beabef7e160985cc49d9dd0be841d1cee517ec0d1e5730097b74ad49136ef6d26eec049d56dede2e8915d9b79df5c5292ef79f1f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.1.0 (June 11, 2019) ##
2
+ * Add support for Cucumber 3 (by [@darrinholst](https://github.com/darrinholst))
3
+
1
4
  ## 0.0.22 (July 14, 2014) ##
2
5
  * Display exceptions that do not cause a specific step to fail (by [@mthorn](https://github.com/mthorn))
3
6
  * Change ruby-progressbar dependency constraint to `~> 1.2` (by [@lime](https://github.com/lime))
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "fuubar-cucumber"
3
- s.version = '0.0.22'
3
+ s.version = '0.1.0'
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.authors = ["Marcin Ciunelis", "Vasiliy Ermolovich"]
6
6
  s.email = ["marcin.ciunelis@gmail.com", "younash@gmail.com"]
@@ -14,6 +14,6 @@ Gem::Specification.new do |s|
14
14
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
15
15
  s.require_paths = ["lib"]
16
16
 
17
- s.add_dependency 'cucumber', ["~> 1.3.0"]
17
+ s.add_dependency 'cucumber', [">= 1", "< 4"]
18
18
  s.add_dependency 'ruby-progressbar', ["~> 1.2"]
19
19
  end
@@ -0,0 +1,56 @@
1
+ require 'cucumber/formatter/progress'
2
+ require 'ruby-progressbar'
3
+
4
+ module Cucumber
5
+ module Formatter
6
+ class Fuubar < Progress
7
+ def initialize(config)
8
+ super
9
+ config.on_event :test_run_started, &method(:test_run_started)
10
+ end
11
+
12
+ def test_run_started(event)
13
+ steps = event.test_cases.map(&:test_steps).flatten.reject(&method(:hook?))
14
+ @progress_bar = ProgressBar.create(:format => ' %c/%C |%w>%i| %e ', :total => steps.count, :output => @io)
15
+ end
16
+
17
+ def on_test_step_finished(event)
18
+ test_step = event.test_step
19
+ result = event.result.with_filtered_backtrace(Cucumber::Formatter::BacktraceFilter)
20
+ progress(result.to_sym) unless hook?(test_step)
21
+
22
+ return if hook?(test_step)
23
+ collect_snippet_data(test_step, result)
24
+ @pending_step_matches << @matches[test_step.source] if result.pending?
25
+ @failed_results << result if result.failed?
26
+ end
27
+
28
+ private
29
+
30
+ COLORS = { :green => "\e[32m", :yellow => "\e[33m", :red => "\e[31m" }
31
+
32
+ def state
33
+ @state ||= :green
34
+ end
35
+
36
+ def progress(status)
37
+ @state = :red if status == :failed
38
+ with_colors(COLORS[state]) { @progress_bar.progress += 1 }
39
+ end
40
+
41
+ def with_colors(color, &block)
42
+ @io.print color if colors_enabled?
43
+ yield
44
+ @io.print "\e[0m" if colors_enabled?
45
+ end
46
+
47
+ def colors_enabled?
48
+ Cucumber::Term::ANSIColor.coloring?
49
+ end
50
+
51
+ def hook?(step)
52
+ HookQueryVisitor.new(step).hook?
53
+ end
54
+ end
55
+ end
56
+ end
@@ -1,10 +1,18 @@
1
- require 'cucumber/formatter/fuubar'
1
+ module FuubarCucumber
2
+ def cucumber3?
3
+ defined?(::Cucumber) && ::Cucumber::VERSION >= '3'
4
+ end
2
5
 
3
- # Extend Cucumber's builtin formats, so that this
4
- # formatter can be used with --format fuubar
5
- require 'cucumber/cli/main'
6
+ module_function :cucumber3?
6
7
 
7
- Cucumber::Cli::Options::BUILTIN_FORMATS["fuubar"] = [
8
- "Cucumber::Formatter::Fuubar",
9
- "The instafailing Cucumber progress bar formatter"
10
- ]
8
+ require "cucumber/formatter/fuubar#{cucumber3? ? '3' : ''}"
9
+
10
+ # Extend Cucumber's builtin formats, so that this
11
+ # formatter can be used with --format fuubar
12
+ require 'cucumber/cli/main'
13
+
14
+ Cucumber::Cli::Options::BUILTIN_FORMATS["fuubar"] = [
15
+ "Cucumber::Formatter::Fuubar",
16
+ "The instafailing Cucumber progress bar formatter"
17
+ ]
18
+ end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuubar-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.22
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Marcin Ciunelis
@@ -10,38 +9,40 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2014-07-14 00:00:00.000000000 Z
12
+ date: 2019-06-11 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: cucumber
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ~>
18
+ - - ">="
21
19
  - !ruby/object:Gem::Version
22
- version: 1.3.0
20
+ version: '1'
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '4'
23
24
  type: :runtime
24
25
  prerelease: false
25
26
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
27
  requirements:
28
- - - ~>
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ version: '1'
31
+ - - "<"
29
32
  - !ruby/object:Gem::Version
30
- version: 1.3.0
33
+ version: '4'
31
34
  - !ruby/object:Gem::Dependency
32
35
  name: ruby-progressbar
33
36
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
37
  requirements:
36
- - - ~>
38
+ - - "~>"
37
39
  - !ruby/object:Gem::Version
38
40
  version: '1.2'
39
41
  type: :runtime
40
42
  prerelease: false
41
43
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
44
  requirements:
44
- - - ~>
45
+ - - "~>"
45
46
  - !ruby/object:Gem::Version
46
47
  version: '1.2'
47
48
  description: the instafailing Cucumber progress bar formatter
@@ -52,9 +53,9 @@ executables: []
52
53
  extensions: []
53
54
  extra_rdoc_files: []
54
55
  files:
55
- - .document
56
- - .gitignore
57
- - .rspec
56
+ - ".document"
57
+ - ".gitignore"
58
+ - ".rspec"
58
59
  - CHANGELOG.md
59
60
  - Gemfile
60
61
  - LICENSE.txt
@@ -62,36 +63,29 @@ files:
62
63
  - Rakefile
63
64
  - fuubar-cucumber.gemspec
64
65
  - lib/cucumber/formatter/fuubar.rb
66
+ - lib/cucumber/formatter/fuubar3.rb
65
67
  - lib/fuubar-cucumber.rb
66
68
  homepage: https://github.com/martinciu/fuubar-cucumber
67
69
  licenses:
68
70
  - MIT
71
+ metadata: {}
69
72
  post_install_message:
70
73
  rdoc_options: []
71
74
  require_paths:
72
75
  - lib
73
76
  required_ruby_version: !ruby/object:Gem::Requirement
74
- none: false
75
77
  requirements:
76
- - - ! '>='
78
+ - - ">="
77
79
  - !ruby/object:Gem::Version
78
80
  version: '0'
79
- segments:
80
- - 0
81
- hash: 1594091018100426814
82
81
  required_rubygems_version: !ruby/object:Gem::Requirement
83
- none: false
84
82
  requirements:
85
- - - ! '>='
83
+ - - ">="
86
84
  - !ruby/object:Gem::Version
87
85
  version: '0'
88
- segments:
89
- - 0
90
- hash: 1594091018100426814
91
86
  requirements: []
92
- rubyforge_project:
93
- rubygems_version: 1.8.24
87
+ rubygems_version: 3.0.3
94
88
  signing_key:
95
- specification_version: 3
89
+ specification_version: 4
96
90
  summary: the instafailing Cucumber progress bar formatter
97
91
  test_files: []