Skip to content

Commit

Permalink
Handles empty firewall rule description - BR-2812
Browse files Browse the repository at this point in the history
  • Loading branch information
ngaumont committed Sep 27, 2024
1 parent 9e1c006 commit c8c1412
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Expired session handling not prompting for new login.
- `cb list` completion to include `--format`.
- `cb info` now correctly handles firewall rules with an empty description

## [3.5.1] - 2024-05-09
### Fixed
Expand Down
8 changes: 4 additions & 4 deletions spec/cb/firewall_rule_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ Spectator.describe FirewallRuleList do
action.output = IO::Memory.new
action.network_id = network.id

expect(client).to receive(:get_firewall_rules).and_return [Factory.firewall_rule]
expect(client).to receive(:get_firewall_rules).and_return [Factory.firewall_rule(description: nil)]
}

it "outputs table with header" do
action.call

expected = <<-EXPECTED
ID Rule Description
shofthj3fzaipie44lt6a5i3de 1.2.3.0/24 Example Description
shofthj3fzaipie44lt6a5i3de 1.2.3.0/24
EXPECTED

expect(&.output.to_s).to look_like expected
Expand All @@ -111,7 +111,7 @@ Spectator.describe FirewallRuleList do
action.call

expected = <<-EXPECTED
shofthj3fzaipie44lt6a5i3de 1.2.3.0/24 Example Description
shofthj3fzaipie44lt6a5i3de 1.2.3.0/24
EXPECTED

expect(&.output.to_s).to look_like expected
Expand All @@ -126,7 +126,7 @@ Spectator.describe FirewallRuleList do
"firewall_rules": [
{
"id": "shofthj3fzaipie44lt6a5i3de",
"description": "Example Description",
"description": null,
"rule": "1.2.3.0/24"
}
]
Expand Down
2 changes: 1 addition & 1 deletion src/models/firewall_rule.cr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module CB::Model
jrecord FirewallRule,
id : String,
description : String,
description : String?,
rule : String
end

0 comments on commit c8c1412

Please sign in to comment.