Sha256: 8e7ea1e60f5a30142a8fab8d65a3ca290254266c83a1a5e066f9cf04d6663b6a
Contents?: true
Size: 1.78 KB
Versions: 2
Compression:
Stored size: 1.78 KB
Contents
require 'spec_helper' describe EY::CloudClient::App do describe ".all" do it "hits the index action in the API" do response = { "apps" => [ { "environments"=>[], "name"=>"myapp", "repository_uri"=>"git@github.com:myaccount/myapp.git", "account"=>{"name"=>"myaccount", "id"=>1234}, "id"=>12345 } ] } FakeWeb.register_uri(:get, "https://cloud.engineyard.com/api/v2/apps?no_instances=true", :body => MultiJson.dump(response), :content_type => "application/json") apps = EY::CloudClient::App.all(cloud_client) apps.length.should == 1 apps.first.name.should == "myapp" end end describe ".create" do it "hits the create app action in the API" do account = EY::CloudClient::Account.new(cloud_client, {:id => 1234, :name => 'myaccount'}) response = { "app"=>{ "environments"=>[], "name"=>"myapp", "repository_uri"=>"git@github.com:myaccount/myapp.git", "account"=>{"name"=>"myaccount", "id"=>1234}, "id"=>12345 } } FakeWeb.register_uri(:post, "https://cloud.engineyard.com/api/v2/accounts/1234/apps", :body => MultiJson.dump(response), :content_type => "application/json") app = EY::CloudClient::App.create(cloud_client, { "account" => account, "name" => 'myapp', "repository_uri" => 'git@github.com:myaccount/myapp.git', "app_type_id" => 'rails3' }) FakeWeb.should have_requested(:post, "https://cloud.engineyard.com/api/v2/accounts/1234/apps") app.name.should == "myapp" app.account.name.should == "myaccount" app.hierarchy_name.should == "myaccount / myapp" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
engineyard-cloud-client-2.1.1 | spec/engineyard-cloud-client/models/app_spec.rb |
engineyard-cloud-client-2.1.0 | spec/engineyard-cloud-client/models/app_spec.rb |