Files
ubicloud/spec/model/firewall_rule_spec.rb
Jeremy Evans 4b819d3cb2 Change all create_with_id to create
It hasn't been necessary to use create_with_id since
ebc79622df, in December 2024.

I have plans to introduce:

```ruby
def create_with_id(id, values)
  obj = new(values)
  obj.id = id
  obj.save_changes
end
```

This will make it easier to use the same id when creating
multiple objects.  The first step is removing the existing
uses of create_with_id.
2025-08-06 01:55:51 +09:00

17 lines
441 B
Ruby

# frozen_string_literal: true
require_relative "spec_helper"
RSpec.describe FirewallRule do
let(:fw) {
Firewall.create(location_id: Location::HETZNER_FSN1_ID, project_id: Project.create(name: "test").id)
}
it "returns ip6? properly" do
fw_rule = described_class.create(cidr: "::/0", firewall_id: fw.id)
expect(fw_rule.ip6?).to be true
fw_rule.update(cidr: "0.0.0.0/0")
expect(fw_rule.ip6?).to be false
end
end