Skip to content

Commit 38760c5

Browse files
author
Alex Evanczuk
authored
Clean up test output (#52)
* remove logging in tests * stub out system calls to clean up test output
1 parent 67cb391 commit 38760c5

File tree

7 files changed

+2
-14
lines changed

7 files changed

+2
-14
lines changed

spec/lib/code_ownership/private/extension_loader_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ def bust_caches!
7575
it 'allows third party validations to be injected' do
7676
expect { CodeOwnership.validate! }.to raise_error do |e|
7777
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
78-
puts e.message
7978
expect(e.message).to eq <<~EXPECTED.chomp
8079
my validation errors
8180
See https://github.com/rubyatscale/code_ownership#README.md for more details

spec/lib/code_ownership/private/ownership_mappers/team_globs_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ module CodeOwnership
5151
it 'lets the user know that `owned_globs` can not overlap' do
5252
expect { CodeOwnership.validate! }.to raise_error do |e|
5353
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
54-
puts e.message
5554
expect(e.message).to eq <<~EXPECTED.chomp
5655
`owned_globs` cannot overlap between teams. The following globs overlap:
5756

spec/lib/code_ownership/private/validations/files_have_owners_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ module CodeOwnership
3030
it 'lets the user know the file must have ownership' do
3131
expect { CodeOwnership.validate! }.to raise_error do |e|
3232
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
33-
puts e.message
3433
expect(e.message).to eq <<~EXPECTED.chomp
3534
Some files are missing ownership:
3635

spec/lib/code_ownership/private/validations/files_have_unique_owners_spec.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ module CodeOwnership
5050
expect(CodeOwnership.for_file('app/missing_ownership.rb')).to eq nil
5151
expect { CodeOwnership.validate! }.to raise_error do |e|
5252
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
53-
puts e.message
5453
expect(e.message).to eq <<~EXPECTED.chomp
5554
Code ownership should only be defined for each file in one way. The following files have declared ownership in multiple ways.
5655

spec/lib/code_ownership/private/validations/github_codeowners_up_to_date_spec.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ module CodeOwnership
206206
expect_any_instance_of(codeowners_validation).to_not receive(:`) # rubocop:disable RSpec/AnyInstance
207207
expect { CodeOwnership.validate!(autocorrect: false) }.to raise_error do |e|
208208
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
209-
puts e.message
210209
expect(e.message).to eq <<~EXPECTED.chomp
211210
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
212211
@@ -225,7 +224,6 @@ module CodeOwnership
225224
expect_any_instance_of(codeowners_validation).to_not receive(:`) # rubocop:disable RSpec/AnyInstance
226225
expect { CodeOwnership.validate!(autocorrect: false) }.to raise_error do |e|
227226
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
228-
puts e.message
229227
expect(e.message).to eq <<~EXPECTED.chomp
230228
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
231229
@@ -250,7 +248,6 @@ module CodeOwnership
250248
expect_any_instance_of(codeowners_validation).to_not receive(:`) # rubocop:disable RSpec/AnyInstance
251249
expect { CodeOwnership.validate!(autocorrect: false) }.to raise_error do |e|
252250
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
253-
puts e.message
254251
expect(e.message).to eq <<~EXPECTED.chomp
255252
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
256253
@@ -279,7 +276,6 @@ module CodeOwnership
279276
expect_any_instance_of(codeowners_validation).to_not receive(:`) # rubocop:disable RSpec/AnyInstance
280277
expect { CodeOwnership.validate!(autocorrect: false) }.to raise_error do |e|
281278
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
282-
puts e.message
283279
expect(e.message).to eq <<~EXPECTED.chomp
284280
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
285281
@@ -326,7 +322,6 @@ module CodeOwnership
326322
expect_any_instance_of(codeowners_validation).to_not receive(:`) # rubocop:disable RSpec/AnyInstance
327323
expect { CodeOwnership.validate!(autocorrect: false) }.to raise_error do |e|
328324
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
329-
puts e.message
330325
expect(e.message).to eq <<~EXPECTED.chomp
331326
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
332327
@@ -384,7 +379,6 @@ module CodeOwnership
384379
expect_any_instance_of(codeowners_validation).to_not receive(:`) # rubocop:disable RSpec/AnyInstance
385380
expect { CodeOwnership.validate!(autocorrect: false) }.to raise_error do |e|
386381
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
387-
puts e.message
388382
expect(e.message).to eq <<~EXPECTED.chomp
389383
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
390384
@@ -430,7 +424,6 @@ module CodeOwnership
430424
expect_any_instance_of(codeowners_validation).to_not receive(:`) # rubocop:disable RSpec/AnyInstance
431425
expect { CodeOwnership.validate!(autocorrect: false) }.to raise_error do |e|
432426
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
433-
puts e.message
434427
expect(e.message).to eq <<~EXPECTED.chomp
435428
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
436429

spec/lib/code_ownership_spec.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
it 'lets the user know the team cannot be found in the file' do
2121
expect { CodeOwnership.validate! }.to raise_error do |e|
2222
expect(e).to be_a StandardError
23-
puts e.message
2423
expect(e.message).to eq <<~EXPECTED.chomp
2524
Could not find team with name: `Foo` in app/some_file.rb. Make sure the team is one of `["Bar"]`
2625
EXPECTED
@@ -39,7 +38,6 @@
3938
it 'lets the user know the team cannot be found in the package.yml' do
4039
expect { CodeOwnership.validate! }.to raise_error do |e|
4140
expect(e).to be_a StandardError
42-
puts e.message
4341
expect(e.message).to eq <<~EXPECTED.chomp
4442
Could not find team with name: `Foo` in packs/my_pack/package.yml. Make sure the team is one of `["Bar"]`
4543
EXPECTED
@@ -61,7 +59,6 @@
6159
it 'lets the user know the team cannot be found in the package.json' do
6260
expect { CodeOwnership.validate! }.to raise_error do |e|
6361
expect(e).to be_a StandardError
64-
puts e.message
6562
expect(e.message).to eq <<~EXPECTED.chomp
6663
Could not find team with name: `Foo` in frontend/javascripts/my_package. Make sure the team is one of `["Bar"]`
6764
EXPECTED

spec/spec_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
config.include_context 'application fixtures'
2020

2121
config.before do |c|
22+
allow_any_instance_of(CodeOwnership.const_get(:Private)::Validations::GithubCodeownersUpToDate).to receive(:`)
23+
allow(CodeOwnership::Cli).to receive(:`)
2224
codeowners_path.delete if codeowners_path.exist?
2325

2426
unless c.metadata[:do_not_bust_cache]

0 commit comments

Comments
 (0)