Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/code_ownership/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ fn build_run_config() -> RunConfig {
codeowners_file_path: None,
config_path,
no_cache: false,
executable_name: None,
executable_name: Some("bin/codeownership validate".to_string()),
}
}

Expand Down
Binary file modified lib/code_ownership/code_ownership.bundle
Binary file not shown.
24 changes: 24 additions & 0 deletions spec/lib/code_ownership_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -555,4 +555,28 @@
end
end
end

describe '.validate!' do
context 'when the CODEOWNERS file is out of date' do
before do
create_non_empty_application
RustCodeOwners.generate_and_validate(nil, false)
# Add a new annotated file to make the CODEOWNERS file out of date
write_file('packs/my_pack/new_file.rb', "# @team Bar\nclass NewFile; end\n")
end

it 'raises an error referencing bin/codeownership validate' do
expect { CodeOwnership.validate!(autocorrect: false) }.to raise_error(
RuntimeError,
/Run `bin\/codeownership validate/
)
end

it 'does not reference the standalone codeowners CLI' do
expect { CodeOwnership.validate!(autocorrect: false) }.to raise_error(RuntimeError) do |error|
expect(error.message).not_to include('`codeowners generate`')
end
end
end
end
end
Loading