2017-06-01 04:26:55 -03:00
|
|
|
require "cmd/cask"
|
|
|
|
|
|
|
|
describe Hbc::DSL::Appcast do
|
|
|
|
subject { described_class.new(url, params) }
|
|
|
|
|
2018-08-06 16:50:42 +02:00
|
|
|
let(:url) { "https://example.com" }
|
2017-10-03 08:29:20 +02:00
|
|
|
let(:uri) { URI(url) }
|
2017-06-01 04:26:55 -03:00
|
|
|
let(:params) { {} }
|
|
|
|
|
|
|
|
describe "#to_s" do
|
|
|
|
it "returns the parsed URI string" do
|
2018-08-06 16:50:42 +02:00
|
|
|
expect(subject.to_s).to eq("https://example.com")
|
2017-06-01 04:26:55 -03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "#to_yaml" do
|
|
|
|
let(:yaml) { [uri, params].to_yaml }
|
|
|
|
|
|
|
|
context "with empty parameters" do
|
|
|
|
it "returns an YAML serialized array composed of the URI and parameters" do
|
|
|
|
expect(subject.to_yaml).to eq(yaml)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "with checkpoint in parameters" do
|
|
|
|
let(:params) { { checkpoint: "abc123" } }
|
|
|
|
|
|
|
|
it "returns an YAML serialized array composed of the URI and parameters" do
|
|
|
|
expect(subject.to_yaml).to eq(yaml)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|