Skip to content

Commit 598ba7a

Browse files
committed
Rename UPDATE_ALL_SNAPSHOTS to FORCE_UPDATE_SNAPSHOTS and add bin/ scripts
1 parent e540525 commit 598ba7a

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

bin/force_update_snapshots

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
set -e # Exit on error
4+
5+
FORCE_UPDATE_SNAPSHOTS=true bundle exec rake test
6+
7+
echo ""
8+
echo "Force updated snapshots!"

bin/update_snapshots

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
set -e # Exit on error
4+
5+
UPDATE_SNAPSHOTS=true bundle exec rake test
6+
7+
echo ""
8+
echo "Updated snapshots!"

test/snapshot_utils.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def save_failures_to_snapshot(content, source)
4343
puts source
4444
puts "\n\n"
4545

46-
if !ENV["UPDATE_ALL_SNAPSHOTS"].nil? ||
46+
if !ENV["FORCE_UPDATE_SNAPSHOTS"].nil? ||
4747
ask?("Do you want to update (or create) the snapshot for '#{class_name} #{name}'?")
4848

4949
puts "\nUpdating Snapshot for '#{class_name} #{name}' at: \n#{snapshot_file(source)}\n"
@@ -62,7 +62,7 @@ def assert_snapshot_matches(actual, source)
6262

6363
assert_equal snapshot_file(source).read, actual
6464
rescue Minitest::Assertion => e
65-
save_failures_to_snapshot(actual, source) if ENV["UPDATE_SNAPSHOTS"] || ENV["UPDATE_ALL_SNAPSHOTS"]
65+
save_failures_to_snapshot(actual, source) if ENV["UPDATE_SNAPSHOTS"] || ENV["FORCE_UPDATE_SNAPSHOTS"]
6666

6767
raise unless snapshot_file(source).exist?
6868

0 commit comments

Comments
 (0)