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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d086a277cdeda572b3358f254048ed4e7efa7028
4
- data.tar.gz: b17c3463cece7279db187d9469c3ec280efe605b
2
+ SHA256:
3
+ metadata.gz: 7885109452933b4683af78f646bf3d9c86da1da0f14060effdb9f6f51402dd00
4
+ data.tar.gz: 1147d10d70982cf22c9da390507c4fea06da3504ed8cc837acb638eb1bdb77ed
5
5
  SHA512:
6
- metadata.gz: 3717ceab5cd0fe798eddacebcfc66ad1ceccad082bec1c15f0843ced97179df37ceff80d24c8ff0fc47b2079408d5ec02eebbae41746fe044212e35dc8a4c9e7
7
- data.tar.gz: 2f2b6d24ee1e683dd312554560e0c1af09aae7da2f3dd81741fa24ea939b66c66792720463d6fd0517c4ac8b9ac1c8c4446c2b741c4828ab2496674f3516ec31
6
+ metadata.gz: 41f20600834363b08a40db6f10f2c77a5ade7979d00d00e7911b548350e3df6a1576020d5a27ab6243213a7708a0874d01fdf2ea13dc94d531909513c30b847e
7
+ data.tar.gz: e9e2684e648dd911652678f3f052c6ee83457dac287c5aab21f50f82b8ebb47a02e11a9706a4512c668511c4939f86e1c16bc9780413955dcb373a7a6440b54f
@@ -6,3 +6,6 @@ AllCops:
6
6
 
7
7
  Style/Documentation:
8
8
  Enabled: false
9
+
10
+ Rails:
11
+ Enabled: false
@@ -4,9 +4,10 @@ language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
6
  - 2.3.8
7
- - 2.4.5
8
- - 2.5.5
9
- - 2.6.3
7
+ - 2.4.9
8
+ - 2.5.7
9
+ - 2.6.5
10
+ - 2.7.0
10
11
  before_install: gem install bundler -v 2.0.2
11
12
  notifications:
12
13
  email:
@@ -1,29 +1,37 @@
1
1
  # CHANGELOG
2
2
 
3
- ## Next Release
3
+ Issues are tracked at https://github.com/roberts1000/rubocop_plus/issues. Changes marked as **(Internal)** support development/refactoring.
4
4
 
5
- 1. (New) Add Gemfile usage instructions to the README. ([Issue #36](https://github.com/roberts1000/rspec_n/issues/36))
6
- 1. (New) Remove locking to a specify version of Ruby in development. ([Issue #41](https://github.com/roberts1000/rspec_n/issues/41))
7
- 1. (New) Use pry 0.12.x for development. ([Issue #43](https://github.com/roberts1000/rspec_n/issues/43))
8
- 1. (New) Stop `--order rand` from being added to the final command when a custom order is specified. ([Issue #38](https://github.com/roberts1000/rspec_n/issues/38))
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
- 1. (Fix) Make `-v` and `--version` work again. ([Issue #30](https://github.com/roberts1000/rspec_n/issues/30))
20
+ [#30](../../issues/30): Make `-v` and `--version` work again.
13
21
 
14
22
  ## 1.2.0 (Mar 03, 2019)
15
23
 
16
- 1. (New) Write the command that was used to run rspec_n to the output files. ([Issue #26](https://github.com/roberts1000/rspec_n/issues/26))
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
- 1. (New) Add **Result Counts** column which shows the result counts for each run (e.g. "400 examples, 2 failures, 3 pending"). ([Issue #19](https://github.com/roberts1000/rspec_n/issues/19))
21
- 1. (New) Allow 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`). ([Issue #20](https://github.com/roberts1000/rspec_n/issues/20))
22
- 1. (New) Rename the `Result Counts` column to `Results` and remove the existing `Results` column. ([Issue #23](https://github.com/roberts1000/rspec_n/issues/23))
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. (New) Add initial core logic. ([Issue #1](https://github.com/roberts1000/rspec_n/issues/1))
27
- 1. (New) Add initial CLI. ([Issue #4](https://github.com/roberts1000/rspec_n/issues/4))
28
- 1. (New) Write results of each iteration to a separate file. ([Issue #5](https://github.com/roberts1000/rspec_n/issues/5))
29
- 1. (New) Add `-s` option to stop on first failure. ([Issue #6](https://github.com/roberts1000/rspec_n/issues/6))
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
@@ -2,7 +2,3 @@ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in rspec_n.gemspec
4
4
  gemspec
5
-
6
- group :development do
7
- gem 'rubocop_plus', "~> 1.0", require: false
8
- end
@@ -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 =
@@ -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/HandleExceptions
23
+ # rubocop:disable Lint/SuppressedException
24
24
  begin
25
25
  require "pry"
26
26
  rescue LoadError
27
27
  end
28
- # rubocop:enable Lint/HandleExceptions
28
+ # rubocop:enable Lint/SuppressedException
@@ -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 Metrics/LineLength
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 Metrics/LineLength
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
- Dir.glob("#{BASE_FILE_NAME}.**").each { |file| File.delete(file) }
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
- file_name = "#{BASE_FILE_NAME}.#{run.iteration}"
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(file_name, "w") do |f|
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")
@@ -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
@@ -25,15 +25,15 @@ module RspecN
25
25
  end
26
26
 
27
27
  def total_passed
28
- @runs.values.select(&:passed?).size
28
+ @runs.values.count(&:passed?)
29
29
  end
30
30
 
31
31
  def total_failed
32
- @runs.values.select(&:failed?).size
32
+ @runs.values.count(&:failed?)
33
33
  end
34
34
 
35
35
  def total_skipped
36
- @runs.values.select(&:skipped?).size
36
+ @runs.values.count(&:skipped?)
37
37
  end
38
38
 
39
39
  private
@@ -1,3 +1,3 @@
1
1
  module RspecN
2
- VERSION = "1.2.2".freeze
2
+ VERSION = "1.3.0".freeze
3
3
  end
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.2.2
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: 2019-06-22 00:00:00.000000000 Z
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
- rubyforge_project:
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.