Skip to content

Commit

Permalink
Merge pull request #79 from ClogenyTechnologies/ameya-oc-10878-openst…
Browse files Browse the repository at this point in the history
…ack-test-fix

OC 10878 openstack test fix for knife-cloud change.
  • Loading branch information
Chirag Jog committed Feb 10, 2014
2 parents 582b1c6 + 125140b commit a3cc454
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
2 changes: 1 addition & 1 deletion spec/functional/server_list_func_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
]
instance.stub(:query_resource).and_return(@resources)
instance.stub(:puts)
instance.stub(:create_service_instance).and_return(Chef::Knife::Cloud::Service.new)
instance.stub(:create_service_instance).and_return(Chef::Knife::Cloud::FogService.new)
instance.stub(:validate!)
end

Expand Down
32 changes: 1 addition & 31 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
require "securerandom"
require 'knife-openstack/version'
require 'test/knife-utils/test_bed'
require 'resource_spec_helper'

def find_instance_id(instance_name, file)
file.lines.each do |line|
Expand Down Expand Up @@ -61,34 +62,3 @@ def init_openstack_test
puts "Error while creating file - incorrect_openstack.pem"
end
end

# TODO - we should use factory girl or fixtures for this as part of test utils.
# Creates a resource class that can dynamically add attributes to
# instances and set the values
module JSONModule
def to_json
hash = {}
self.instance_variables.each do |var|
hash[var] = self.instance_variable_get var
end
hash.to_json
end
def from_json! string
JSON.load(string).each do |var, val|
self.instance_variable_set var, val
end
end
end

class TestResource
include JSONModule
def initialize(*args)
args.each do |arg|
arg.each do |key, value|
add_attribute = "class << self; attr_accessor :#{key}; end"
eval(add_attribute)
eval("@#{key} = value")
end
end
end
end

0 comments on commit a3cc454

Please sign in to comment.