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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be12d73943b80c42edd514e0c6ccf2f5dc24462cea4785103b5897934e5b96af
4
- data.tar.gz: bab18e70950621387cd6324a5d9ff81e6805790cb616982cb298e852992d487d
3
+ metadata.gz: 401c7787d4df45c79d720a28a04804fb926937697328840b80cfe20e1865486c
4
+ data.tar.gz: 7c55d0c11c8ea28108724633cb941db07d5bf1cd7eb6039b3267ae2513ead084
5
5
  SHA512:
6
- metadata.gz: 17221459a0ff5b0fde581a675f18cda19376fadfb4968662d8ef617b9e4d8efcf49db646ade14eb640872d7a7caf456bccb90313c81b16979faecda343d0e0aa
7
- data.tar.gz: 4b79e621827cbc482b52045dbb608ca88df43b1b323003dd8af2b8e226dc42af575cae56f5c3d7043efa6cd3d6ad6d8f2c4da1f8a14bb16ad83bb5d3a2d3f6c4
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 runnign. The supplied regular expression
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
@@ -1,3 +1,3 @@
1
1
  module RSpecFixtures
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  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.2
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-06-10 00:00:00.000000000 Z
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.3
104
+ rubygems_version: 3.0.4
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: Interactive RSpec Fixtures