spinach-rerun-reporter 1.0.0 → 1.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d2860ae62f77726a3a52ffd4fce6ed761b0223ee
4
- data.tar.gz: 35cc3995f5c1ee6b439ac66c43a0804739f618f6
3
+ metadata.gz: 87cd126e64c9c375d713c7377cc4ff6113a62a37
4
+ data.tar.gz: d410ce8618eea1f422d05ac7257e7c48cdcb087d
5
5
  SHA512:
6
- metadata.gz: a1e35aef8b156caabd71d7d34206136bc1602b9df63b430b37a161244f5b9333a212adf6de39c3e8b25c21c30561c185aec975b9cb168d708d41c55312ee6ebc
7
- data.tar.gz: d151707eb3212c0c20f9756db4109268c18763736e6056def4516dad14424845d5b1e9d20a8c51a120a1be39b986eff77c2f7a35145b9da27b1e63bd6d149bd8
6
+ metadata.gz: 786f1129777e20f0a0cd7f334c97083e2ff0e5f6136e811535428993fb722235d53d36760653ed4a0721d9ca59839984c3ae880adde8fec1b7b4914124531f0a
7
+ data.tar.gz: 6a22c0097bac5048a58691ed835857acaf79cefff626b400f5b0742f73d559aee68b1a1a037d3fc22e641705d03e0191f84024f29a3175a11695e375a7ce08a6
data/README.md CHANGED
@@ -6,10 +6,8 @@ file all failed scenarios in order to re-execute them.
6
6
 
7
7
  ## Status
8
8
 
9
- [![Gem Version](https://badge.fury.io/rb/spinach-rerun-reporter.svg)](https://badge.fury.io/rb/spinach-rerun-reporter)
10
- [![Dependencies](https://gemnasium.com/badges/github.com/javierav/spinach-rerun-reporter.svg)](https://gemnasium.com/github.com/javierav/spinach-rerun-reporter)
11
-
12
- > *Note*: You're reading the documentation for the next release, which should be 0.1.0
9
+ ![Gem](https://img.shields.io/gem/v/spinach-rerun-reporter.svg)
10
+ ![Depfu](https://badges.depfu.com/badges/5dfc158e963346012b4c0fe02786c993/count.svg)
13
11
 
14
12
 
15
13
  ## Installation
@@ -2,7 +2,7 @@ module SpinachRerunReporter
2
2
  module VERSION
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 0
5
+ TINY = 1
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  ## GEM
20
20
  #
21
21
  s.require_paths = %w[lib]
22
- s.files = `git ls-files -z -- lib/* LICENSE README.md spinach-rerun-reporter.gemspec`.split("\x0")
22
+ s.files = `git ls-files -z -- lib/* tasks/* LICENSE README.md spinach-rerun-reporter.gemspec`.split("\x0")
23
23
  s.extra_rdoc_files = %w[README.md LICENSE]
24
24
  s.required_ruby_version = '> 2.0'
25
25
 
@@ -0,0 +1,53 @@
1
+ # This file is based on https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/spinach.rake
2
+ # Authored by Kamil Trzcinski <ayufan@ayufan.eu>
3
+ require 'colorize'
4
+
5
+ namespace :spinach do
6
+ desc 'run spinach tests with rerun reporter'
7
+ task :rerun do
8
+ run_spinach_tests
9
+ end
10
+ end
11
+
12
+ def tags
13
+ ENV['SPINACH_RERUN_TAGS']
14
+ end
15
+
16
+ def rerun_file
17
+ ENV['SPINACH_RERUN_FILE'] || 'tmp/spinach-rerun.txt'
18
+ end
19
+
20
+ def retry_count
21
+ ENV['SPINACH_RERUN_RETRY_COUNT'] ? ENV['SPINACH_RERUN_RETRY_COUNT'].to_i : 3
22
+ end
23
+
24
+ def prepend_cmd
25
+ ENV['SPINACH_RERUN_PREPEND_CMD'] || nil
26
+ end
27
+
28
+ def run_command(cmd)
29
+ env = {'RAILS_ENV' => 'test', 'SPINACH_RERUN_FILE' => rerun_file}
30
+ system(env, *cmd.compact)
31
+ end
32
+
33
+ def run_spinach(args)
34
+ run_command([prepend_cmd] + %w[spinach -r rerun] + args)
35
+ end
36
+
37
+ def run_spinach_tests
38
+ success = run_spinach(tags ? %W[--tags #{tags}] : [nil])
39
+
40
+ retry_count.times do
41
+ break if success
42
+ break unless File.exist?(rerun_file)
43
+
44
+ tests = File.foreach(rerun_file).map(&:chomp)
45
+ puts ''
46
+ puts "Spinach tests for #{tags}: Retrying tests... #{tests}".red
47
+ puts ''
48
+ sleep(3)
49
+ success = run_spinach(tests)
50
+ end
51
+
52
+ raise("spinach tests for #{tags} failed!".red) unless success
53
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spinach-rerun-reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-09-28 00:00:00.000000000 Z
12
+ date: 2018-10-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: spinach
@@ -47,6 +47,7 @@ files:
47
47
  - lib/spinach-rerun-reporter/version.rb
48
48
  - lib/spinach/reporter/rerun.rb
49
49
  - spinach-rerun-reporter.gemspec
50
+ - tasks/spinach_rerun.rake
50
51
  homepage: https://github.com/javierav/spinach-rerun-reporter
51
52
  licenses:
52
53
  - MIT