Sha256: 196240f1ef6ad79edd41656f7b800c9067a62531c6658ba2701767d2ff1b043c

Contents?: true

Size: 1.99 KB

Versions: 43

Compression:

Stored size: 1.99 KB

Contents

Shindo.tests("Fog::DNS[:dreamhost] | record", ['dreamhost', 'dns']) do

  service = Fog::DNS[:dreamhost]
  record  = service.records.first

  tests('#attributes') do
    tests('should have') do
      model_attribute_hash = record.attributes
      attributes = [
        :name,
        :value,
        :zone,
        :type,
        :editable,
        :account_id,
        :comment,
      ]
      attributes.each do |attribute|
        test("#{attribute} method") { record.respond_to? attribute }
      end
      attributes.each do |attribute|
        test("#{attribute} key") { model_attribute_hash.key? attribute }
      end
    end

    test('be a kind of Fog::DNS::Dreamhost::Record') do
      record.kind_of? Fog::DNS::Dreamhost::Record
    end

    tests('Write operations') do
      name = "test.#{test_domain}"
      r = service.records.create :name  => name,
                                 :type  => 'A',
                                 :value => "8.8.8.8"
      sleep 10
      tests('#save') do
        test('returns Fog::DNS::Dreamhost::Record') do
          r.is_a? Fog::DNS::Dreamhost::Record
        end
        test('value is 8.8.8.8') do
          r.value == '8.8.8.8'
        end
        test("name is #{name}") do
          r.name == name
        end
        test("listed") do
          !(service.records.find { |r| r.name == name }).nil?
        end
      end
      tests('#destroy') do
        test('returns true') { r.destroy == true }
        test('destroyed record not listed') do
          (service.records.find { |r| r.name == name }).nil?
        end
      end
      tests('#save from zone') do
        name = "zone-create.#{test_domain}"
        r = service.zones.first.records.create :name  => name,
                                               :type  => 'A',
                                               :value => "8.8.8.8"
        sleep 10
        test("listed") do
          !(service.records.find { |r| r.name == name }).nil?
        end
      end
    end
  end

  # cleanup
  cleanup_records

end

Version data entries

43 entries across 41 versions & 6 rubygems

Version Path
fog-2.3.0 tests/dreamhost/models/dns/record_tests.rb
fog-ifeel-2.2.0 tests/dreamhost/models/dns/record_tests.rb
fog-2.2.0 tests/dreamhost/models/dns/record_tests.rb
fog-2.1.0 tests/dreamhost/models/dns/record_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-1.42.1/tests/dreamhost/models/dns/record_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-1.42.1/tests/dreamhost/models/dns/record_tests.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-1.42.1/tests/dreamhost/models/dns/record_tests.rb
fog-1.42.1 tests/dreamhost/models/dns/record_tests.rb
fog-2.0.0 tests/dreamhost/models/dns/record_tests.rb
fog-1.42.0 tests/dreamhost/models/dns/record_tests.rb
fog-1.41.0 tests/dreamhost/models/dns/record_tests.rb
fog-1.40.0 tests/dreamhost/models/dns/record_tests.rb
fog-1.39.0 tests/dreamhost/models/dns/record_tests.rb
fog-1.38.0 tests/dreamhost/models/dns/record_tests.rb
fog-1.37.0 tests/dreamhost/models/dns/record_tests.rb
fog-1.36.0 tests/dreamhost/models/dns/record_tests.rb
fog-1.35.0 tests/dreamhost/models/dns/record_tests.rb
fog-2.0.0.pre.0 tests/dreamhost/models/dns/record_tests.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/tests/dreamhost/models/dns/record_tests.rb
fog-1.34.0 tests/dreamhost/models/dns/record_tests.rb