rspec_fixtures 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -1
- data/lib/rspec_fixtures/approval_handler.rb +5 -1
- data/lib/rspec_fixtures/rspec_config.rb +1 -0
- data/lib/rspec_fixtures/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 401c7787d4df45c79d720a28a04804fb926937697328840b80cfe20e1865486c
|
4
|
+
data.tar.gz: 7c55d0c11c8ea28108724633cb941db07d5bf1cd7eb6039b3267ae2513ead084
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54d81dece952c56aa6b26ae36badf588945a025abba189907d2e6784dbbcd03b710b2352608771320b8f5690113764962b1637bec4686831b177f821d6593870
|
7
|
+
data.tar.gz: a6582c268f11d342806f31a1c7a5c443e6c62807c5f597396fb562493f47385355214867c8d2257e83197055d015698d55933ee95269f8701523d7fe00a2ff21
|
data/README.md
CHANGED
@@ -102,7 +102,7 @@ expect{ puts 'some string' }.to output_fixture('fixture_filename').diff(5)
|
|
102
102
|
### `except` - Exclude by regular expression
|
103
103
|
|
104
104
|
Adding `except(regex)` to either `match_fixture` or `output_fixture` will
|
105
|
-
modify the string under test before
|
105
|
+
modify the string under test before running. The supplied regular expression
|
106
106
|
must include exactly one capture group, which will be then replaced by '...'.
|
107
107
|
|
108
108
|
In the below example, we ignore the full path of the file.
|
@@ -158,4 +158,25 @@ end
|
|
158
158
|
```
|
159
159
|
|
160
160
|
|
161
|
+
### `auto_approve`
|
162
|
+
|
163
|
+
If you wish to automatically approve all new or changed fixtures, you can
|
164
|
+
set the `auto_approve` configuration option to `true`. By default,
|
165
|
+
auto approval is enabled if the environment variable `AUTO_APPROVE` is set.
|
166
|
+
|
167
|
+
```ruby
|
168
|
+
RSpec.configure do |config|
|
169
|
+
config.auto_approve = true # or any logic
|
170
|
+
end
|
171
|
+
```
|
172
|
+
|
173
|
+
This feature is intended to help clean up the fixtures folder from old, no
|
174
|
+
longer used files. Simply run the specs once, to ensure they all oass,
|
175
|
+
delete the fixtures folder, and run the specs again with:
|
176
|
+
|
177
|
+
```
|
178
|
+
$ AUTO_APPROVE=1 rspec
|
179
|
+
```
|
180
|
+
|
181
|
+
|
161
182
|
[1]: https://en.wikipedia.org/wiki/Levenshtein_distance
|
@@ -23,7 +23,7 @@ module RSpecFixtures
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def prompt_user
|
26
|
-
response = get_response
|
26
|
+
response = auto_approve? ? :approve : get_response
|
27
27
|
|
28
28
|
case response
|
29
29
|
|
@@ -40,6 +40,10 @@ module RSpecFixtures
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
def auto_approve?
|
44
|
+
RSpec.configuration.auto_approve
|
45
|
+
end
|
46
|
+
|
43
47
|
def get_response
|
44
48
|
prompt.select "Please Choose:", menu_options, symbols: { marker: '>' }
|
45
49
|
rescue TTY::Reader::InputInterrupt
|
@@ -4,5 +4,6 @@ if defined? RSpec
|
|
4
4
|
config.include RSpecFixtures::Matchers
|
5
5
|
config.add_setting :fixtures_path, default: File.expand_path('spec/fixtures')
|
6
6
|
config.add_setting :interactive_fixtures, default: !ENV['CI']
|
7
|
+
config.add_setting :auto_approve, default: ENV['AUTO_APPROVE']
|
7
8
|
end
|
8
9
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_fixtures
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
requirements: []
|
104
|
-
rubygems_version: 3.0.
|
104
|
+
rubygems_version: 3.0.4
|
105
105
|
signing_key:
|
106
106
|
specification_version: 4
|
107
107
|
summary: Interactive RSpec Fixtures
|