diff --git a/spec/lib/code_ownership/private/extension_loader_spec.rb b/spec/lib/code_ownership/private/extension_loader_spec.rb index d2313ae..93386e8 100644 --- a/spec/lib/code_ownership/private/extension_loader_spec.rb +++ b/spec/lib/code_ownership/private/extension_loader_spec.rb @@ -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 diff --git a/spec/lib/code_ownership/private/ownership_mappers/team_globs_spec.rb b/spec/lib/code_ownership/private/ownership_mappers/team_globs_spec.rb index 28e4a93..686099d 100644 --- a/spec/lib/code_ownership/private/ownership_mappers/team_globs_spec.rb +++ b/spec/lib/code_ownership/private/ownership_mappers/team_globs_spec.rb @@ -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: diff --git a/spec/lib/code_ownership/private/validations/files_have_owners_spec.rb b/spec/lib/code_ownership/private/validations/files_have_owners_spec.rb index 16d9266..f8d3707 100644 --- a/spec/lib/code_ownership/private/validations/files_have_owners_spec.rb +++ b/spec/lib/code_ownership/private/validations/files_have_owners_spec.rb @@ -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: diff --git a/spec/lib/code_ownership/private/validations/files_have_unique_owners_spec.rb b/spec/lib/code_ownership/private/validations/files_have_unique_owners_spec.rb index ef9a7c5..9e250c0 100644 --- a/spec/lib/code_ownership/private/validations/files_have_unique_owners_spec.rb +++ b/spec/lib/code_ownership/private/validations/files_have_unique_owners_spec.rb @@ -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. diff --git a/spec/lib/code_ownership/private/validations/github_codeowners_up_to_date_spec.rb b/spec/lib/code_ownership/private/validations/github_codeowners_up_to_date_spec.rb index 5c69da7..53f6adf 100644 --- a/spec/lib/code_ownership/private/validations/github_codeowners_up_to_date_spec.rb +++ b/spec/lib/code_ownership/private/validations/github_codeowners_up_to_date_spec.rb @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/spec/lib/code_ownership_spec.rb b/spec/lib/code_ownership_spec.rb index 4b55291..bc52216 100644 --- a/spec/lib/code_ownership_spec.rb +++ b/spec/lib/code_ownership_spec.rb @@ -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 @@ -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 @@ -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 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index aba6a0f..cff691b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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]