Skip to content

Commit

Permalink
Clean up test output (#52)
Browse files Browse the repository at this point in the history
* remove logging in tests

* stub out system calls to clean up test output
  • Loading branch information
Alex Evanczuk authored Apr 11, 2023
1 parent 67cb391 commit 38760c5
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 14 deletions.
1 change: 0 additions & 1 deletion spec/lib/code_ownership/private/extension_loader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def bust_caches!
it 'allows third party validations to be injected' do
expect { CodeOwnership.validate! }.to raise_error do |e|
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
puts e.message
expect(e.message).to eq <<~EXPECTED.chomp
my validation errors
See https://github.com/rubyatscale/code_ownership#README.md for more details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ module CodeOwnership
it 'lets the user know that `owned_globs` can not overlap' do
expect { CodeOwnership.validate! }.to raise_error do |e|
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
puts e.message
expect(e.message).to eq <<~EXPECTED.chomp
`owned_globs` cannot overlap between teams. The following globs overlap:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ module CodeOwnership
it 'lets the user know the file must have ownership' do
expect { CodeOwnership.validate! }.to raise_error do |e|
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
puts e.message
expect(e.message).to eq <<~EXPECTED.chomp
Some files are missing ownership:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ module CodeOwnership
expect(CodeOwnership.for_file('app/missing_ownership.rb')).to eq nil
expect { CodeOwnership.validate! }.to raise_error do |e|
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
puts e.message
expect(e.message).to eq <<~EXPECTED.chomp
Code ownership should only be defined for each file in one way. The following files have declared ownership in multiple ways.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ module CodeOwnership
expect_any_instance_of(codeowners_validation).to_not receive(:`) # rubocop:disable RSpec/AnyInstance
expect { CodeOwnership.validate!(autocorrect: false) }.to raise_error do |e|
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
puts e.message
expect(e.message).to eq <<~EXPECTED.chomp
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
Expand All @@ -225,7 +224,6 @@ module CodeOwnership
expect_any_instance_of(codeowners_validation).to_not receive(:`) # rubocop:disable RSpec/AnyInstance
expect { CodeOwnership.validate!(autocorrect: false) }.to raise_error do |e|
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
puts e.message
expect(e.message).to eq <<~EXPECTED.chomp
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
Expand All @@ -250,7 +248,6 @@ module CodeOwnership
expect_any_instance_of(codeowners_validation).to_not receive(:`) # rubocop:disable RSpec/AnyInstance
expect { CodeOwnership.validate!(autocorrect: false) }.to raise_error do |e|
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
puts e.message
expect(e.message).to eq <<~EXPECTED.chomp
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
Expand Down Expand Up @@ -279,7 +276,6 @@ module CodeOwnership
expect_any_instance_of(codeowners_validation).to_not receive(:`) # rubocop:disable RSpec/AnyInstance
expect { CodeOwnership.validate!(autocorrect: false) }.to raise_error do |e|
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
puts e.message
expect(e.message).to eq <<~EXPECTED.chomp
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
Expand Down Expand Up @@ -326,7 +322,6 @@ module CodeOwnership
expect_any_instance_of(codeowners_validation).to_not receive(:`) # rubocop:disable RSpec/AnyInstance
expect { CodeOwnership.validate!(autocorrect: false) }.to raise_error do |e|
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
puts e.message
expect(e.message).to eq <<~EXPECTED.chomp
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
Expand Down Expand Up @@ -384,7 +379,6 @@ module CodeOwnership
expect_any_instance_of(codeowners_validation).to_not receive(:`) # rubocop:disable RSpec/AnyInstance
expect { CodeOwnership.validate!(autocorrect: false) }.to raise_error do |e|
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
puts e.message
expect(e.message).to eq <<~EXPECTED.chomp
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
Expand Down Expand Up @@ -430,7 +424,6 @@ module CodeOwnership
expect_any_instance_of(codeowners_validation).to_not receive(:`) # rubocop:disable RSpec/AnyInstance
expect { CodeOwnership.validate!(autocorrect: false) }.to raise_error do |e|
expect(e).to be_a CodeOwnership::InvalidCodeOwnershipConfigurationError
puts e.message
expect(e.message).to eq <<~EXPECTED.chomp
CODEOWNERS out of date. Run `bin/codeownership validate` to update the CODEOWNERS file
Expand Down
3 changes: 0 additions & 3 deletions spec/lib/code_ownership_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
it 'lets the user know the team cannot be found in the file' do
expect { CodeOwnership.validate! }.to raise_error do |e|
expect(e).to be_a StandardError
puts e.message
expect(e.message).to eq <<~EXPECTED.chomp
Could not find team with name: `Foo` in app/some_file.rb. Make sure the team is one of `["Bar"]`
EXPECTED
Expand All @@ -39,7 +38,6 @@
it 'lets the user know the team cannot be found in the package.yml' do
expect { CodeOwnership.validate! }.to raise_error do |e|
expect(e).to be_a StandardError
puts e.message
expect(e.message).to eq <<~EXPECTED.chomp
Could not find team with name: `Foo` in packs/my_pack/package.yml. Make sure the team is one of `["Bar"]`
EXPECTED
Expand All @@ -61,7 +59,6 @@
it 'lets the user know the team cannot be found in the package.json' do
expect { CodeOwnership.validate! }.to raise_error do |e|
expect(e).to be_a StandardError
puts e.message
expect(e.message).to eq <<~EXPECTED.chomp
Could not find team with name: `Foo` in frontend/javascripts/my_package. Make sure the team is one of `["Bar"]`
EXPECTED
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
config.include_context 'application fixtures'

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

unless c.metadata[:do_not_bust_cache]
Expand Down

0 comments on commit 38760c5

Please sign in to comment.