Sha256: 1201263f739ccc97aba2754562979af8345752800fab658429932bc4687ed801

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

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

# Test class for Resource Group Model
class TestResourceGroup < Minitest::Test
  def setup
    @service = Fog::Resources::AzureRM.new(credentials)
    client = @service.instance_variable_get(:@rmc)
    @resource_group = resource_group(@service)
    @response = ApiStub::Models::Resources::ResourceGroup.create_resource_group_response(client)
  end

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

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

  def test_save_method_response
    @service.stub :create_resource_group, @response do
      assert_instance_of Fog::Resources::AzureRM::ResourceGroup, @resource_group.save
    end
  end

  def test_destroy_method_response
    @service.stub :delete_resource_group, @response do
      assert @resource_group.destroy
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.8 test/models/resources/test_resource_group.rb
fog-azure-rm-0.0.6 test/models/resources/test_resource_group.rb
fog-azure-rm-0.0.5 test/models/resources/test_resource_group.rb