respec 0.8.1 → 0.8.2

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: 56354a86449a765dc844d9707fe125b4842668df
4
- data.tar.gz: 4e80d78dfa8278f5d3135f52b07df5f40e863f05
3
+ metadata.gz: 5287ceff6fa9eded7c5f0a8912ca3c8055ed7cba
4
+ data.tar.gz: 7a9e5aefa1fc9bf66e8abf70fe11974a30169d77
5
5
  SHA512:
6
- metadata.gz: 406e2a66ccfc426c25eac273689145d1e9c1a092561f431852ea2b3cda698fda7a549d038bcb4e6f9411223c2611144bc193f6c4b6276c5d325d244bbac685f2
7
- data.tar.gz: 57add028ef932511b8036f1320f45137efd27e7303b1cac458a6087262fdbcb69a366cae2f8fcc5b794ccca60fc90d5c443b5ede5b96dc11c966be428a6732a4
6
+ metadata.gz: 59702ab706685adfb63d56bd7c69a6f84b1c343657f5719b848206652145526c2e6b9b8989ced2f6455e80b406f331049b3f4b6cd04e49db288a0f0afe537244
7
+ data.tar.gz: c07787371280320de0e648bf1f80ee54f4c27d1992f8b77fd03f269fc51ed7d23f8a6120419cb3ebe41ea40cd92c7e99a6688d1678d8890feef812f5f93888d3
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.8.2 2015-03-13
2
+
3
+ * Using '1' or 'f' filters examples when used with line suffixes ('file:123').
4
+
1
5
  == 0.8.1 2015-02-14
2
6
 
3
7
  * Escape printed rspec command.
data/lib/respec/app.rb CHANGED
@@ -78,6 +78,7 @@ module Respec
78
78
  args = []
79
79
  files = []
80
80
  pass_next_arg = false
81
+ using_filters = false
81
82
  @args.each do |arg|
82
83
  if pass_next_arg
83
84
  args << arg
@@ -108,11 +109,13 @@ module Respec
108
109
  []
109
110
  end
110
111
  end
112
+ using_filters = true
111
113
  elsif arg =~ /\A\d+\z/
112
114
  i = Integer(arg)
113
115
  if (failure = failures[i - 1])
114
116
  args << '-e' << failure
115
117
  @update_failures = false
118
+ using_filters = true
116
119
  else
117
120
  warn "invalid failure: #{i} for (1..#{failures.size})"
118
121
  end
@@ -130,6 +133,12 @@ module Respec
130
133
  end
131
134
  end
132
135
 
136
+ # If rerunning failures, chop off explicit line numbers, as they are
137
+ # additive, and filters are subtractive.
138
+ if using_filters
139
+ files.map! { |f| f.sub(/:\d+\z/, '') }
140
+ end
141
+
133
142
  # Since we append our formatter as a file to run, rspec won't fall back to
134
143
  # using 'spec' by default. Add it explicitly here.
135
144
  files << 'spec' if files.empty?
@@ -1,5 +1,5 @@
1
1
  module Respec
2
- VERSION = [0, 8, 1]
2
+ VERSION = [0, 8, 2]
3
3
 
4
4
  class << VERSION
5
5
  include Comparable
@@ -136,6 +136,20 @@ describe Respec::App do
136
136
  expect(app.generated_args).to eq ["#{tmp}/existing.rb:123"]
137
137
  end
138
138
 
139
+ it "should truncate line numbers when using numeric arguments" do
140
+ make_failures_file 'a'
141
+ FileUtils.touch "#{tmp}/existing.rb"
142
+ app = Respec::App.new("#{tmp}/existing.rb:123", '1')
143
+ expect(app.generated_args).to eq ['-e', 'a', "#{tmp}/existing.rb"]
144
+ end
145
+
146
+ it "should truncate line numbers when rerunning all failures" do
147
+ make_failures_file 'a'
148
+ FileUtils.touch "#{tmp}/existing.rb"
149
+ app = Respec::App.new("#{tmp}/existing.rb:123", 'f')
150
+ expect(app.generated_args).to eq ['-e', 'a', "#{tmp}/existing.rb"]
151
+ end
152
+
139
153
  it "should treat other arguments as example names" do
140
154
  app = Respec::App.new('a', 'b')
141
155
  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.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Ogata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-14 00:00:00.000000000 Z
11
+ date: 2015-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec