Skip to content

Commit

Permalink
[shindo-minitest] convert TargetHttpProxies tests to minitest, includ…
Browse files Browse the repository at this point in the history
…ing a few bug fixes in the implementation of TargetHttpProxies
  • Loading branch information
Isaac Hollander McCreery committed May 28, 2015
1 parent 2c2acef commit 4e1d5dd
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/fog/google/models/compute/target_http_proxies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ def all(filters={})
end

def get(identity)
response = service.get_target_http_proxy(identity)
new(response.body) unless response.nil?
if target_http_proxy = service.get_target_http_proxy(identity).body
new(target_http_proxy)
end
rescue Fog::Errors::NotFound
nil
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/fog/google/models/compute/target_http_proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TargetHttpProxy < Fog::Model
attribute :id, :aliases => 'id'
attribute :creation_timestamp, :aliases => 'creationTimestamp'
attribute :description, :aliases => 'description'
attribute :urlMap, :aliases => "urlMap"
attribute :urlMap, :aliases => ["urlMap", :url_map]

def save
requires :name
Expand Down
19 changes: 19 additions & 0 deletions test/factories/target_http_proxies_factory.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require "factories/collection_factory"
require "factories/url_maps_factory"

class TargetHttpProxiesFactory < CollectionFactory
def initialize(example)
@url_maps = UrlMapsFactory.new(example)
super(Fog::Compute[:google].target_http_proxies, example)
end

def cleanup
super
@url_maps.cleanup
end

def params
params = {:name => resource_name,
:url_map => @url_maps.create.self_link}
end
end
12 changes: 12 additions & 0 deletions test/integration/compute/test_target_http_proxies.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require "minitest_helper"
require "helpers/test_collection"
require "factories/target_http_proxies_factory"

class TestTargetHttpProxies < FogIntegrationTest
include TestCollection

def setup
@subject = Fog::Compute[:google].target_http_proxies
@factory = TargetHttpProxiesFactory.new(namespaced_name)
end
end

0 comments on commit 4e1d5dd

Please sign in to comment.