rspec_n 1.2.2 → 1.3.0
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 +5 -5
- data/.rubocop.yml +3 -0
- data/.travis.yml +4 -3
- data/CHANGELOG.md +22 -14
- data/Gemfile +0 -4
- data/exe/rspec_n +8 -0
- data/lib/rspec_n.rb +2 -2
- data/lib/rspec_n/constants.rb +2 -2
- data/lib/rspec_n/formatters/file_formatter.rb +6 -3
- data/lib/rspec_n/input.rb +14 -1
- data/lib/rspec_n/runner.rb +3 -3
- data/lib/rspec_n/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7885109452933b4683af78f646bf3d9c86da1da0f14060effdb9f6f51402dd00
|
4
|
+
data.tar.gz: 1147d10d70982cf22c9da390507c4fea06da3504ed8cc837acb638eb1bdb77ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41f20600834363b08a40db6f10f2c77a5ade7979d00d00e7911b548350e3df6a1576020d5a27ab6243213a7708a0874d01fdf2ea13dc94d531909513c30b847e
|
7
|
+
data.tar.gz: e9e2684e648dd911652678f3f052c6ee83457dac287c5aab21f50f82b8ebb47a02e11a9706a4512c668511c4939f86e1c16bc9780413955dcb373a7a6440b54f
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,29 +1,37 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
|
3
|
+
Issues are tracked at https://github.com/roberts1000/rubocop_plus/issues. Changes marked as **(Internal)** support development/refactoring.
|
4
4
|
|
5
|
-
1. (
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
## 1.3.0 (Jan 13, 2020)
|
6
|
+
|
7
|
+
[#49](../../issues/49): Make `--order project` work.
|
8
|
+
[#55](../../issues/55): Add `--dir` and `--timestamp` output options.
|
9
|
+
[#57](../../issues/57): Redesign the `CHANGELOG.md`.
|
10
|
+
|
11
|
+
## 1.2.2 (Jun 22, 2019)
|
12
|
+
|
13
|
+
[#36](../../issues/36): Add instructions for installing `rspec_n` in project Gemfiles.
|
14
|
+
[#38](../../issues/38): Stop `--order rand` from being added to the final command when a custom order is specified.
|
15
|
+
[#41](../../issues/41): Remove locking to a specify version of Ruby in development. **(Internal)**
|
16
|
+
[#43](../../issues/43): Use pry 0.12.x for development. **(Internal)**
|
9
17
|
|
10
18
|
## 1.2.1 (Mar 06, 2019)
|
11
19
|
|
12
|
-
|
20
|
+
[#30](../../issues/30): Make `-v` and `--version` work again.
|
13
21
|
|
14
22
|
## 1.2.0 (Mar 03, 2019)
|
15
23
|
|
16
|
-
|
24
|
+
[#26](../../issues/26): Write the command that was used to run rspec_n to the output files.
|
17
25
|
|
18
26
|
## 1.1.0 (Mar 03, 2019)
|
19
27
|
|
20
|
-
|
21
|
-
|
22
|
-
|
28
|
+
[#19](../../issues/19): Add **Result Counts** column which shows the result counts for each run (e.g. "400 examples, 2 failures, 3 pending").
|
29
|
+
[#20](../../issues/20): Accept an optional path argument, that is passed to RSpec, to target specs (e.g. `rspec_n 3 spec/features/example_spec.rb`, `rspec_n spec/features/example_spec.rb:5`, `rspec_n spec/features 4`).
|
30
|
+
[#23](../../issues/23): Rename the `Result Counts` column to `Results` and remove the existing `Results` column.
|
23
31
|
|
24
32
|
## 1.0.0 (Feb 18, 2019)
|
25
33
|
|
26
|
-
1
|
27
|
-
|
28
|
-
|
29
|
-
|
34
|
+
[#1](../../issues/1): Add initial core logic.
|
35
|
+
[#4](../../issues/4): Add initial CLI.
|
36
|
+
[#5](../../issues/5): Write results of each iteration to a separate file.
|
37
|
+
[#6](../../issues/6): Add `-s` option to stop on first failure.
|
data/Gemfile
CHANGED
data/exe/rspec_n
CHANGED
@@ -15,6 +15,7 @@ lib = File.expand_path('../lib', __dir__)
|
|
15
15
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
16
16
|
|
17
17
|
require "cri"
|
18
|
+
require "fileutils"
|
18
19
|
require "rspec_n/version"
|
19
20
|
require "rspec_n/constants"
|
20
21
|
require "rspec_n/errors/bad_option"
|
@@ -41,6 +42,13 @@ command = Cri::Command.define do
|
|
41
42
|
|
42
43
|
flag nil, "no-file", "Do not write iteration output to files"
|
43
44
|
|
45
|
+
flag nil, "timestamp", "Write iteration output to a timestamped directory, which can " \
|
46
|
+
"prevent accidental loss. NOTE: It is up to the user to periodically clean up files."
|
47
|
+
|
48
|
+
command_description = "Write iteration output to files in the provided directory " \
|
49
|
+
"rather than the current working directory. Can be used along with the timestamp flag."
|
50
|
+
option :d, :dir, command_description, argument: :required
|
51
|
+
|
44
52
|
flag :s, "stop-fast", "Stop when an iteration reports a failure."
|
45
53
|
|
46
54
|
command_description =
|
data/lib/rspec_n.rb
CHANGED
@@ -20,9 +20,9 @@ require "rspec_n/formatters/table_formatter"
|
|
20
20
|
# Setup pry for development when running "rake console". Guard against load
|
21
21
|
# errors in production (since pry is only loaded as a DEVELOPMENT dependency
|
22
22
|
# in the .gemspec)
|
23
|
-
# rubocop:disable Lint/
|
23
|
+
# rubocop:disable Lint/SuppressedException
|
24
24
|
begin
|
25
25
|
require "pry"
|
26
26
|
rescue LoadError
|
27
27
|
end
|
28
|
-
# rubocop:enable Lint/
|
28
|
+
# rubocop:enable Lint/SuppressedException
|
data/lib/rspec_n/constants.rb
CHANGED
@@ -3,7 +3,7 @@ module RspecN
|
|
3
3
|
DEFAULT_ITERATIONS = 10
|
4
4
|
DEFAULT_COMMAND = 'bundle exec rspec'.freeze
|
5
5
|
DEFAULT_RSPEC_STARTER_COMMAND = 'bin/start_rspec'.freeze
|
6
|
-
# rubocop:disable
|
6
|
+
# rubocop:disable Layout/LineLength
|
7
7
|
DEFAULT_RAILS_COMMAND = 'DISABLE_DATABASE_ENVIRONMENT_CHECK=1 RAILS_ENV=test bundle exec rake db:drop db:create db:migrate && bundle exec rspec'.freeze
|
8
|
-
# rubocop:enable
|
8
|
+
# rubocop:enable Layout/LineLength
|
9
9
|
end
|
@@ -12,16 +12,19 @@ module RspecN
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def delete_all_files
|
15
|
-
|
15
|
+
log_directory = Pathname.new(@runner.input.log_path)
|
16
|
+
Dir.glob(log_directory.join("#{BASE_FILE_NAME}.**")).each { |file| File.delete(file) }
|
16
17
|
end
|
17
18
|
|
18
19
|
def write(run, command)
|
19
20
|
return if run.skipped?
|
20
21
|
return unless @runner.input.write_files?
|
21
22
|
|
22
|
-
|
23
|
+
log_directory = Pathname.new(@runner.input.log_path)
|
24
|
+
FileUtils.mkdir_p(log_directory)
|
25
|
+
file_path = log_directory.join("#{BASE_FILE_NAME}.#{run.iteration}")
|
23
26
|
|
24
|
-
File.open(
|
27
|
+
File.open(file_path, "w") do |f|
|
25
28
|
f.write("Iteration: #{run.iteration}\n")
|
26
29
|
f.write("Start Time: #{run.formatted_start_time(@format)}\n")
|
27
30
|
f.write("Finish Time: #{run.formatted_finish_time(@format)}\n")
|
data/lib/rspec_n/input.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module RspecN
|
2
2
|
class Input
|
3
|
-
attr_accessor :iterations, :command, :stop_fast, :write_files
|
3
|
+
attr_accessor :iterations, :command, :stop_fast, :write_files, :log_path
|
4
4
|
def initialize(options, args)
|
5
5
|
@args = args
|
6
6
|
@unprocessed_args_array = args.entries
|
@@ -12,6 +12,8 @@ module RspecN
|
|
12
12
|
@command = determine_command
|
13
13
|
@stop_fast = options.fetch(:"stop-fast", false)
|
14
14
|
@write_files = !options.fetch(:'no-file', false)
|
15
|
+
@timestamp = options.fetch(:timestamp, false)
|
16
|
+
@log_path = determine_log_path
|
15
17
|
end
|
16
18
|
|
17
19
|
def write_files?
|
@@ -66,7 +68,18 @@ module RspecN
|
|
66
68
|
end
|
67
69
|
|
68
70
|
def should_append_order?(command)
|
71
|
+
return false if @order == "project"
|
72
|
+
|
69
73
|
command.match(/--order/).nil?
|
70
74
|
end
|
75
|
+
|
76
|
+
def determine_log_path
|
77
|
+
log_path = Pathname.new(@options.fetch(:dir, Dir.pwd))
|
78
|
+
return log_path unless @timestamp
|
79
|
+
|
80
|
+
directory_name = File.basename($PROGRAM_NAME)
|
81
|
+
directory_name << "-#{Time.now.getlocal.strftime('%Y%m%d%H%M%S%L')}"
|
82
|
+
log_path.join(directory_name)
|
83
|
+
end
|
71
84
|
end
|
72
85
|
end
|
data/lib/rspec_n/runner.rb
CHANGED
@@ -25,15 +25,15 @@ module RspecN
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def total_passed
|
28
|
-
@runs.values.
|
28
|
+
@runs.values.count(&:passed?)
|
29
29
|
end
|
30
30
|
|
31
31
|
def total_failed
|
32
|
-
@runs.values.
|
32
|
+
@runs.values.count(&:failed?)
|
33
33
|
end
|
34
34
|
|
35
35
|
def total_skipped
|
36
|
-
@runs.values.
|
36
|
+
@runs.values.count(&:skipped?)
|
37
37
|
end
|
38
38
|
|
39
39
|
private
|
data/lib/rspec_n/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- roberts1000
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -149,8 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
149
|
- !ruby/object:Gem::Version
|
150
150
|
version: '0'
|
151
151
|
requirements: []
|
152
|
-
|
153
|
-
rubygems_version: 2.6.14
|
152
|
+
rubygems_version: 3.1.2
|
154
153
|
signing_key:
|
155
154
|
specification_version: 4
|
156
155
|
summary: A ruby gem that runs RSpec N times.
|