respec 0.9.1 → 1.0.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: e3f1571c77cdbc42f05ba4be1d24b16bd45594bc
4
- data.tar.gz: 87193ed3225cf42353d7c84daab601c527703833
2
+ SHA256:
3
+ metadata.gz: b854903b0cac9e8696389e30a07b67168ce756dbef11a49af76172c4c1cd5ff6
4
+ data.tar.gz: d52adcf975846cd2715c5022e744543685349e260a37864b0c78689cde92b7eb
5
5
  SHA512:
6
- metadata.gz: e4ef13eb162c6de5f5b8b833b3748b25f5df8fafb892841365711205252caa935a1ab0194eb159ad3d8fa6b17ead23b755259fc6af2784ac3f519781d67f4141
7
- data.tar.gz: 34855a3e3d6dd6bc663c17b68ed426a8b5f7d89da91b46b1460b321ac2229d0d0ce1e72ebf96d5a2df26e062e48ca148a7c0e0ed5d46fb148d5ab68b52c06134
6
+ metadata.gz: e6f3a12c9499cf25f1e78131a3815aeb8474be501e74d68d87a607f371d94074b3460f9e619f92d93f10fd6008429a0525f15f4bcbe8c32ac689e74bcd9cde4d
7
+ data.tar.gz: d8ee02f320d638439e8340aa83f65e0c96f37502fb60b9cd0a93d796b137afcd107a5096910fe9c75f6abc052f9fb57e9f2ab9045e14cf3075408877fae2508f
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.0.0 2025-03-17
2
+
3
+ * Support handling numeric ranges (e.g., '2-4')
4
+ * Fix handling of square bracket suffixes ('file[1:2:3]').
5
+
1
6
  == 0.9.1 2017-03-21
2
7
 
3
8
  * Fix passing some options which take arguments to rspec (e.g. -p).
data/lib/respec/app.rb CHANGED
@@ -87,6 +87,7 @@ module Respec
87
87
  pass_next_arg = false
88
88
  using_filters = false
89
89
  changed_only = false
90
+ path_suffix_re = /(:\d+|\[\d+(?::\d+)*\])\z/
90
91
  @args.each do |arg|
91
92
  if pass_next_arg
92
93
  args << arg
@@ -94,7 +95,7 @@ module Respec
94
95
  elsif rspec_option_that_requires_an_argument?(arg)
95
96
  args << arg
96
97
  pass_next_arg = true
97
- elsif File.exist?(arg.sub(/:\d+\z/, ''))
98
+ elsif File.exist?(arg.sub(path_suffix_re, ''))
98
99
  files << arg
99
100
  elsif arg =~ /\A(--)?help\z/
100
101
  @help_only = true
@@ -129,6 +130,20 @@ module Respec
129
130
  else
130
131
  @error = "invalid failure: #{i} for (1..#{failures.size})"
131
132
  end
133
+ elsif arg =~ /\A(\d+)-(\d+)\z/
134
+ lo = Integer($1)
135
+ hi = Integer($2)
136
+ if lo > hi
137
+ @error = "invalid range: #{lo}-#{hi}"
138
+ elsif failures[lo - 1].nil? || failures[hi - 1].nil?
139
+ @error = "failures out of range #{lo}-#{hi} (for 0..#{failures.size - 1})"
140
+ else
141
+ (lo..hi).each do |i|
142
+ args << "-e" << failures[i - 1]
143
+ end
144
+ @update_failures = false
145
+ using_filters = true
146
+ end
132
147
  else
133
148
  args << '-e' << arg.gsub(/[$]/, '\\\\\\0')
134
149
  end
@@ -146,7 +161,7 @@ module Respec
146
161
  # If rerunning failures, chop off explicit line numbers, as they are
147
162
  # additive, and filters are subtractive.
148
163
  if using_filters
149
- files.map! { |f| f.sub(/:\d+\z/, '') }
164
+ files.map! { |f| f.sub(path_suffix_re, '') }
150
165
  end
151
166
 
152
167
  # Since we append our formatter as a file to run, rspec won't fall back to
@@ -192,6 +207,7 @@ module Respec
192
207
  --order
193
208
  --seed
194
209
  --failure-exit-code
210
+ --error-exit-code
195
211
  --drb-port
196
212
  -f --format --formatter
197
213
  -o --out
@@ -200,6 +216,7 @@ module Respec
200
216
  -P --pattern
