From 20edaa3097a84a5ad88e63dfce709a03e4a04974 Mon Sep 17 00:00:00 2001 From: "geemus (Wesley Beary)" Date: Sun, 4 Apr 2010 21:41:15 -0700 Subject: [PATCH] [slicehost] add mock/real model helpers --- lib/fog/slicehost/models/flavors.rb | 12 ++++++++++-- lib/fog/slicehost/models/images.rb | 18 ++++++++++++++---- lib/fog/slicehost/models/servers.rb | 12 ++++++++++-- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/lib/fog/slicehost/models/flavors.rb b/lib/fog/slicehost/models/flavors.rb index 3431708f7..8b257e7d8 100644 --- a/lib/fog/slicehost/models/flavors.rb +++ b/lib/fog/slicehost/models/flavors.rb @@ -4,8 +4,16 @@ require 'fog/slicehost/models/flavor' module Fog module Slicehost - def flavors - Fog::Slicehost::Flavors.new(:connection => self) + class Mock + def flavors + Fog::Slicehost::Flavors.new(:connection => self) + end + end + + class Real + def flavors + Fog::Slicehost::Flavors.new(:connection => self) + end end class Flavors < Fog::Collection diff --git a/lib/fog/slicehost/models/images.rb b/lib/fog/slicehost/models/images.rb index 7f5d517fd..6d22e5a89 100644 --- a/lib/fog/slicehost/models/images.rb +++ b/lib/fog/slicehost/models/images.rb @@ -4,10 +4,20 @@ require 'fog/slicehost/models/image' module Fog module Slicehost - def images(attributes = {}) - Fog::Slicehost::Images.new({ - :connection => self - }.merge!(attributes)) + class Mock + def images(attributes = {}) + Fog::Slicehost::Images.new({ + :connection => self + }.merge!(attributes)) + end + end + + class Real + def images(attributes = {}) + Fog::Slicehost::Images.new({ + :connection => self + }.merge!(attributes)) + end end class Images < Fog::Collection diff --git a/lib/fog/slicehost/models/servers.rb b/lib/fog/slicehost/models/servers.rb index 09f94e3df..4f53bc0c7 100644 --- a/lib/fog/slicehost/models/servers.rb +++ b/lib/fog/slicehost/models/servers.rb @@ -4,8 +4,16 @@ require 'fog/slicehost/models/server' module Fog module Slicehost - def servers - Fog::Slicehost::Servers.new(:connection => self) + class Mock + def servers + Fog::Slicehost::Servers.new(:connection => self) + end + end + + class Real + def servers + Fog::Slicehost::Servers.new(:connection => self) + end end class Servers < Fog::Collection