Files
ubicloud/spec/routes/api/cli/fw/attach-subnet_spec.rb
Jeremy Evans b4e14bbe25 Ensure cli response bodies end with newline
Currently, response bodies mix trailing newline and no trailing
newline, and it kind of works because bin/ubi is written in Ruby
and uses IO#puts, which will automatically add a newline if the
string being printed does not end with a newline.  However,
other languages may not have similar behavior, and for consistency,
it is best if the server always uses newlines in cli responses.
2025-02-21 09:32:10 -08:00

20 lines
640 B
Ruby

# frozen_string_literal: true
require_relative "../spec_helper"
RSpec.describe Clover, "cli fw attach-subnet" do
before do
cli(%w[ps eu-central-h1/test-ps create])
@ps = PrivateSubnet.first
fw = Firewall.first
cli(%w[fw eu-central-h1/test-fw create])
@fw = Firewall.exclude(id: fw.id).first
end
it "attaches firewall to subnet" do
expect(@fw.private_subnets).to be_empty
expect(cli(%W[fw eu-central-h1/test-fw attach-subnet #{@ps.ubid}])).to eq "Attached private subnet with id #{@ps.ubid} to firewall with id #{@fw.ubid}\n"
expect(@fw.reload.private_subnets.map(&:ubid)).to eq [@ps.ubid]
end
end