rspec-rerun 0.3.0 → 0.3.1

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: 6d388b330116565e3727f28033b49af020d54bf5
4
- data.tar.gz: 0459c3704ff72c816994e5b033fcd759c039d43b
3
+ metadata.gz: f84f752f73a6cf918bccb79ac52aa94f784f905f
4
+ data.tar.gz: 85c72128204098706dcfc44747ba4723ab727c44
5
5
  SHA512:
6
- metadata.gz: 3b82514b1a26c9c18d10e7012a75b9f21c9b00c10110b19b9b9d18c3c22f38f79e4096bb6c4a683f33c8823b1d722369ceee24785014258448e60e8b3a6bc2e9
7
- data.tar.gz: 6e22e346348305c388dd4b886c9afaed3c1f7874ee5199a2a2910d40781bb4c2f86f6e57bf34ed1f1fbd1c895e27567c31ae700f5d6c0724cf3ee117399b2ae6
6
+ metadata.gz: 554f23058d54bb1cf30f427d5abe96d9ef6b8df1ab79de7b712015302a125a0684812f937444da5142b24e4dc0bba0c6995ac5c05527cd61ccab036e8202d50c
7
+ data.tar.gz: 0009bca486f669a32beb4ceb50a241c57b88f6105f1cb1845ab0bdc00ce090ba174e0e6f6c2d2254c26212b230d4e2532478f7a6e453be5d74bb8e9b7d22a22e
data/README.md CHANGED
@@ -56,12 +56,11 @@ Rerunning failed specs has been a long requested feature [#456](https://github.c
56
56
  Contributing
57
57
  ------------
58
58
 
59
- Fork the project. Make your feature addition or bug fix with tests. Send a pull request. Bonus points for topic branches.
59
+ See [CONTRIBUTING](CONTRIBUTING.md).
60
60
 
61
61
  Copyright and License
62
62
  ---------------------
63
63
 
64
- MIT License, see [LICENSE](https://github.com/dblock/rspec-rerun/blob/master/LICENSE.md) for details.
65
-
66
- (c) 2012-2014 [Artsy Inc.](http://artsy.github.com), [Daniel Doubrovkine](https://github.com/dblock) and [Contributors](https://github.com/dblock/rspec-rerun/blob/master/CHANGELOG.md)
64
+ MIT License, see [LICENSE](LICENSE.md) for details.
67
65
 
66
+ (c) 2012-2015 [Artsy Inc.](http://artsy.github.com), [Daniel Doubrovkine](https://github.com/dblock) and [Contributors](https://github.com/dblock/rspec-rerun/blob/master/CHANGELOG.md)
@@ -0,0 +1,61 @@
1
+ module RSpec
2
+ module Rerun
3
+ module Tasks
4
+ class << self
5
+ def rspec_opts(args, spec_files = nil)
6
+ opts = [
7
+ spec_files,
8
+ '--require', File.join(File.dirname(__FILE__), '../rspec-rerun'),
9
+ '--format', 'RSpec::Rerun::Formatters::FailuresFormatter',
10
+ *dot_rspec_params
11
+ ].compact.flatten
12
+ if args[:tag]
13
+ opts << '--tag'
14
+ opts << args[:tag]
15
+ end
16
+ opts
17
+ end
18
+
19
+ def parse_args(args)
20
+ opts = args.extras
21
+
22
+ # Error on multiple arguments
23
+ if opts.size > 1
24
+ fail ArgumentError 'rspec-rerun can take an integer (retry_count) or options hash'
25
+ else
26
+ opts = opts[0]
27
+ end
28
+
29
+ # Handle if opts is just a retry_count integer
30
+ opts = if opts.is_a? Hash
31
+ opts
32
+ else
33
+ { retry_count: opts }
34
+ end
35
+
36
+ # Parse environment variables
37
+ opts[:pattern] ||= ENV['RSPEC_RERUN_PATTERN'] if ENV['RSPEC_RERUN_PATTERN']
38
+ opts[:tag] ||= ENV['RSPEC_RERUN_TAG'] if ENV['RSPEC_RERUN_TAG']
39
+ opts[:retry_count] ||= ENV['RSPEC_RERUN_RETRY_COUNT'] if ENV['RSPEC_RERUN_RETRY_COUNT']
40
+ opts[:verbose] = (ENV['RSPEC_RERUN_VERBOSE'] != 'false') if opts[:verbose].nil?
41
+
42
+ opts
43
+ end
44
+
45
+ private
46
+
47
+ def dot_rspec_params
48
+ dot_rspec_file = ['.rspec', File.expand_path('~/.rspec')].detect { |f| File.exist?(f) }
49
+ dot_rspec = if dot_rspec_file
50
+ file_contents = File.read(dot_rspec_file)
51
+ file_contents.split(/\n+/).map(&:shellsplit).flatten
52
+ else
53
+ []
54
+ end
55
+ dot_rspec.concat ['--format', 'progress'] unless dot_rspec.include?('--format')
56
+ dot_rspec
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module Rerun
3
- VERSION = '0.3.0'
3
+ VERSION = '0.3.1'
4
4
  end
5
5
  end
@@ -1,94 +1,43 @@
1
1
  require 'rspec/core/rake_task'
2
+ require 'rspec-rerun/tasks'
2
3
 
3
- desc "Run RSpec examples."
4
- RSpec::Core::RakeTask.new("rspec-rerun:run") do |t, args|
4
+ desc 'Run RSpec examples.'
5
+ RSpec::Core::RakeTask.new('rspec-rerun:run') do |t, args|
5
6
  t.pattern = args[:pattern] if args[:pattern]
6
7
  t.fail_on_error = false
7
8
  t.verbose = false if args[:verbose] == false
8
- t.rspec_opts = rspec_opts(args)
9
+ t.rspec_opts = RSpec::Rerun::Tasks.rspec_opts(args)
9
10
  end
10
11
 
11
- desc "Re-run failed RSpec examples."
12
- RSpec::Core::RakeTask.new("rspec-rerun:rerun") do |t, args|
12
+ desc 'Re-run failed RSpec examples.'
13
+ RSpec::Core::RakeTask.new('rspec-rerun:rerun') do |t, args|
13
14
  failing_specs = File.read(RSpec::Rerun::Formatters::FailuresFormatter::FILENAME).split
14
15
 
15
16
  t.pattern = args[:pattern] if args[:pattern]
16
17
  t.fail_on_error = false
17
18
  t.verbose = false if args[:verbose] == false
18
- t.rspec_opts = rspec_opts(args, failing_specs.join(' '))
19
+ t.rspec_opts = RSpec::Rerun::Tasks.rspec_opts(args, failing_specs.join(' '))
19
20
  end
20
21
 
21
- desc "Run RSpec code examples."
22
- task "rspec-rerun:spec" do |t, args|
23
- parsed_args = parse_args(args)
22
+ desc 'Run RSpec code examples.'
23
+ task 'rspec-rerun:spec' do |_t, args|
24
+ parsed_args = RSpec::Rerun::Tasks.parse_args(args)
24
25
  retry_count = (parsed_args[:retry_count] || 1).to_i
25
26
 
26
- fail "retry count must be >= 1" if retry_count <= 0
27
+ fail 'retry count must be >= 1' if retry_count <= 0
27
28
  FileUtils.rm_f RSpec::Rerun::Formatters::FailuresFormatter::FILENAME
28
- Rake::Task["rspec-rerun:run"].execute(parsed_args)
29
+ Rake::Task['rspec-rerun:run'].execute(parsed_args)
29
30
  while !$?.success? && retry_count > 0
30
31
  retry_count -= 1
31
32
  failed_count = File.read(RSpec::Rerun::Formatters::FailuresFormatter::FILENAME).split(/\n+/).count
32
33
  msg = "[#{Time.now}] Failed, re-running #{failed_count} failure#{failed_count == 1 ? '' : 's'}"
33
34
  msg += ", #{retry_count} #{retry_count == 1 ? 'retry' : 'retries'} left" if retry_count > 0
34
35
  $stderr.puts "#{msg} ..."
35
- Rake::Task["rspec-rerun:rerun"].execute(parsed_args)
36
+ Rake::Task['rspec-rerun:rerun'].execute(parsed_args)
36
37
  end
37
- if !$?.success?
38
+ unless $?.success?
38
39
  failed_count = File.read(RSpec::Rerun::Formatters::FailuresFormatter::FILENAME).split(/\n+/).count
39
40
  $stderr.puts "[#{Time.now}] #{failed_count} failure#{failed_count == 1 ? '' : 's'}."
40
41
  fail "#{failed_count} failure#{failed_count == 1 ? '' : 's'}"
41
42
  end
42
43
  end
43
-
44
- def dot_rspec_params
45
- dot_rspec_file = [".rspec", File.expand_path("~/.rspec")].detect { |f| File.exist?(f) }
46
- dot_rspec = if dot_rspec_file
47
- file_contents = File.read(dot_rspec_file)
48
- file_contents.split(/\n+/).map { |l| l.shellsplit }.flatten
49
- else
50
- []
51
- end
52
- dot_rspec.concat ["--format", "progress"] unless dot_rspec.include?("--format")
53
- dot_rspec
54
- end
55
-
56
- def rspec_opts(args, spec_files = nil)
57
- opts = [
58
- spec_files,
59
- "--require", File.join(File.dirname(__FILE__), '../rspec-rerun'),
60
- "--format", "RSpec::Rerun::Formatters::FailuresFormatter",
61
- *dot_rspec_params
62
- ].compact.flatten
63
- if args[:tag]
64
- opts << "--tag"
65
- opts << args[:tag]
66
- end
67
- opts
68
- end
69
-
70
- def parse_args(args)
71
- opts = args.extras
72
-
73
- # Error on multiple arguments
74
- if opts.size > 1
75
- raise ArgumentError "rspec-rerun can take an integer (retry_count) or options hash"
76
- else
77
- opts = opts[0]
78
- end
79
-
80
- # Handle if opts is just a retry_count integer
81
- opts = if opts.is_a? Hash
82
- opts
83
- else
84
- {retry_count: opts}
85
- end
86
-
87
- # Parse environment variables
88
- opts[:pattern] ||= ENV['RSPEC_RERUN_PATTERN'] if ENV['RSPEC_RERUN_PATTERN']
89
- opts[:tag] ||= ENV['RSPEC_RERUN_TAG'] if ENV['RSPEC_RERUN_PATTERN']
90
- opts[:retry_count] ||= ENV['RSPEC_RERUN_RETRY_COUNT'] if ENV['RSPEC_RERUN_RETRY_COUNT']
91
- opts[:verbose] = (ENV['RSPEC_RERUN_VERBOSE'] != 'false') if opts[:verbose].nil?
92
-
93
- opts
94
- end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-rerun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-10 00:00:00.000000000 Z
11
+ date: 2015-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
@@ -58,45 +58,41 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.24.1
61
+ version: 0.29.1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.24.1
68
+ version: 0.29.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: bump
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description:
70
84
  email: dblock@dblock.org
71
85
  executables: []
72
86
  extensions: []
73
87
  extra_rdoc_files: []
74
88
  files:
75
- - .gitignore
76
- - .rspec
77
- - .rubocop.yml
78
- - .travis.yml
79
- - CHANGELOG.md
80
- - Gemfile
81
- - LICENSE.md
82
89
  - README.md
83
- - Rakefile
84
90
  - lib/rspec-rerun.rb
85
91
  - lib/rspec-rerun/formatters/failures_formatter.rb
86
92
  - lib/rspec-rerun/rspec.rb
93
+ - lib/rspec-rerun/tasks.rb
87
94
  - lib/rspec-rerun/version.rb
88
95
  - lib/tasks/rspec.rake
89
- - rspec-rerun.gemspec
90
- - rspec-rerun.png
91
- - spec-runs/fails_once_spec.rb
92
- - spec-runs/fails_twice_spec.rb
93
- - spec-runs/succeeds_spec.rb
94
- - spec/rspec-rerun/formatters/failures_formatter_spec.rb
95
- - spec/rspec-rerun/tasks/rspec_task_spec.rb
96
- - spec/rspec-rerun/version_spec.rb
97
- - spec/spec_helper.rb
98
- - spec/support/silence_stream.rb
99
- - spec/support/system.rb
100
96
  homepage: https://github.com/dblock/rspec-rerun
101
97
  licenses:
102
98
  - MIT
@@ -107,24 +103,18 @@ require_paths:
107
103
  - lib
108
104
  required_ruby_version: !ruby/object:Gem::Requirement
109
105
  requirements:
110
- - - '>='
106
+ - - ">="
111
107
  - !ruby/object:Gem::Version
112
108
  version: '0'
113
109
  required_rubygems_version: !ruby/object:Gem::Requirement
114
110
  requirements:
115
- - - '>='
111
+ - - ">="
116
112
  - !ruby/object:Gem::Version
117
113
  version: '0'
118
114
  requirements: []
119
115
  rubyforge_project:
120
- rubygems_version: 2.4.5
116
+ rubygems_version: 2.2.2
121
117
  signing_key:
122
118
  specification_version: 4
123
119
  summary: Re-run failed RSpec tests.
124
- test_files:
125
- - spec/rspec-rerun/formatters/failures_formatter_spec.rb
126
- - spec/rspec-rerun/tasks/rspec_task_spec.rb
127
- - spec/rspec-rerun/version_spec.rb
128
- - spec/spec_helper.rb
129
- - spec/support/silence_stream.rb
130
- - spec/support/system.rb
120
+ test_files: []
data/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- Gemfile.lock
2
- pkg
3
- rspec.failures
4
- .bundle
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --color
2
- --format=documentation
3
-
@@ -1,27 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- - vendor/**/*
4
-
5
- LineLength:
6
- Enabled: false
7
-
8
- MethodLength:
9
- Enabled: false
10
-
11
- ClassLength:
12
- Enabled: false
13
-
14
- Documentation:
15
- # don't require classes to be documented
16
- Enabled: false
17
-
18
- Encoding:
19
- # no need to always specify encoding
20
- Enabled: false
21
-
22
- FileName:
23
- Enabled: false
24
-
25
- SpecialGlobalVars:
26
- Enabled: false
27
-
@@ -1,22 +0,0 @@
1
- language: ruby
2
-
3
- cache: bundler
4
-
5
- rvm:
6
- - 2.1.2
7
- - 2.0.0
8
- - 1.9.3
9
- - rbx-2.2.10
10
- - jruby-19mode
11
- - ruby-head
12
- - jruby-head
13
-
14
- matrix:
15
- allow_failures:
16
- - rvm: ruby-head
17
- - rvm: jruby-head
18
-
19
- env:
20
- - RSPEC_VERSION=2
21
- - RSPEC_VERSION=3
22
-
@@ -1,40 +0,0 @@
1
- 0.3.0 (3/10/2015)
2
- -----------------
3
-
4
- * [#22](https://github.com/dblock/rspec-rerun/pull/22): Added support for RSpec 3 - [@nightscape](https://github.com/nightscape), [@dblock](https://github.com/dblock).
5
- * [#23](https://github.com/dblock/rspec-rerun/issues/23): Fixed dual formatter error - [@KurtPreston](https://github.com/KurtPreston).
6
- * [#26](https://github.com/dblock/rspec-rerun/pull/26): Allow disabling RSpec verbose output - [@KurtPreston](https://github.com/KurtPreston).
7
- * [#26](https://github.com/dblock/rspec-rerun/pull/26): Added support for running on a specific tag - [@KurtPreston](https://github.com/KurtPreston).
8
-
9
- 0.2.0
10
- -----
11
-
12
- * [#20](https://github.com/dblock/rspec-rerun/pull/20): Added support for ~/.rspec - [@grosser](https://github.com/grosser).
13
- * [#14](https://github.com/dblock/rspec-rerun/issues/14), [#2](https://github.com/dblock/rspec-rerun/issues/2), [#19](https://github.com/dblock/rspec-rerun/pull/19): Additionally use progress or other formatter specified in .rspec - [@grosser](https://github.com/grosser).
14
- * [#12](https://github.com/dblock/rspec-rerun/issues/12): Fixing execution of tests without names - [@KurtPreston](https://github.com/KurtPreston).
15
- * Removed Jeweler and rewritten rspec-rerun.gemspec - [@dblock](https://github.com/dblock).
16
- * Added Rubocop, Ruby-style linter - [@dblock](https://github.com/dblock).
17
-
18
- 0.1.3
19
- -----
20
-
21
- * [#10](https://github.com/dblock/rspec-rerun/pull/10): Add optional `retry_count` argument to `rspec-rerun:spec` - [@mzikherman](https://github.com/mzikherman), [@dblock](https://github.com/dblock).
22
- * Added support for `RSPEC_RERUN_RETRY_COUNT` and `RSPEC_RERUN_PATTERN` environment variables - [@dblock](https://github.com/dblock).
23
- * Report failed count and log rake task retry messages to `$stderr` - [@dblock](https://github.com/dblock).
24
-
25
- 0.1.2
26
- -----
27
-
28
- * Fix failed `rake rspec-rerun:rerun` being falsely reported as success - [@jonleighton](https://github.com/jonleighton).
29
- * [#9](https://github.com/dblock/rspec-rerun/pull/9): Added test for the `rspec-rerun:spec` Rake task - [@errm](https://github.com/errm).
30
-
31
- 0.1.1
32
- -----
33
-
34
- * Added logo - [@dblock](https://github.com/dblock).
35
- * [#1](https://github.com/dblock/rspec-rerun/issues/1): Require `rspec/core/rake_task` explicitly in `rspec.rake` - [@dblock](https://github.com/dblock), [@TylerRick](https://github.com/TylerRick).
36
-
37
- 0.1.0
38
- -----
39
-
40
- * Initial public release, including `RSpec::Rerun::Formatters::FailuresFormatter` and the `rspec-rerun:run`, `rspec-rerun:rerun`, and `rspec-rerun:spec` Rake tasks - [@dblock](https://github.com/dblock).
data/Gemfile DELETED
@@ -1,13 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gemspec
4
-
5
- case rspec_version = ENV['RSPEC_VERSION'] || '~> 3.0'
6
- when /2/
7
- gem 'rspec', '~> 2.11'
8
- when /3/
9
- gem 'rspec', '~> 3.0'
10
- gem 'rspec-legacy_formatters'
11
- else
12
- gem 'rspec', rspec_version
13
- end
data/LICENSE.md DELETED
@@ -1,22 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2012-2014, Artsy Inc., Daniel Doubrovkine and Contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,27 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler'
3
-
4
- libdir = File.expand_path('../lib', __FILE__)
5
- $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
6
-
7
- require 'rspec-rerun'
8
-
9
- begin
10
- Bundler.setup(:default, :development)
11
- rescue Bundler::BundlerError => e
12
- $stderr.puts e.message
13
- $stderr.puts 'Run `bundle install` to install missing gems'
14
- exit e.status_code
15
- end
16
-
17
- require 'rake'
18
-
19
- Bundler::GemHelper.install_tasks
20
-
21
- require 'rspec/core'
22
- require 'rspec/core/rake_task'
23
-
24
- require 'rubocop/rake_task'
25
- RuboCop::RakeTask.new(:rubocop)
26
-
27
- task default: [:rubocop, 'rspec-rerun:spec']
@@ -1,20 +0,0 @@
1
- require './lib/rspec-rerun/version'
2
- require './lib/rspec-rerun/rspec'
3
-
4
- Gem::Specification.new do |s|
5
- s.name = 'rspec-rerun'
6
- s.version = RSpec::Rerun::VERSION
7
- s.authors = ['Daniel Doubrovkine']
8
- s.summary = 'Re-run failed RSpec tests.'
9
- s.email = 'dblock@dblock.org'
10
- s.homepage = 'https://github.com/dblock/rspec-rerun'
11
- s.license = 'MIT'
12
- s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
13
- s.test_files = s.files.grep(/^(spec)\//)
14
-
15
- s.add_runtime_dependency 'rspec'
16
-
17
- s.add_development_dependency 'rake'
18
- s.add_development_dependency 'bundler'
19
- s.add_development_dependency 'rubocop', '0.24.1'
20
- end
Binary file
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Fails' do
4
- it 'once' do
5
- filename = ENV['RSPEC_RERUN_MARKER']
6
- if File.exist? filename
7
- File.delete filename
8
- fail
9
- else
10
- true.should eq true
11
- end
12
- end
13
- end
@@ -1,20 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Fails' do
4
- it 'twice' do
5
- filename_once = ENV['RSPEC_RERUN_MARKER']
6
- filename_twice = File.join(File.dirname(filename_once), 'fail_twice.state')
7
- if File.exist? filename_once
8
- File.delete filename_once
9
- File.open filename_twice, 'w' do |f|
10
- f.write 'fail'
11
- end
12
- fail
13
- elsif File.exist? filename_twice
14
- File.delete filename_twice
15
- fail
16
- else
17
- true.should eq true
18
- end
19
- end
20
- end
@@ -1,7 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Succeeds' do
4
- it 'always' do
5
- true.should eq true
6
- end
7
- end
@@ -1,55 +0,0 @@
1
- require 'spec_helper'
2
- require 'stringio'
3
-
4
- describe RSpec::Rerun::Formatters::FailuresFormatter do
5
-
6
- let(:output) { StringIO.new }
7
- let(:formatter) { RSpec::Rerun::Formatters::FailuresFormatter.new(output) }
8
- let(:example) { RSpec::Core::ExampleGroup.describe.example 'test' }
9
- let(:failures_file) { RSpec::Rerun::Formatters::FailuresFormatter::FILENAME }
10
-
11
- before { FileUtils.rm(failures_file) if File.exist?(failures_file) }
12
- after { FileUtils.rm(failures_file) if File.exist?(failures_file) }
13
-
14
- describe 'example_passed' do
15
- it 'should not create an rspec.failures file' do
16
- formatter.example_passed(example)
17
- formatter.dump_failures
18
- File.exist?(failures_file).should eq false
19
- end
20
- end
21
-
22
- describe 'example_failed' do
23
- it 'should create an rspec.failures file' do
24
- formatter.example_failed(example)
25
- formatter.dump_failures
26
- File.exist?(failures_file).should eq true
27
- File.read(failures_file).strip.should == example.location
28
- end
29
- it 'should create one line per failed example' do
30
- 2.times { formatter.example_failed(example) }
31
- formatter.dump_failures
32
- File.exist?(failures_file).should eq true
33
- File.read(failures_file).split("\n").should == [example.location, example.location]
34
- end
35
- end
36
-
37
- describe 'clean!' do
38
- it "doesn't raise errors when the retry file doesn't exist" do
39
- -> { formatter.clean! }.should_not raise_error
40
- end
41
- it 'deletes the retry file' do
42
- File.open(failures_file, 'w+') do |f|
43
- f.puts 'test'
44
- end
45
- File.exist?(failures_file).should eq true
46
- formatter.clean!
47
- File.exist?(failures_file).should eq false
48
- end
49
- end
50
-
51
- after :each do
52
- formatter.clean!
53
- end
54
-
55
- end
@@ -1,120 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'RakeTask' do
4
- let(:root) { File.join(File.dirname(__FILE__), '../../..') }
5
- before :each do
6
- @filename = File.join(root, 'fail_once.state')
7
- File.open @filename, 'w' do |f|
8
- f.write 'fail'
9
- end
10
- end
11
-
12
- around :each do |example|
13
- silence_stream STDOUT do
14
- Dir.mktmpdir do |dir|
15
- ENV['HOME'] = dir
16
- example.run
17
- end
18
- end
19
- FileUtils.rm_f @filename
20
- end
21
-
22
- it 'succeeds' do
23
- system! "cd #{root} && RSPEC_RERUN_MARKER=#{@filename} RSPEC_RERUN_PATTERN=spec-runs/succeeds_spec.rb rake rspec-rerun:spec"
24
- end
25
-
26
- it 'retries a spec failure once' do
27
- system! "cd #{root} && RSPEC_RERUN_MARKER=#{@filename} RSPEC_RERUN_PATTERN=spec-runs/fails_once_spec.rb rake rspec-rerun:spec"
28
- end
29
-
30
- it 'retries a spec failure twice' do
31
- system! "cd #{root} && RSPEC_RERUN_MARKER=#{@filename} RSPEC_RERUN_PATTERN=spec-runs/fails_twice_spec.rb rake rspec-rerun:spec[2]"
32
- end
33
-
34
- it 'retries a spec failure via RSPEC_RERUN_RETRY_COUNT' do
35
- system! "cd #{root} && RSPEC_RERUN_RETRY_COUNT=2 RSPEC_RERUN_MARKER=#{@filename} RSPEC_RERUN_PATTERN=spec-runs/fails_twice_spec.rb rake rspec-rerun:spec[2]"
36
- end
37
-
38
- it 'does not retry via RSPEC_RERUN_RETRY_COUNT=0' do
39
- expect do
40
- system! "cd #{root} && RSPEC_RERUN_RETRY_COUNT=0 RSPEC_RERUN_MARKER=#{@filename} RSPEC_RERUN_PATTERN=spec-runs/fails_once_spec.rb rake rspec-rerun:spec"
41
- end.to raise_error RuntimeError, /failed with exit code 1/
42
- end
43
-
44
- it 'fails with one too few retry counts' do
45
- expect do
46
- system! "cd #{root} && RSPEC_RERUN_MARKER=#{@filename} RSPEC_RERUN_PATTERN=spec-runs/fails_twice_spec.rb rake rspec-rerun:spec"
47
- end.to raise_error RuntimeError, /failed with exit code 1/
48
- end
49
-
50
- it 'fails with one too few retry counts set via RSPEC_RERUN_RETRY_COUNT' do
51
- expect do
52
- system! "cd #{root} && RSPEC_RERUN_RETRY_COUNT=1 RSPEC_RERUN_MARKER=#{@filename} RSPEC_RERUN_PATTERN=spec-runs/fails_twice_spec.rb rake rspec-rerun:spec"
53
- end.to raise_error RuntimeError, /failed with exit code 1/
54
- end
55
-
56
- context 'verbose output' do
57
- it 'displays the rspec command by default' do
58
- `cd #{root} && RSPEC_RERUN_MARKER=#{@filename} RSPEC_RERUN_PATTERN=spec-runs/succeeds_spec.rb rake rspec-rerun:spec`.should include('rspec')
59
- end
60
-
61
- context 'when the RSPEC_RERUN_VERBOSE flag is set to false' do
62
- it "doesn't display the rspec command" do
63
- `cd #{root} && RSPEC_RERUN_VERBOSE=false RSPEC_RERUN_MARKER=#{@filename} RSPEC_RERUN_PATTERN=spec-runs/succeeds_spec.rb rake rspec-rerun:spec`.should_not include('rspec')
64
- end
65
- end
66
- end
67
-
68
- context 'tag execution' do
69
- it 'does not scope by tag by default' do
70
- `cd #{root} && RSPEC_RERUN_MARKER=#{@filename} RSPEC_RERUN_PATTERN=spec-runs/succeeds_spec.rb rake rspec-rerun:spec`.should_not include('--tag')
71
- end
72
-
73
- context 'when the RSPEC_RERUN_TAG flag is set' do
74
- it 'scopes rspec to the tag' do
75
- `cd #{root} && RSPEC_RERUN_TAG=test RSPEC_RERUN_MARKER=#{@filename} RSPEC_RERUN_PATTERN=spec-runs/succeeds_spec.rb rake rspec-rerun:spec`.should include('--tag test')
76
- end
77
- end
78
- end
79
-
80
- context 'preserving .rspec' do
81
- let(:dot_rspec) { "#{root}/.rspec" }
82
- let(:home_rspec) { File.expand_path('~/.rspec') }
83
- let(:run) { `cd #{root} && RSPEC_RERUN_RETRY_COUNT=1 RSPEC_RERUN_MARKER=#{@filename} RSPEC_RERUN_PATTERN=spec-runs/fails_twice_spec.rb rake rspec-rerun:spec 2>&1` }
84
-
85
- around :each do |test|
86
- begin
87
- old = File.read(dot_rspec)
88
- File.unlink(dot_rspec)
89
- test.call
90
- ensure
91
- File.write(dot_rspec, old)
92
- end
93
- end
94
-
95
- it 'also uses progress if there is not .rspec' do
96
- run.should include '--format progress'
97
- end
98
-
99
- it 'also uses progress if formatter is not given' do
100
- File.write(dot_rspec, '--color')
101
- run.should include '--format progress'
102
- end
103
-
104
- it 'only uses the formatter specified by the .rspec file' do
105
- File.write(dot_rspec, '--format documentation')
106
- run.should include '--format documentation'
107
- run.should_not include '--format progress'
108
- end
109
-
110
- it 'also uses given formatter' do
111
- File.write(dot_rspec, "--color\n--format documentation")
112
- run.should include '--format documentation'
113
- end
114
-
115
- it 'also uses given formatter from home' do
116
- File.write(File.expand_path('~/.rspec'), "--color\n--format documentation")
117
- run.should include '--format documentation'
118
- end
119
- end
120
- end
@@ -1,8 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe RSpec::Rerun do
4
- it 'has a version' do
5
- RSpec::Rerun::VERSION.should_not be_nil
6
- RSpec::Rerun::VERSION.to_f.should > 0
7
- end
8
- end
@@ -1,21 +0,0 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
-
4
- require 'rspec'
5
- require 'rake'
6
- require 'rspec-rerun'
7
- require 'tmpdir'
8
-
9
- %w(support examples).each do |dir|
10
- Dir[File.join(File.dirname(__FILE__), dir, '*.rb')].each do |file|
11
- require file
12
- end
13
- end
14
-
15
- if RSpec::Rerun.rspec3?
16
- RSpec.configure do |config|
17
- config.expect_with :rspec do |c|
18
- c.syntax = [:should, :expect]
19
- end
20
- end
21
- end
@@ -1,8 +0,0 @@
1
- def silence_stream(stream)
2
- old_stream = stream.dup
3
- stream.reopen('/dev/null')
4
- stream.sync = true
5
- yield
6
- ensure
7
- stream.reopen(old_stream)
8
- end
@@ -1,4 +0,0 @@
1
- def system!(cmd)
2
- rc = system(cmd)
3
- fail "failed with exit code #{$?.exitstatus}" if rc.nil? || !rc || $?.exitstatus != 0
4
- end