From 7da4a0e0f015a9dfe0f6c236a3263956dc569782 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Mon, 6 Jun 2022 11:38:37 +0200 Subject: [PATCH] Check that files stay unchanged in write mode. --- spec/test_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/test_spec.rb b/spec/test_spec.rb index 5ebb9e2..6951a2a 100644 --- a/spec/test_spec.rb +++ b/spec/test_spec.rb @@ -125,4 +125,13 @@ describe FormatStaged do repo.stage 'test.test' expect { repo.run_formatter }.to raise_error end + + it 'leaves files alone when write is false' do + repo.set_content 'test.test', 'a=b' + repo.stage 'test.test' + + expect(repo.run_formatter write: false).to be_truthy + expect(repo.get_content('test.test')).to eq 'a=b' + expect(repo.get_staged('test.test')).to eq 'a=b' + end end