Sha256: b39aa8b2c4fbc2f223a55a107890ea8d80b5351b185b64814527057404320101

Contents?: true

Size: 980 Bytes

Versions: 12

Compression:

Stored size: 980 Bytes

Contents

describe Bosh::Cloudfoundry::Validations::DnsIpMappingValidation do
  subject { Bosh::Cloudfoundry::Validations::DnsIpMappingValidation.new("some.domain.com", "1.2.3.4") }

  it "resolves valid DNS -> single IP mapping" do
    subject.should_receive(:resolve_dns).with("some.domain.com").and_return([true, ["1.2.3.4"]])
    subject.validate
    subject.should be_valid
    subject.errors.should == []
  end

  it "fails to resolve invalid DNS -> single IP mapping" do
    subject.should_receive(:resolve_dns).with("some.domain.com").and_return([false, []])
    subject.validate
    subject.should_not be_valid
    subject.errors.should == ["Cannot resolve DNS 'some.domain.com' to an IP address"]
  end

  it "resolves DNS to a different IP" do
    subject.should_receive(:resolve_dns).with("some.domain.com").and_return([true, ["6.6.6.6"]])
    subject.validate
    subject.should_not be_valid
    subject.errors.should == ["DNS 'some.domain.com' resolves to: 6.6.6.6"]
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
bosh-cloudfoundry-0.7.6 spec/validations/dns_ip_mapping_validation_spec.rb
bosh-cloudfoundry-0.7.5 spec/validations/dns_ip_mapping_validation_spec.rb
bosh-cloudfoundry-0.7.4 spec/validations/dns_ip_mapping_validation_spec.rb
bosh-cloudfoundry-0.7.3 spec/validations/dns_ip_mapping_validation_spec.rb
bosh-cloudfoundry-0.7.2 spec/validations/dns_ip_mapping_validation_spec.rb
bosh-cloudfoundry-0.7.1 spec/validations/dns_ip_mapping_validation_spec.rb
bosh-cloudfoundry-0.7.0 spec/validations/dns_ip_mapping_validation_spec.rb
bosh-cloudfoundry-0.7.0.alpha.11 spec/validations/dns_ip_mapping_validation_spec.rb
bosh-cloudfoundry-0.7.0.alpha.10 spec/validations/dns_ip_mapping_validation_spec.rb
bosh-cloudfoundry-0.7.0.alpha.9 spec/validations/dns_ip_mapping_validation_spec.rb
bosh-cloudfoundry-0.7.0.alpha.8 spec/validations/dns_ip_mapping_validation_spec.rb
bosh-cloudfoundry-0.7.0.alpha.7 spec/validations/dns_ip_mapping_validation_spec.rb