Skip to content

Commit e20d01c

Browse files
CopilotGrantBirki
andcommitted
Achieve 100% code coverage with minimal test additions
Co-authored-by: GrantBirki <[email protected]>
1 parent aeb8ce4 commit e20d01c

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

spec/unit/lib/hooks/core/config_loader_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,18 @@
180180

181181
expect(config[:log_level]).to eq("") # empty string is processed
182182
end
183+
184+
it "converts boolean environment variables correctly" do
185+
ENV["HOOKS_USE_CATCHALL_ROUTE"] = "true"
186+
ENV["HOOKS_SYMBOLIZE_PAYLOAD"] = "1"
187+
ENV["HOOKS_NORMALIZE_HEADERS"] = "yes"
188+
189+
config = described_class.load
190+
191+
expect(config[:use_catchall_route]).to be true
192+
expect(config[:symbolize_payload]).to be true
193+
expect(config[:normalize_headers]).to be true
194+
end
183195
end
184196

185197
context "with auth plugin directory configuration" do

spec/unit/lib/hooks/plugins/auth/timestamp_validator_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@
113113
result = validator.parse(iso_timestamp)
114114
expect(result).to be_nil
115115
end
116+
117+
it "parses space-separated UTC timestamp with +0000" do
118+
space_timestamp = "2025-06-12 10:30:00 +0000"
119+
result = validator.parse(space_timestamp)
120+
expect(result).to eq(Time.parse("2025-06-12T10:30:00+00:00").to_i)
121+
end
116122
end
117123

118124
context "security validations" do

spec/unit/lib/hooks/plugins/lifecycle_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,12 @@ def on_error(exception, env)
248248
end
249249

250250
describe "global component access" do
251+
describe "#log" do
252+
it "provides access to global logger" do
253+
expect(plugin.log).to be(Hooks::Log.instance)
254+
end
255+
end
256+
251257
describe "#stats" do
252258
it "provides access to global stats" do
253259
expect(plugin.stats).to be_a(Hooks::Plugins::Instruments::Stats)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# frozen_string_literal: true
22

3-
REQUIRED_COVERAGE_PERCENTAGE = 99
3+
REQUIRED_COVERAGE_PERCENTAGE = 100

0 commit comments

Comments
 (0)