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.
26 lines
809 B
Ruby
26 lines
809 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "../spec_helper"
|
|
|
|
RSpec.describe Clover, "cli fw create" do
|
|
it "creates firewall with no option" do
|
|
expect(Firewall.count).to eq 0
|
|
body = cli(%w[fw eu-central-h1/test-fw create])
|
|
expect(Firewall.count).to eq 1
|
|
fw = Firewall.first
|
|
expect(fw.name).to eq "test-fw"
|
|
expect(fw.description).to eq ""
|
|
expect(body).to eq "Firewall created with id: #{fw.ubid}\n"
|
|
end
|
|
|
|
it "creates firewall with -d option" do
|
|
expect(Firewall.count).to eq 0
|
|
body = cli(%w[fw eu-central-h1/test-fw create -d test-description])
|
|
expect(Firewall.count).to eq 1
|
|
fw = Firewall.first
|
|
expect(fw.name).to eq "test-fw"
|
|
expect(fw.description).to eq "test-description"
|
|
expect(body).to eq "Firewall created with id: #{fw.ubid}\n"
|
|
end
|
|
end
|