test/models/network/test_load_balancer.rb in fog-azure-rm-0.0.4 vs test/models/network/test_load_balancer.rb in fog-azure-rm-0.0.5

- old
+ new

@@ -3,27 +3,25 @@ # Test class for LoadBalancer Model class TestLoadBalancer < Minitest::Test def setup @service = Fog::Network::AzureRM.new(credentials) @load_balancer = load_balancer(@service) + network_client = @service.instance_variable_get(:@network_client) + @response = ApiStub::Models::Network::LoadBalancer.create_load_balancer_response(network_client) end def test_model_methods - response = ApiStub::Models::Network::LoadBalancer.create_load_balancer_response methods = [ :save, :destroy ] - @service.stub :create_load_balancer, response do - methods.each do |method| - assert @load_balancer.respond_to? method - end + methods.each do |method| + assert @load_balancer.respond_to? method end end def test_model_attributes - response = ApiStub::Models::Network::LoadBalancer.create_load_balancer_response attributes = [ :name, :id, :location, :resource_group, @@ -32,19 +30,16 @@ :load_balancing_rules, :probes, :inbound_nat_rules, :inbound_nat_pools ] - @service.stub :create_load_balancer, response do - attributes.each do |attribute| - assert @load_balancer.respond_to? attribute - end + attributes.each do |attribute| + assert @load_balancer.respond_to? attribute end end def test_save_method_response - response = ApiStub::Models::Network::LoadBalancer.create_load_balancer_response - @service.stub :create_load_balancer, response do + @service.stub :create_load_balancer, @response do assert_instance_of Fog::Network::AzureRM::LoadBalancer, @load_balancer.save end end def test_destroy_method_response