Sha256: 149b6d8678e482fb0abd41bb99cf7ef350f7c0a54eb98c7d1f0cc74227debede

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

require File.expand_path '../../test_helper', __dir__

# Test class for Zone Model
class TestZone < Minitest::Test
  def setup
    @service = Fog::DNS::AzureRM.new(credentials)
    @zone = zone(@service)
    @response = ApiStub::Models::DNS::Zone.create_zone_obj
  end

  def test_model_methods
    methods = [
      :save,
      :destroy
    ]
    methods.each do |method|
      assert @zone.respond_to? method, true
    end
  end

  def test_model_attributes
    attributes = [
      :name,
      :id,
      :resource_group
    ]
    attributes.each do |attribute|
      assert @zone.respond_to? attribute, true
    end
  end

  def test_save_method_response
    @service.stub :create_or_update_zone, @response do
      assert_instance_of Fog::DNS::AzureRM::Zone, @zone.save
    end
  end

  def test_destroy_method_true_response
    @service.stub :delete_zone, true do
      assert @zone.destroy
    end
  end

  def test_destroy_method_false_response
    @service.stub :delete_zone, false do
      assert !@zone.destroy
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.8 test/models/dns/test_zone.rb
fog-azure-rm-0.0.6 test/models/dns/test_zone.rb
fog-azure-rm-0.0.5 test/models/dns/test_zone.rb