Sha256: 2e8ff3589d6263ad823f666993a038eefe3cd87cddfe36ee55071aa9d1b2b5a8

Contents?: true

Size: 1.73 KB

Versions: 8

Compression:

Stored size: 1.73 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"
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
engineyard-cloud-client-1.0.16 spec/engineyard-cloud-client/models/app_spec.rb
engineyard-cloud-client-2.0.1 spec/engineyard-cloud-client/models/app_spec.rb
engineyard-cloud-client-2.0.0 spec/engineyard-cloud-client/models/app_spec.rb
engineyard-cloud-client-1.0.15 spec/engineyard-cloud-client/models/app_spec.rb
engineyard-cloud-client-1.0.14 spec/engineyard-cloud-client/models/app_spec.rb
engineyard-cloud-client-1.0.13 spec/engineyard-cloud-client/models/app_spec.rb
engineyard-cloud-client-1.0.12 spec/engineyard-cloud-client/models/app_spec.rb
engineyard-cloud-client-1.0.11 spec/engineyard-cloud-client/models/app_spec.rb