Sha256: 46890e2e768359a0de42b57ccacb021cbf9ee9fa6746822f7f3b329d7a9766c3

Contents?: true

Size: 1.81 KB

Versions: 10

Compression:

Stored size: 1.81 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 => response.to_json, :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 => response.to_json, :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"
    end
  end

  describe "#destroy" do
    it "hits the destroy action in the API" do
      pending
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
engineyard-cloud-client-1.0.8 spec/engineyard-cloud-client/models/app_spec.rb
engineyard-cloud-client-1.0.7 spec/engineyard-cloud-client/models/app_spec.rb
engineyard-cloud-client-1.0.6 spec/engineyard-cloud-client/models/app_spec.rb
engineyard-cloud-client-1.0.5 spec/engineyard-cloud-client/models/app_spec.rb
engineyard-cloud-client-1.0.4 spec/engineyard-cloud-client/models/app_spec.rb
engineyard-cloud-client-1.0.3 spec/engineyard-cloud-client/models/app_spec.rb
engineyard-cloud-client-1.0.2 spec/engineyard-cloud-client/models/app_spec.rb
engineyard-cloud-client-1.0.1 spec/engineyard-cloud-client/models/app_spec.rb
engineyard-cloud-client-1.0.0 spec/engineyard-cloud-client/models/app_spec.rb
engineyard-cloud-client-0.1.4 spec/engineyard-cloud-client/models/app_spec.rb