Sha256: 78fdb465f2916a44aa805a0a6d1cb78754dd42103ce747821c9dfe48792f4250

Contents?: true

Size: 920 Bytes

Versions: 4

Compression:

Stored size: 920 Bytes

Contents

require 'spec_helper'
require 'github_heroku_deployer/heroku'
require 'platform-api'

describe GithubHerokuDeployer::Heroku do
  context "#find_or_create" do
    before do
      PlatformAPI.stub(:connect_oauth)
    end

    it "creates app if it does not find it" do
      heroku = GithubHerokuDeployer::Heroku.new(
        heroku_organization_name: "test-org",
        heroku_api_key: "asdfghjkl",
        heroku_app_name: "asdfghjkl")
      response = mock(body: 'error')
      heroku.stub("find_app").and_raise(::Heroku::API::Errors::NotFound.new('',response))

      organization_app = double(:organization_app, create: "created")
      platform_api = double(:mock, :organization_app => organization_app)
      PlatformAPI.stub(:connect_oauth).and_return(platform_api)

      organization_app.should_receive(:create).with(hash_including(organization: "test-org"))

      heroku.find_or_create_app
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
github_heroku_deployer-0.4.1 spec/lib/github_heroku_deployer/heroku_spec.rb
github_heroku_deployer-0.4.0 spec/lib/github_heroku_deployer/heroku_spec.rb
github_heroku_deployer-0.3.1 spec/lib/github_heroku_deployer/heroku_spec.rb
github_heroku_deployer-0.3.0 spec/lib/github_heroku_deployer/heroku_spec.rb