201
217
  --exclude-pattern
202
218
  -e --example
219
+ -E --example-matches
203
220
  -t --tag
204
221
  --default-path
205
222
  ].to_set
@@ -1,5 +1,5 @@
1
1
  module Respec
2
- VERSION = [0, 9, 1]
2
+ VERSION = [1, 0, 0]
3
3
 
4
4
  class << VERSION
5
5
  include Comparable
@@ -221,6 +221,12 @@ describe Respec::App do
221
221
  expect(app.generated_args).to eq ['-e', 'b', 'spec']
222
222
  end
223
223
 
224
+ it "should run the x through y-th failures if a numeric range x-y is given" do
225
+ make_failures_file 'a', 'b', 'c', 'd', 'e'
226
+ app = Respec::App.new('2-4')
227
+ expect(app.generated_args).to eq ['-e', 'b', '-e', 'c', '-e', 'd', 'spec']
228
+ end
229
+
224
230
  it "should interpret existing file names as file name arguments" do
225
231
  FileUtils.touch "#{tmp}/existing.rb"
226
232
  app = Respec::App.new("#{tmp}/existing.rb")
@@ -233,6 +239,12 @@ describe Respec::App do
233
239
  expect(app.generated_args).to eq ["#{tmp}/existing.rb:123"]
234
240
  end
235
241
 
242
+ it "should pass existing file names with discriminators in square brackets directly to rspec" do
243
+ FileUtils.touch "#{tmp}/existing.rb"
244
+ app = Respec::App.new("#{tmp}/existing.rb[1:22:333]")
245
+ expect(app.generated_args).to eq ["#{tmp}/existing.rb[1:22:333]"]
246
+ end
247
+
236
248
  it "should truncate line numbers when using numeric arguments" do
237
249
  make_failures_file 'a'
238
250
  FileUtils.touch "#{tmp}/existing.rb"
@@ -240,6 +252,13 @@ describe Respec::App do
240
252
  expect(app.generated_args).to eq ['-e', 'a', "#{tmp}/existing.rb"]
241
253
  end
242
254
 
255
+ it "should truncate square brackets when using numeric arguments" do
256
+ make_failures_file 'a'
257
+ FileUtils.touch "#{tmp}/existing.rb"
258
+ app = Respec::App.new("#{tmp}/existing.rb[1:22:333]", '1')
259
+ expect(app.generated_args).to eq ['-e', 'a', "#{tmp}/existing.rb"]
260
+ end
261
+
243
262
  it "should truncate line numbers when rerunning all failures" do
244
263
  make_failures_file 'a'
245
264
  FileUtils.touch "#{tmp}/existing.rb"
@@ -247,6 +266,13 @@ describe Respec::App do
247
266
  expect(app.generated_args).to eq ['-e', 'a', "#{tmp}/existing.rb"]
248
267
  end
249
268
 
269
+ it "should truncate square brackets when rerunning all failures" do
270
+ make_failures_file 'a'
271
+ FileUtils.touch "#{tmp}/existing.rb"
272
+ app = Respec::App.new("#{tmp}/existing.rb[1:22:333]", 'f')
273
+ expect(app.generated_args).to eq ['-e', 'a', "#{tmp}/existing.rb"]
274
+ end
275
+
250
276
  it "should treat other arguments as example names" do
251
277
  app = Respec::App.new('a', 'b')
252
278
  expect(app.generated_args).to eq ['-e', 'a', '-e', 'b', 'spec']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: respec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Ogata
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-21 00:00:00.000000000 Z
11
+ date: 2025-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -24,7 +24,7 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.11'
27
- description:
27
+ description:
28
28
  email:
29
29
  - george.ogata@gmail.com
30
30
  executables:
@@ -53,7 +53,7 @@ homepage: http://github.com/oggy/respec
53
53
  licenses:
54
54
  - MIT
55
55
  metadata: {}
56
- post_install_message:
56
+ post_install_message:
57
57
  rdoc_options: []
58
58
  require_paths:
59
59
  - lib
@@ -68,9 +68,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  requirements: []
71
- rubyforge_project:
72
- rubygems_version: 2.5.2
73
- signing_key:
71
+ rubygems_version: 3.5.9
72
+ signing_key:
74
73
  specification_version: 4
75
74
  summary: Rerun failing RSpec examples easily.
76
75
  test_files: