right_api_provision 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +68 -0
- data/Rakefile +16 -0
- data/lib/right_api_provision/api15.rb +227 -0
- data/lib/right_api_provision/exception.rb +31 -0
- data/lib/right_api_provision/provisioner.rb +193 -0
- data/lib/right_api_provision/version.rb +3 -0
- data/lib/right_api_provision.rb +4 -0
- data/right_api_provision.gemspec +21 -0
- data/spec/right_api_provision/api15_spec.rb +262 -0
- data/spec/right_api_provision/client_spec_old.rb +342 -0
- data/spec/right_api_provision/provisioner_spec.rb +27 -0
- data/spec/spec_helper.rb +2 -0
- data/test/provisioner_test.rb +42 -0
- metadata +169 -0
| @@ -0,0 +1,262 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
            require 'json'
         | 
| 3 | 
            +
            require 'right_api_client'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            describe "API15 object" do
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              BAD_USER_DATA = "RS_server=my.rightscale.com&RS_token=89eeb0b19af40b5b72668dc3caa9934a&RS_sketchy=sketchy1-166.rightscale.com"
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              before(:each) do
         | 
| 10 | 
            +
                @api = RightApiProvision::API15.new()
         | 
| 11 | 
            +
                apiStub = double("RightApi::Client")
         | 
| 12 | 
            +
                RightApi::Client.should_receive(:new).and_return(apiStub)
         | 
| 13 | 
            +
                @api.connection("someemail", "somepasswd", "someaccountid", "https://my.rightscale.com")
         | 
| 14 | 
            +
              end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              it "should find deployment by name" do
         | 
| 17 | 
            +
                deploymentsStub = double("deployments", :index => [ :name => "my_fake_deployment" ])
         | 
| 18 | 
            +
                @api.instance_variable_get("@connection").should_receive(:deployments).and_return(deploymentsStub)
         | 
| 19 | 
            +
                @api.find_deployment_by_name("my_fake_deployment")
         | 
| 20 | 
            +
              end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              it "should raise error if deployment not found by name" do
         | 
| 23 | 
            +
                deploymentsStub = double("deployments", :index => nil)
         | 
| 24 | 
            +
                @api.instance_variable_get("@connection").should_receive(:deployments).and_return(deploymentsStub)
         | 
| 25 | 
            +
                lambda{@api.find_deployment_by_name("my_fake_deployment")}.should raise_error
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
              it "should raise error if multiple deployments found by name" do
         | 
| 29 | 
            +
                deploymentsStub = double("deployments", :index => [ {:name => "my_fake_deployment"}, {:name => "my_fake_deployment2"} ])
         | 
| 30 | 
            +
                @api.instance_variable_get("@connection").should_receive(:deployments).and_return(deploymentsStub)
         | 
| 31 | 
            +
                lambda{@api.find_deployment_by_name("my_fake_deployment")}.should raise_error
         | 
| 32 | 
            +
              end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
              it "should find server by name" do
         | 
| 35 | 
            +
                serversStub = double("servers", :index => [ :name => "my_fake_server" ])
         | 
| 36 | 
            +
                @api.instance_variable_get("@connection").should_receive(:servers).and_return(serversStub)
         | 
| 37 | 
            +
                @api.find_server_by_name("my_fake_server")
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
              it "should raise error if multiple servers found by name" do
         | 
| 41 | 
            +
                serversStub = double("servers", :index => [ {:name => "my_fake_server"}, {:name => "my_fake_server2"} ])
         | 
| 42 | 
            +
                @api.instance_variable_get("@connection").should_receive(:servers).and_return(serversStub)
         | 
| 43 | 
            +
                lambda{@api.find_server_by_name("my_fake_server")}.should raise_error
         | 
| 44 | 
            +
              end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
              it "should find cloud by name" do
         | 
| 47 | 
            +
                cloudsStub = double("clouds", :index => [ :name => "my_fake_cloud" ])
         | 
| 48 | 
            +
                @api.instance_variable_get("@connection").should_receive(:clouds).and_return(cloudsStub)
         | 
| 49 | 
            +
                @api.find_cloud_by_name("my_fake_cloud")
         | 
| 50 | 
            +
              end
         | 
| 51 | 
            +
             | 
| 52 | 
            +
              it "should raise error if cloud not found by name" do
         | 
| 53 | 
            +
                cloudsStub = double("clouds", :index => nil)
         | 
| 54 | 
            +
                @api.instance_variable_get("@connection").should_receive(:clouds).and_return(cloudsStub)
         | 
| 55 | 
            +
                lambda{@api.find_cloud_by_name("my_fake_cloud")}.should raise_error
         | 
| 56 | 
            +
              end
         | 
| 57 | 
            +
             | 
| 58 | 
            +
              it "should find MCI by name" do
         | 
| 59 | 
            +
                mcisStub = double("multi_cloud_images", :index => [ :name => "my_fake_mci" ])
         | 
| 60 | 
            +
                @api.instance_variable_get("@connection").should_receive(:multi_cloud_images).and_return(mcisStub)
         | 
| 61 | 
            +
                @api.find_mci_by_name("my_fake_mci")
         | 
| 62 | 
            +
              end
         | 
| 63 | 
            +
             | 
| 64 | 
            +
              it "should raise error if multiple MCI found by name" do
         | 
| 65 | 
            +
                mcisStub = double("multi_cloud_images", :index => [ {:name => "my_fake_mci"}, {:name => "my_fake_mci2"} ])
         | 
| 66 | 
            +
                @api.instance_variable_get("@connection").should_receive(:multi_cloud_images).and_return(mcisStub)
         | 
| 67 | 
            +
                lambda{@api.find_mci_by_name("my_fake_mci")}.should raise_error
         | 
| 68 | 
            +
              end
         | 
| 69 | 
            +
             | 
| 70 | 
            +
              it "should find servertemplate by name" do
         | 
| 71 | 
            +
                servertemplatesStub = double("servertemplates", :index => [ double("servertemplate", :name => "my_fake_servertemplate") ])
         | 
| 72 | 
            +
                @api.instance_variable_get("@connection").should_receive(:server_templates).and_return(servertemplatesStub)
         | 
| 73 | 
            +
                @api.find_servertemplate("my_fake_servertemplate")
         | 
| 74 | 
            +
              end
         | 
| 75 | 
            +
             | 
| 76 | 
            +
              it "should raise error if no servertemplates found by name" do
         | 
| 77 | 
            +
                servertemplatesStub = double("servertemplates", :index => [])
         | 
| 78 | 
            +
                @api.instance_variable_get("@connection").should_receive(:server_templates).and_return(servertemplatesStub)
         | 
| 79 | 
            +
                lambda{@api.find_servertemplate("my_fake_servertemplate")}.should raise_error
         | 
| 80 | 
            +
              end
         | 
| 81 | 
            +
             | 
| 82 | 
            +
              it "should raise error if multiple servertemplates found by name" do
         | 
| 83 | 
            +
                servertemplatesStub = double("servertemplates", :index => [ double("servertemplate", :name => "my_fake_servertemplate"), double("servertemplate", :name => "my_fake_servertemplate") ])
         | 
| 84 | 
            +
                @api.instance_variable_get("@connection").should_receive(:server_templates).and_return(servertemplatesStub)
         | 
| 85 | 
            +
                lambda{@api.find_servertemplate("my_fake_servertemplate")}.should raise_error
         | 
| 86 | 
            +
              end
         | 
| 87 | 
            +
             | 
| 88 | 
            +
              it "should find servertemplate by id" do
         | 
| 89 | 
            +
                servertemplatesStub = double("servertemplates", :index => [ :name => "my_fake_servertemplate" ])
         | 
| 90 | 
            +
                @api.instance_variable_get("@connection").should_receive(:server_templates).and_return(servertemplatesStub)
         | 
| 91 | 
            +
                @api.find_servertemplate(1234)
         | 
| 92 | 
            +
              end
         | 
| 93 | 
            +
             | 
| 94 | 
            +
              it "should create deployment" do
         | 
| 95 | 
            +
                deploymentsStub = double("deployments", :create => [ {:name => "my_fake_deployment"} ])
         | 
| 96 | 
            +
                @api.instance_variable_get("@connection").should_receive(:deployments).and_return(deploymentsStub)
         | 
| 97 | 
            +
                deploymentsStub.should_receive(:create)
         | 
| 98 | 
            +
                @api.create_deployment("my_deployment")
         | 
| 99 | 
            +
              end
         | 
| 100 | 
            +
             | 
| 101 | 
            +
              it "should destroy a deployment" do
         | 
| 102 | 
            +
                deploymentsStub = double("deployments", :destroy => nil)
         | 
| 103 | 
            +
                deploymentsStub.should_receive(:destroy)
         | 
| 104 | 
            +
                @api.destroy_deployment(deploymentsStub)
         | 
| 105 | 
            +
              end
         | 
| 106 | 
            +
             | 
| 107 | 
            +
              it "should create server with the default MCI" do
         | 
| 108 | 
            +
                dStub = double("deployment", :href => "/some/fake/path")
         | 
| 109 | 
            +
                dsStub = double("deployments", :show => dStub)
         | 
| 110 | 
            +
                @api.should_receive(:create_deployment).and_return(dsStub)
         | 
| 111 | 
            +
                deployment = @api.create_deployment("my_deployment")
         | 
| 112 | 
            +
             | 
| 113 | 
            +
                stStub = double("servertemplate", :href => "/some/fake/path", :show => "")
         | 
| 114 | 
            +
                stsStub = double("servertemplates", :show => stStub)
         | 
| 115 | 
            +
                @api.should_receive(:find_servertemplate).and_return(stsStub)
         | 
| 116 | 
            +
                server_template = @api.find_servertemplate(1234)
         | 
| 117 | 
            +
             | 
| 118 | 
            +
                cStub = double("cloud", :href => "/some/fake/path")
         | 
| 119 | 
            +
                csStub = double("clouds", :show => cStub)
         | 
| 120 | 
            +
                @api.should_receive(:find_cloud_by_name).and_return(csStub)
         | 
| 121 | 
            +
                cloud = @api.find_cloud_by_name(1234)
         | 
| 122 | 
            +
             | 
| 123 | 
            +
                serversStub = double("servers", :create => [ :name => "my_fake_server" ])
         | 
| 124 | 
            +
                @api.instance_variable_get("@connection").should_receive(:servers).and_return(serversStub)
         | 
| 125 | 
            +
                @api.create_server(deployment, server_template, nil, cloud, "my_fake_server")
         | 
| 126 | 
            +
              end
         | 
| 127 | 
            +
             | 
| 128 | 
            +
              it "should create server with the MCI given" do
         | 
| 129 | 
            +
                dStub = double("deployment", :href => "/some/fake/path")
         | 
| 130 | 
            +
                dsStub = double("deployments", :show => dStub)
         | 
| 131 | 
            +
                @api.should_receive(:create_deployment).and_return(dsStub)
         | 
| 132 | 
            +
                deployment = @api.create_deployment("my_deployment")
         | 
| 133 | 
            +
             | 
| 134 | 
            +
                stStub = double("servertemplate", :href => "/some/fake/path", :show => "")
         | 
| 135 | 
            +
                stsStub = double("servertemplates", :show => stStub)
         | 
| 136 | 
            +
                @api.should_receive(:find_servertemplate).and_return(stsStub)
         | 
| 137 | 
            +
                server_template = @api.find_servertemplate(1234)
         | 
| 138 | 
            +
             | 
| 139 | 
            +
                mciStub = double("mci", :href => "/some/fake/path")
         | 
| 140 | 
            +
                mcisStub = double("mcis", :show => mciStub)
         | 
| 141 | 
            +
                @api.should_receive(:find_mci_by_name).and_return(mcisStub)
         | 
| 142 | 
            +
                mci = @api.find_mci_by_name("CentOS")
         | 
| 143 | 
            +
             | 
| 144 | 
            +
                cStub = double("cloud", :href => "/some/fake/path")
         | 
| 145 | 
            +
                csStub = double("clouds", :show => cStub)
         | 
| 146 | 
            +
                @api.should_receive(:find_cloud_by_name).and_return(csStub)
         | 
| 147 | 
            +
                cloud = @api.find_cloud_by_name(1234)
         | 
| 148 | 
            +
             | 
| 149 | 
            +
                serversStub = double("servers", :create => [ :name => "my_fake_server" ])
         | 
| 150 | 
            +
                @api.instance_variable_get("@connection").should_receive(:servers).and_return(serversStub)
         | 
| 151 | 
            +
                @api.create_server(deployment, server_template, mci, cloud, "my_fake_server")
         | 
| 152 | 
            +
              end
         | 
| 153 | 
            +
             | 
| 154 | 
            +
              it "should launch server with inputs" do
         | 
| 155 | 
            +
                serverStub = double("server", :name => "foo")
         | 
| 156 | 
            +
                serversStub = double("servers", :launch => true, :show => serverStub, :index => [ :name => "my_fake_server" ])
         | 
| 157 | 
            +
                @api.should_receive(:create_server).and_return(serversStub)
         | 
| 158 | 
            +
                server = @api.create_server("foo", "bar", "my_fake_server")
         | 
| 159 | 
            +
                @api.instance_variable_get("@connection").should_receive(:servers).and_return(serversStub)
         | 
| 160 | 
            +
                @api.launch_server(server, [ {:name => "input1", :value => 1} ])
         | 
| 161 | 
            +
              end
         | 
| 162 | 
            +
             | 
| 163 | 
            +
              it "should launch server without inputs" do
         | 
| 164 | 
            +
                serverStub = double("server", :name => "foo")
         | 
| 165 | 
            +
                serversStub = double("servers", :launch => true, :show => serverStub, :index => [ :name => "my_fake_server" ])
         | 
| 166 | 
            +
                @api.should_receive(:create_server).and_return(serversStub)
         | 
| 167 | 
            +
                server = @api.create_server("foo", "bar", "my_fake_server")
         | 
| 168 | 
            +
                @api.instance_variable_get("@connection").should_receive(:servers).and_return(serversStub)
         | 
| 169 | 
            +
                @api.launch_server(server)
         | 
| 170 | 
            +
              end
         | 
| 171 | 
            +
             | 
| 172 | 
            +
              it "returns user_data" do
         | 
| 173 | 
            +
                instanceDataStub = double("idata", :user_data => "someuserdata")
         | 
| 174 | 
            +
                instanceStub = double("instance", :show => instanceDataStub)
         | 
| 175 | 
            +
                serverDataStub = double("sdata", :current_instance => instanceStub)
         | 
| 176 | 
            +
                serverStub = double("server", :show => serverDataStub)
         | 
| 177 | 
            +
                serverDataStub.should_receive(:current_instance).with(:view=>"extended")
         | 
| 178 | 
            +
                @api.user_data(serverStub).should == "someuserdata"
         | 
| 179 | 
            +
              end
         | 
| 180 | 
            +
             | 
| 181 | 
            +
              it "returns data_request_url for instance" do
         | 
| 182 | 
            +
                @user_data = "RS_rn_url=amqp://b915586461:278a854748@orange2-broker.test.rightscale.com/right_net&RS_rn_id=4985249009&RS_server=orange2-moo.test.rightscale.com&RS_rn_auth=d98106775832c174ffd55bd7b7cb175077574adf&RS_token=b233a57d1d24f27bd8650d0f9b6bfd54&RS_sketchy=sketchy1-145.rightscale.com&RS_rn_host=:0"
         | 
| 183 | 
            +
                @request_data_url = "https://my.rightscale.com/servers/data_injection_payload/d98106775832c174ffd55bd7b7cb175077574adf"
         | 
| 184 | 
            +
                @api.data_request_url(@user_data).should == @request_data_url
         | 
| 185 | 
            +
              end
         | 
| 186 | 
            +
             | 
| 187 | 
            +
              it "returns true if server has a current instance" do
         | 
| 188 | 
            +
                serverDataStub = double("sdata", :api_methods => [:current_instance])
         | 
| 189 | 
            +
                serverStub = double("server", :show => serverDataStub)
         | 
| 190 | 
            +
                @api.is_provisioned?(serverStub).should == true
         | 
| 191 | 
            +
              end
         | 
| 192 | 
            +
             | 
| 193 | 
            +
              it "returns false if server does not have a current instance" do
         | 
| 194 | 
            +
                serverDataStub = double("sdata", :api_methods => [])
         | 
| 195 | 
            +
                serverStub = double("server", :show => serverDataStub)
         | 
| 196 | 
            +
                @api.is_provisioned?(serverStub).should == false
         | 
| 197 | 
            +
              end
         | 
| 198 | 
            +
             | 
| 199 | 
            +
              it "will not wait if server is in expected state" do
         | 
| 200 | 
            +
                @api.should_receive(:server_state).and_return("booting")
         | 
| 201 | 
            +
                @api.server_wait_for_state("fakeserver", "booting")
         | 
| 202 | 
            +
              end
         | 
| 203 | 
            +
             | 
| 204 | 
            +
              it "throws an error if server is stranded" do
         | 
| 205 | 
            +
                @api.should_receive(:server_state).and_return("stranded")
         | 
| 206 | 
            +
                @api.set_bad_states([ "stranded", "terminated"])
         | 
| 207 | 
            +
                lambda{@api.server_wait_for_state("fakeserver", "operational")}.should raise_error
         | 
| 208 | 
            +
              end
         | 
| 209 | 
            +
             | 
| 210 | 
            +
              it "returns the server's cloud" do
         | 
| 211 | 
            +
                cData = double("clouddata", :name => "cloudname")
         | 
| 212 | 
            +
                cStub = double("cloud", :show => cData)
         | 
| 213 | 
            +
                @api.should_receive(:instance_from_server)
         | 
| 214 | 
            +
                @api.should_receive(:cloud_from_instance).and_return(cStub)
         | 
| 215 | 
            +
                @api.server_cloud_name("foo").should == "cloudname"
         | 
| 216 | 
            +
              end
         | 
| 217 | 
            +
             | 
| 218 | 
            +
              it "returns the current instance from the server is provisioned" do
         | 
| 219 | 
            +
                serverDataStub = double("sdata", :current_instance => "current")
         | 
| 220 | 
            +
                serverStub = double("server", :show => serverDataStub)
         | 
| 221 | 
            +
                @api.should_receive(:is_provisioned?).and_return(true)
         | 
| 222 | 
            +
                @api.send(:instance_from_server, serverStub).should == "current"
         | 
| 223 | 
            +
              end
         | 
| 224 | 
            +
             | 
| 225 | 
            +
              it "returns the next instance from the server is not provisioned" do
         | 
| 226 | 
            +
                serverDataStub = double("sdata", :next_instance => "next")
         | 
| 227 | 
            +
                serverStub = double("server", :show => serverDataStub)
         | 
| 228 | 
            +
                @api.should_receive(:is_provisioned?).and_return(false)
         | 
| 229 | 
            +
                @api.send(:instance_from_server, serverStub).should == "next"
         | 
| 230 | 
            +
              end
         | 
| 231 | 
            +
             | 
| 232 | 
            +
              it "returns server state" do
         | 
| 233 | 
            +
                instanceDataStub = double("idata", :state => "booting")
         | 
| 234 | 
            +
                instanceStub = double("instance", :show => instanceDataStub)
         | 
| 235 | 
            +
                @api.should_receive(:instance_from_server).and_return(instanceStub)
         | 
| 236 | 
            +
                @api.send(:server_state, "server").should == "booting"
         | 
| 237 | 
            +
              end
         | 
| 238 | 
            +
             | 
| 239 | 
            +
              it "returns the cloud from the instance" do
         | 
| 240 | 
            +
                instanceDataStub = double("idata", :cloud => "somecloudobj")
         | 
| 241 | 
            +
                instanceStub = double("instance", :show => instanceDataStub)
         | 
| 242 | 
            +
                @api.send(:cloud_from_instance, instanceStub).should == "somecloudobj"
         | 
| 243 | 
            +
              end
         | 
| 244 | 
            +
             | 
| 245 | 
            +
              it "sets inputs on the next instance" do
         | 
| 246 | 
            +
                inputsStub = double("inputs")
         | 
| 247 | 
            +
                inputsStub.should_receive(:multi_update).with({"inputs" => "heynow"})
         | 
| 248 | 
            +
                instanceDataStub = double("idata", :inputs => inputsStub)
         | 
| 249 | 
            +
                instanceStub = double("instance", :show => instanceDataStub)
         | 
| 250 | 
            +
                serverDataStub = double("sdata", :next_instance => instanceStub)
         | 
| 251 | 
            +
                serverStub = double("server", :show => serverDataStub)
         | 
| 252 | 
            +
                @api.set_server_inputs(serverStub, "heynow")
         | 
| 253 | 
            +
              end
         | 
| 254 | 
            +
             | 
| 255 | 
            +
              it "terminates a server" do
         | 
| 256 | 
            +
                serverStub = double("server")
         | 
| 257 | 
            +
                serverStub.should_receive(:terminate)
         | 
| 258 | 
            +
                @api.terminate_server(serverStub)
         | 
| 259 | 
            +
              end
         | 
| 260 | 
            +
             | 
| 261 | 
            +
             | 
| 262 | 
            +
            end
         | 
| @@ -0,0 +1,342 @@ | |
| 1 | 
            +
            require 'right_api_provision'
         | 
| 2 | 
            +
            require 'right_api_client'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            describe RightApiProvision::Client do
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              before(:all) do
         | 
| 7 | 
            +
                @client = RightApiProvision::Client.instance
         | 
| 8 | 
            +
                @server_template = RightApiProvision::Objects::ServerTemplate.new(@client, "href", "name", "revision")
         | 
| 9 | 
            +
                @cloud = RightApiProvision::Objects::Cloud.new(@client, "href", "name", "description")
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              it "initializes a connection" do
         | 
| 13 | 
            +
                apiStub = double("RightApi::Client")
         | 
| 14 | 
            +
                RightApi::Client.should_receive(:new).and_return(apiStub)
         | 
| 15 | 
            +
                args = {:email => 'my@email.com', :password => 'my_password', :account_id => 'my_account_id'}
         | 
| 16 | 
            +
                @conn = @client.connection(args)
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
              describe "list_clouds" do
         | 
| 20 | 
            +
                it "lists clouds" do
         | 
| 21 | 
            +
                  list = [
         | 
| 22 | 
            +
                      double("cloud1", :href => "/some/obj/1", :name => "cumulus1", :description => "a cloud"),
         | 
| 23 | 
            +
                      double("cloud2", :href => "/some/obj/2", :name => "cumulus2", :description => "a cloud")
         | 
| 24 | 
            +
                    ]
         | 
| 25 | 
            +
                  @client.should_receive(:list_resources).with(:clouds, :by_name, "cumulus").and_return(list)
         | 
| 26 | 
            +
                  @client.list_clouds("cumulus").size.should == 2
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                it "returns empty array if no clouds found" do
         | 
| 30 | 
            +
                  @client.should_receive(:list_resources).with(:clouds, :by_name, "cumulus").and_return([])
         | 
| 31 | 
            +
                  @client.list_clouds("cumulus").size.should == 0
         | 
| 32 | 
            +
                end
         | 
| 33 | 
            +
              end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
              describe "find_cloud_by_name" do
         | 
| 36 | 
            +
                it "finds a cloud by name" do
         | 
| 37 | 
            +
                  obj = double("cloud", :href => "/some/obj/1", :name => "stratus", :description => "a cloud")
         | 
| 38 | 
            +
                  @client.should_receive(:find_resource).with(:clouds, :by_name, "stratus").and_return(obj)
         | 
| 39 | 
            +
                  cloud = @client.find_cloud_by_name("stratus")
         | 
| 40 | 
            +
                  cloud.should be_a(RightApiProvision::Objects::Cloud)
         | 
| 41 | 
            +
                end
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                it "returns nil if cloud not found by name" do
         | 
| 44 | 
            +
                  @client.should_receive(:find_resource).with(:clouds, :by_name, "cirrus").and_return(nil)
         | 
| 45 | 
            +
                  @client.find_cloud_by_name("cirrus").should == nil
         | 
| 46 | 
            +
                end
         | 
| 47 | 
            +
              end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
              describe "list_deployment" do
         | 
| 50 | 
            +
                it "lists deployment" do
         | 
| 51 | 
            +
                  list = [
         | 
| 52 | 
            +
                      double("deployment1", :href => "/some/obj/1", :name => "cumulus1", :description => "a deployment"),
         | 
| 53 | 
            +
                      double("deployment2", :href => "/some/obj/2", :name => "cumulus2", :description => "a deployment")
         | 
| 54 | 
            +
                    ]
         | 
| 55 | 
            +
                  @client.should_receive(:list_resources).with(:deployments, :by_name, "cumulus").and_return(list)
         | 
| 56 | 
            +
                  @client.list_deployments("cumulus").size.should == 2
         | 
| 57 | 
            +
                end
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                it "returns empty array if no deployments found" do
         | 
| 60 | 
            +
                  @client.should_receive(:list_resources).with(:deployments, :by_name, "cumulus").and_return([])
         | 
| 61 | 
            +
                  @client.list_deployments("cumulus").size.should == 0
         | 
| 62 | 
            +
                end
         | 
| 63 | 
            +
              end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
              describe "find_deployment_by_name" do
         | 
| 66 | 
            +
                it "finds a deployment by name" do
         | 
| 67 | 
            +
                  obj = double("deployment", :href => "/some/obj/1", :name => "stratus", :description => "a deployment")
         | 
| 68 | 
            +
                  @client.should_receive(:find_resource).with(:deployments, :by_name, "stratus").and_return(obj)
         | 
| 69 | 
            +
                  cloud = @client.find_deployment_by_name("stratus")
         | 
| 70 | 
            +
                  cloud.should be_a(RightApiProvision::Objects::Deployment)
         | 
| 71 | 
            +
                end
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                it "returns nil if deployment not found by name" do
         | 
| 74 | 
            +
                  @client.should_receive(:find_resource).with(:deployments, :by_name, "cirrus").and_return(nil)
         | 
| 75 | 
            +
                  @client.find_deployment_by_name("cirrus").should == nil
         | 
| 76 | 
            +
                end
         | 
| 77 | 
            +
              end
         | 
| 78 | 
            +
             | 
| 79 | 
            +
              describe "list_multi_cloud_images" do
         | 
| 80 | 
            +
                it "lists multi_cloud_images" do
         | 
| 81 | 
            +
                  list = [
         | 
| 82 | 
            +
                      double("multi_cloud_images1", :href => "/some/obj/1", :name => "cumulus1"),
         | 
| 83 | 
            +
                      double("multi_cloud_images2", :href => "/some/obj/2", :name => "cumulus2")
         | 
| 84 | 
            +
                    ]
         | 
| 85 | 
            +
                  @client.should_receive(:list_subresources).with(@server_template, :multi_cloud_images, :by_name, "cumulus").and_return(list)
         | 
| 86 | 
            +
                  @client.list_multi_cloud_images(@server_template, "cumulus").size.should == 2
         | 
| 87 | 
            +
                end
         | 
| 88 | 
            +
             | 
| 89 | 
            +
                it "returns empty array if no multi_cloud_images found" do
         | 
| 90 | 
            +
                  @client.should_receive(:list_subresources).with(@server_template, :multi_cloud_images, :by_name, "cumulus").and_return([])
         | 
| 91 | 
            +
                  @client.list_multi_cloud_images(@server_template, "cumulus").size.should == 0
         | 
| 92 | 
            +
                end
         | 
| 93 | 
            +
              end
         | 
| 94 | 
            +
             | 
| 95 | 
            +
              describe "find_multi_cloud_image_by_name" do
         | 
| 96 | 
            +
                it "finds a multi_cloud_image by name" do
         | 
| 97 | 
            +
                  obj = double("multi_cloud_image", :href => "/some/obj/1", :name => "stratus")
         | 
| 98 | 
            +
                  @client.should_receive(:find_subresource).with(@server_template, :multi_cloud_images, :by_name, "stratus").and_return(obj)
         | 
| 99 | 
            +
                  cloud = @client.find_multi_cloud_image_by_name(@server_template, "stratus")
         | 
| 100 | 
            +
                  cloud.should be_a(RightApiProvision::Objects::MultiCloudImage)
         | 
| 101 | 
            +
                end
         | 
| 102 | 
            +
             | 
| 103 | 
            +
                it "returns nil if multi_cloud_image not found by name" do
         | 
| 104 | 
            +
                  @client.should_receive(:find_subresource).with(@server_template, :multi_cloud_images, :by_name, "cirrus").and_return(nil)
         | 
| 105 | 
            +
                  @client.find_multi_cloud_image_by_name(@server_template, "cirrus").should == nil
         | 
| 106 | 
            +
                end
         | 
| 107 | 
            +
              end
         | 
| 108 | 
            +
             | 
| 109 | 
            +
              describe "list_security_groups" do
         | 
| 110 | 
            +
                it "lists security_groups" do
         | 
| 111 | 
            +
                  list = [
         | 
| 112 | 
            +
                      double("security_groups1", :href => "/some/obj/1", :name => "cumulus1", :resource_uid => "1234"),
         | 
| 113 | 
            +
                      double("security_groups2", :href => "/some/obj/2", :name => "cumulus2", :resource_uid => "5678")
         | 
| 114 | 
            +
                    ]
         | 
| 115 | 
            +
                  @client.should_receive(:list_subresources).with(@cloud, :security_groups, :by_name, "cumulus").and_return(list)
         | 
| 116 | 
            +
                  @client.list_security_groups(@cloud, "cumulus").size.should == 2
         | 
| 117 | 
            +
                end
         | 
| 118 | 
            +
             | 
| 119 | 
            +
                it "returns empty array if no security_groups found" do
         | 
| 120 | 
            +
                  @client.should_receive(:list_subresources).with(@cloud, :security_groups, :by_name, "cumulus").and_return([])
         | 
| 121 | 
            +
                  @client.list_security_groups(@cloud, "cumulus").size.should == 0
         | 
| 122 | 
            +
                end
         | 
| 123 | 
            +
              end
         | 
| 124 | 
            +
             | 
| 125 | 
            +
              describe "find_security_group_by_name" do
         | 
| 126 | 
            +
                it "finds a security_group by name" do
         | 
| 127 | 
            +
                  obj = double("security_group", :href => "/some/obj/1", :name => "stratus", :resource_uid => "1234")
         | 
| 128 | 
            +
                  @client.should_receive(:find_subresource).with(@cloud, :security_groups, :by_name, "stratus").and_return(obj)
         | 
| 129 | 
            +
                  cloud = @client.find_security_group_by_name(@cloud, "stratus")
         | 
| 130 | 
            +
                  cloud.should be_a(RightApiProvision::Objects::SecurityGroup)
         | 
| 131 | 
            +
                end
         | 
| 132 | 
            +
             | 
| 133 | 
            +
                it "returns nil if security_group not found by name" do
         | 
| 134 | 
            +
                  @client.should_receive(:find_subresource).with(@cloud, :security_groups, :by_name, "cirrus").and_return(nil)
         | 
| 135 | 
            +
                  @client.find_security_group_by_name(@cloud, "cirrus").should == nil
         | 
| 136 | 
            +
                end
         | 
| 137 | 
            +
              end
         | 
| 138 | 
            +
             | 
| 139 | 
            +
              describe "list_server_template" do
         | 
| 140 | 
            +
                it "lists server_template" do
         | 
| 141 | 
            +
                  list = [
         | 
| 142 | 
            +
                      double("server_template", :href => "/some/obj/1", :name => "cumulus1", :revision => "1"),
         | 
| 143 | 
            +
                      double("server_template", :href => "/some/obj/2", :name => "cumulus2", :revision => "HEAD")
         | 
| 144 | 
            +
                    ]
         | 
| 145 | 
            +
                  @client.should_receive(:list_resources).with(:server_templates, :by_name, "cumulus").and_return(list)
         | 
| 146 | 
            +
                  @client.list_server_templates("cumulus").size.should == 2
         | 
| 147 | 
            +
                end
         | 
| 148 | 
            +
             | 
| 149 | 
            +
                it "returns empty array if no server_templates found" do
         | 
| 150 | 
            +
                  @client.should_receive(:list_resources).with(:server_templates, :by_name, "cumulus").and_return([])
         | 
| 151 | 
            +
                  @client.list_server_templates("cumulus").size.should == 0
         | 
| 152 | 
            +
                end
         | 
| 153 | 
            +
              end
         | 
| 154 | 
            +
             | 
| 155 | 
            +
              describe "find_server_template" do
         | 
| 156 | 
            +
                it "finds a server_template by name" do
         | 
| 157 | 
            +
                  list = [
         | 
| 158 | 
            +
                      double("server_template", :href => "/some/obj/1", :name => "cumulus1", :revision => "1"),
         | 
| 159 | 
            +
                      double("server_template", :href => "/some/obj/2", :name => "cumulus2", :revision => "HEAD")
         | 
| 160 | 
            +
                    ]
         | 
| 161 | 
            +
                  @client.should_receive(:list_resources).with(:server_templates, :by_name, "stratus").and_return(list)
         | 
| 162 | 
            +
                  cloud = @client.find_server_template("stratus")
         | 
| 163 | 
            +
                  cloud.should be_a(RightApiProvision::Objects::ServerTemplate)
         | 
| 164 | 
            +
                end
         | 
| 165 | 
            +
             | 
| 166 | 
            +
                it "finds a server_template by id" do
         | 
| 167 | 
            +
                  obj = double("server_template", :href => "/some/obj/1", :name => "stratus", :revision => "HEAD")
         | 
| 168 | 
            +
                  servertemplatesStub = double("servertemplates", :index => obj)
         | 
| 169 | 
            +
                  @client.handle.should_receive(:server_templates).and_return(servertemplatesStub)
         | 
| 170 | 
            +
                  cloud = @client.find_server_template(1)
         | 
| 171 | 
            +
                  cloud.should be_a(RightApiProvision::Objects::ServerTemplate)
         | 
| 172 | 
            +
                end
         | 
| 173 | 
            +
             | 
| 174 | 
            +
                it "returns nil if server_template not found by name" do
         | 
| 175 | 
            +
                  @client.should_receive(:list_resources).with(:server_templates, :by_name, "cirrus").and_return([])
         | 
| 176 | 
            +
                  @client.find_server_template("cirrus").should == nil
         | 
| 177 | 
            +
                end
         | 
| 178 | 
            +
              end
         | 
| 179 | 
            +
             | 
| 180 | 
            +
              describe "list_servers" do
         | 
| 181 | 
            +
                it "lists servers" do
         | 
| 182 | 
            +
                  list = [
         | 
| 183 | 
            +
                      double("server1", :href => "/some/obj/1", :name => "cumulus1", :description => "a server"),
         | 
| 184 | 
            +
                      double("server2", :href => "/some/obj/2", :name => "cumulus2", :description => "a server")
         | 
| 185 | 
            +
                    ]
         | 
| 186 | 
            +
                  @client.should_receive(:list_resources).with(:servers, :by_name, "cumulus").and_return(list)
         | 
| 187 | 
            +
                  @client.list_servers("cumulus").size.should == 2
         | 
| 188 | 
            +
                end
         | 
| 189 | 
            +
             | 
| 190 | 
            +
                it "returns empty array if no servers found" do
         | 
| 191 | 
            +
                  @client.should_receive(:list_resources).with(:servers, :by_name, "cumulus").and_return([])
         | 
| 192 | 
            +
                  @client.list_servers("cumulus").size.should == 0
         | 
| 193 | 
            +
                end
         | 
| 194 | 
            +
              end
         | 
| 195 | 
            +
             | 
| 196 | 
            +
              describe "find_server_by_name" do
         | 
| 197 | 
            +
                it "finds a server by name" do
         | 
| 198 | 
            +
                  obj = double("server", :href => "/some/obj/1", :name => "stratus", :description => "a server")
         | 
| 199 | 
            +
                  @client.should_receive(:find_resource).with(:servers, :by_name, "stratus").and_return(obj)
         | 
| 200 | 
            +
                  cloud = @client.find_server_by_name("stratus")
         | 
| 201 | 
            +
                  cloud.should be_a(RightApiProvision::Objects::Server)
         | 
| 202 | 
            +
                end
         | 
| 203 | 
            +
             | 
| 204 | 
            +
                it "returns nil if server not found by name" do
         | 
| 205 | 
            +
                  @client.should_receive(:find_resource).with(:servers, :by_name, "cirrus").and_return(nil)
         | 
| 206 | 
            +
                  @client.find_server_by_name("cirrus").should == nil
         | 
| 207 | 
            +
                end
         | 
| 208 | 
            +
              end
         | 
| 209 | 
            +
             | 
| 210 | 
            +
              describe "private find_resource" do
         | 
| 211 | 
            +
                it "finds a resource" do
         | 
| 212 | 
            +
                  resourcesStub = double("servers", :index => [ double("server", :name => "my_fake_resource", :id => 12345) ])
         | 
| 213 | 
            +
                  @client.handle.should_receive(:servers).and_return(resourcesStub)
         | 
| 214 | 
            +
                  r = @client.send(:find_resource, :servers, :by_name, "my_fake_resource")
         | 
| 215 | 
            +
                  r.should_not == nil
         | 
| 216 | 
            +
                end
         | 
| 217 | 
            +
             | 
| 218 | 
            +
                it "raises if duplicate resources are found" do
         | 
| 219 | 
            +
                  serversStub = double("servers", :index => [ {:name => "my_fake_resource"}, {:name => "my_fake_resource"} ])
         | 
| 220 | 
            +
                  @client.handle.should_receive(:servers).and_return(serversStub)
         | 
| 221 | 
            +
                  lambda{@client.send(:find_resource, :servers, :by_name, "my_fake_resource")}.should raise_error RightApiProvision::MultipleMatchesFound
         | 
| 222 | 
            +
                end
         | 
| 223 | 
            +
              end
         | 
| 224 | 
            +
             | 
| 225 | 
            +
              describe "private list_resources" do
         | 
| 226 | 
            +
                it "lists resources" do
         | 
| 227 | 
            +
                  servertemplatesStub =
         | 
| 228 | 
            +
                    double("servertemplates", :index => [
         | 
| 229 | 
            +
                      double("servertemplate", :name => "my_fake_servertemplate1"),
         | 
| 230 | 
            +
                      double("servertemplate", :name => "my_fake_servertemplate2")
         | 
| 231 | 
            +
                    ])
         | 
| 232 | 
            +
                  @client.handle.should_receive(:server_templates).and_return(servertemplatesStub)
         | 
| 233 | 
            +
                  list = @client.send(:list_resources, :server_templates, :by_name, "my_fake_resource")
         | 
| 234 | 
            +
                  list.size.should == 2
         | 
| 235 | 
            +
                end
         | 
| 236 | 
            +
              end
         | 
| 237 | 
            +
             | 
| 238 | 
            +
              describe "private find_subresource" do
         | 
| 239 | 
            +
             | 
| 240 | 
            +
                it "finds a subresource" do
         | 
| 241 | 
            +
                  subresourceStub =
         | 
| 242 | 
            +
                    double("subresources", :index => [
         | 
| 243 | 
            +
                      double("subresource", :name => "subresource1")
         | 
| 244 | 
            +
                    ])
         | 
| 245 | 
            +
                  subresourcesStub = double("subresources", :subresource => subresourceStub )
         | 
| 246 | 
            +
                  resourceStub = double("resource", :show => subresourcesStub, :id => "1")
         | 
| 247 | 
            +
                  @client.handle.should_receive(:mocks).and_return(resourceStub)
         | 
| 248 | 
            +
                  r = @client.send(:find_subresource, resourceStub, :subresource, :by_name, "subresource1")
         | 
| 249 | 
            +
                  r.should_not == nil
         | 
| 250 | 
            +
                end
         | 
| 251 | 
            +
             | 
| 252 | 
            +
                it "raises if duplicate subresources are found" do
         | 
| 253 | 
            +
                  subresourceStub =
         | 
| 254 | 
            +
                    double("subresources", :index => [
         | 
| 255 | 
            +
                      double("subresource", :name => "subresource1"),
         | 
| 256 | 
            +
                      double("subresource", :name => "subresource2")
         | 
| 257 | 
            +
                    ])
         | 
| 258 | 
            +
                  subresourcesStub = double("subresources", :subresource => subresourceStub )
         | 
| 259 | 
            +
                  resourceStub = double("resource", :show => subresourcesStub, :id => "1")
         | 
| 260 | 
            +
                  @client.handle.should_receive(:mocks).and_return(resourceStub)
         | 
| 261 | 
            +
                  lambda{@client.send(:find_subresource, resourceStub, :subresource, :by_name, "subresource1")}.should raise_error RightApiProvision::MultipleMatchesFound
         | 
| 262 | 
            +
                end
         | 
| 263 | 
            +
             | 
| 264 | 
            +
                it "raises if subresource param is not a Symbol" do
         | 
| 265 | 
            +
                  subresourceStub =
         | 
| 266 | 
            +
                    double("subresources", :index => [
         | 
| 267 | 
            +
                      double("subresource", :name => "subresource2")
         | 
| 268 | 
            +
                    ])
         | 
| 269 | 
            +
                  subresourcesStub = double("subresources", :subresource => subresourceStub )
         | 
| 270 | 
            +
                  resourceStub = double("resource", :show => subresourcesStub, :id => "1")
         | 
| 271 | 
            +
                  lambda{@client.send(:find_subresource, resourceStub, "subresource", :by_name, "subresource1")}.should raise_error ArgumentError
         | 
| 272 | 
            +
                end
         | 
| 273 | 
            +
             | 
| 274 | 
            +
                # it "raises if type param is not kind of RightApi::Resource class" do
         | 
| 275 | 
            +
                #   lambda{@client.send(:find_subresource, :server_template, "subresource", :by_name, "subresource1")}.should raise_error ArgumentError
         | 
| 276 | 
            +
                # end
         | 
| 277 | 
            +
             | 
| 278 | 
            +
                it "raises if filter_value param is not a String" do
         | 
| 279 | 
            +
                   subresourceStub =
         | 
| 280 | 
            +
                    double("subresources", :index => [
         | 
| 281 | 
            +
                      double("subresource", :name => "subresource2")
         | 
| 282 | 
            +
                    ])
         | 
| 283 | 
            +
                  subresourcesStub = double("subresources", :subresource => subresourceStub )
         | 
| 284 | 
            +
                  resourceStub = double("resource", :show => subresourcesStub, :id => "1")
         | 
| 285 | 
            +
                  lambda{@client.send(:find_subresource, resourceStub, :subresource, :by_name, :subresource1)}.should raise_error ArgumentError
         | 
| 286 | 
            +
                end
         | 
| 287 | 
            +
             | 
| 288 | 
            +
                it "raises if filter_key param is not a Symbol" do
         | 
| 289 | 
            +
                  subresourceStub =
         | 
| 290 | 
            +
                    double("subresources", :index => [
         | 
| 291 | 
            +
                      double("subresource", :name => "subresource2")
         | 
| 292 | 
            +
                    ])
         | 
| 293 | 
            +
                  subresourcesStub = double("subresources", :subresource => subresourceStub )
         | 
| 294 | 
            +
                  resourceStub = double("resource", :show => subresourcesStub, :id => "1")
         | 
| 295 | 
            +
                  lambda{@client.send(:find_subresource, resourceStub, :subresource, "by_name", :subresource1)}.should raise_error ArgumentError
         | 
| 296 | 
            +
                end
         | 
| 297 | 
            +
             | 
| 298 | 
            +
                it "raises if filter_key param does not start with 'by_'" do
         | 
| 299 | 
            +
                  subresourceStub =
         | 
| 300 | 
            +
                    double("subresources", :index => [
         | 
| 301 | 
            +
                      double("subresource", :name => "subresource2")
         | 
| 302 | 
            +
                    ])
         | 
| 303 | 
            +
                  subresourcesStub = double("subresources", :subresource => subresourceStub )
         | 
| 304 | 
            +
                  resourceStub = double("resource", :show => subresourcesStub, :id => "1")
         | 
| 305 | 
            +
                  lambda{@client.send(:find_subresource, resourceStub, :subresource, :buy_name, :subresource1)}.should raise_error ArgumentError
         | 
| 306 | 
            +
                end
         | 
| 307 | 
            +
             | 
| 308 | 
            +
              end
         | 
| 309 | 
            +
             | 
| 310 | 
            +
             | 
| 311 | 
            +
              describe "private list_subresources" do
         | 
| 312 | 
            +
                it "lists subresources" do
         | 
| 313 | 
            +
                  subresourceStub =
         | 
| 314 | 
            +
                    double("subresources", :index => [
         | 
| 315 | 
            +
                      double("subresource", :name => "subresource1"),
         | 
| 316 | 
            +
                      double("subresource", :name => "subresource2")
         | 
| 317 | 
            +
                    ])
         | 
| 318 | 
            +
                  subresourcesStub = double("subresources", :subresource => subresourceStub )
         | 
| 319 | 
            +
                  resourceStub = double("resource", :show => subresourcesStub, :id => "1")
         | 
| 320 | 
            +
                  @client.handle.should_receive(:mocks).and_return(resourceStub)
         | 
| 321 | 
            +
                  list = @client.send(:list_subresources, resourceStub, :subresource, :by_name, "my_fake_resource")
         | 
| 322 | 
            +
                  list.size.should == 2
         | 
| 323 | 
            +
                end
         | 
| 324 | 
            +
              end
         | 
| 325 | 
            +
             | 
| 326 | 
            +
              describe "private assert_kind_of" do
         | 
| 327 | 
            +
                it "throws exception if not kind of" do
         | 
| 328 | 
            +
                  lambda{
         | 
| 329 | 
            +
                    @client.send(:assert_kind_of, "not a string", ["hey","now"], String)
         | 
| 330 | 
            +
                  }.should raise_error ArgumentError
         | 
| 331 | 
            +
                end
         | 
| 332 | 
            +
             | 
| 333 | 
            +
                it "does nothing if kind of" do
         | 
| 334 | 
            +
                  @client.send(:assert_kind_of, "string", "hey now", String)
         | 
| 335 | 
            +
                end
         | 
| 336 | 
            +
             | 
| 337 | 
            +
                it "does nothing if optional and nil" do
         | 
| 338 | 
            +
                  @client.send(:assert_kind_of, "undefined", nil, String, true)
         | 
| 339 | 
            +
                end
         | 
| 340 | 
            +
              end
         | 
| 341 | 
            +
             | 
| 342 | 
            +
            end
         | 
| @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            require 'right_api_provision'
         | 
| 2 | 
            +
            require 'right_api_client'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            describe RightApiProvision::Provisioner do
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              before(:all) do
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              it "initializes a connection" do
         | 
| 11 | 
            +
                apiStub = double("RightApiProvision::API15")
         | 
| 12 | 
            +
                RightApiProvision::API15.should_receive(:new).and_return(apiStub)
         | 
| 13 | 
            +
                apiStub.should_receive(:connection)
         | 
| 14 | 
            +
                provisioner = RightApiProvision::Provisioner.new('my@email.com', 'my_password', 'my_account_id')
         | 
| 15 | 
            +
                provisioner.should_not == nil
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              it "initializes a connection with custom endpoint" do
         | 
| 19 | 
            +
                apiStub = double("RightApiProvision::API15")
         | 
| 20 | 
            +
                RightApiProvision::API15.should_receive(:new).and_return(apiStub)
         | 
| 21 | 
            +
                apiStub.should_receive(:connection)
         | 
| 22 | 
            +
                provisioner = RightApiProvision::Provisioner.new('my@email.com', 'my_password', 'my_account_id', 'custom_url')
         | 
| 23 | 
            +
                provisioner.should_not == nil
         | 
| 24 | 
            +
              end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
             | 
| 27 | 
            +
            end
         | 
    
        data/spec/spec_helper.rb
    ADDED