Sha256: 0f66d105a23278703b8fe82ff8a437a41703c523a071606b1f6a2a6439197911
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
require 'spec_helper' describe Dnsimple::Client, ".domains / zones" do subject { described_class.new(api_endpoint: "https://api.zone", username: "user", api_token: "token").domains } describe "#zone" do before do stub_request(:get, %r[/v1/domains/.+/zone$]). to_return(read_fixture("domains_zones/get/success.http")) end it "builds the correct request" do subject.zone("example.com") expect(WebMock).to have_requested(:get, "https://api.zone/v1/domains/example.com/zone"). with(headers: { 'Accept' => 'application/json' }) end it "returns the record" do result = subject.zone("example.com") expect(result).to be_a(String) expect(result).to match(/^#{Regexp.escape("$ORIGIN")}/) end context "when domain does not exist" do it "raises NotFoundError" do stub_request(:get, %r[/v1]). to_return(read_fixture("domains_zones/notfound-domain.http")) expect { subject.zone("example.com") }.to raise_error(Dnsimple::NotFoundError) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dnsimple-2.0.0 | spec/dnsimple/client/domains_zones_spec.rb |
dnsimple-2.0.0.alpha5 | spec/dnsimple/client/domains_zones_spec.rb |