incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject svn commit: r962095 - in /incubator/deltacloud/trunk/client-ruby: lib/deltacloud.rb specs/initialization_spec.rb
Date Thu, 08 Jul 2010 23:22:35 GMT
Author: lutter
Date: Thu Jul  8 23:22:34 2010
New Revision: 962095

URL: http://svn.apache.org/viewvc?rev=962095&view=rev
Log:
Make sure it's usable without a block on initialization.

Modified:
    incubator/deltacloud/trunk/client-ruby/lib/deltacloud.rb
    incubator/deltacloud/trunk/client-ruby/specs/initialization_spec.rb

Modified: incubator/deltacloud/trunk/client-ruby/lib/deltacloud.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/client-ruby/lib/deltacloud.rb?rev=962095&r1=962094&r2=962095&view=diff
==============================================================================
--- incubator/deltacloud/trunk/client-ruby/lib/deltacloud.rb (original)
+++ incubator/deltacloud/trunk/client-ruby/lib/deltacloud.rb Thu Jul  8 23:22:34 2010
@@ -25,13 +25,15 @@ class DeltaCloud
     @password     = password
     @api_uri      = URI.parse( api_uri )
     @entry_points = {}
-    connect( &block ) if ( block )
+    connect( &block ) 
+    self
   end
 
   def connect(&block)
     @http = Net::HTTP.new( api_host, api_port )
     discover_entry_points
     block.call( self ) if block
+    self
   end
 
   def flavors(opts={})

Modified: incubator/deltacloud/trunk/client-ruby/specs/initialization_spec.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/client-ruby/specs/initialization_spec.rb?rev=962095&r1=962094&r2=962095&view=diff
==============================================================================
--- incubator/deltacloud/trunk/client-ruby/specs/initialization_spec.rb (original)
+++ incubator/deltacloud/trunk/client-ruby/specs/initialization_spec.rb Thu Jul  8 23:22:34
2010
@@ -10,13 +10,22 @@ describe "initializing the client" do
   end
 
   it "should discover entry points upon connection" do
-    client = DeltaCloud.new( "name", "password", API_URL )
-    client.connect do |client|
+    DeltaCloud.new( "name", "password", API_URL ) do |client|
       client.entry_points[:flavors].should           eql( "#{API_URL}/flavors" )
       client.entry_points[:images].should            eql( "#{API_URL}/images" )
       client.entry_points[:instances].should         eql( "#{API_URL}/instances" )
       client.entry_points[:storage_volumes].should   eql( "#{API_URL}/storage/volumes" )
       client.entry_points[:storage_snapshots].should eql( "#{API_URL}/storage/snapshots"
)
+    end  
+  end
+
+  describe "without a block" do
+    before( :each ) do
+      reload_fixtures
+    end
+    it "should connect without a block" do
+      client = DeltaCloud.new( API_NAME, API_PASSWORD, API_URL )
+      client.images.should_not be_nil
     end
   end
 



Mime
View raw message