Sha256: da493e72ad3405545840062ca4d2c217f5b8f4a2e8ed0d5d7b42dbf36c2ba2c0

Contents?: true

Size: 1.59 KB

Versions: 16

Compression:

Stored size: 1.59 KB

Contents

require File.expand_path("#{File.dirname(__FILE__)}/test_helper")

class TestDomains < Minitest::Test

  def test_delete_domain_app_not_found
    assert_raises(Heroku::API::Errors::NotFound) do
      heroku.delete_domain(random_name, 'example.com')
    end
  end

  def test_delete_domain
    with_app do |app_data|
      domain = random_domain
      heroku.post_domain(app_data['name'], domain)
      response = heroku.delete_domain(app_data['name'], domain)

      assert_equal(200, response.status)
      assert_equal({}, response.body)
    end
  end

  def test_delete_domains
    with_app do |app_data|
      heroku.post_domain(app_data['name'], random_domain)
      response = heroku.delete_domains(app_data['name'])

      assert_equal(200, response.status)
      assert_equal("", response.body)
    end
  end

  def test_get_domains
    with_app do |app_data|
      response = heroku.get_domains(app_data['name'])

      assert_equal(200, response.status)
      assert_equal([], response.body)
    end
  end

  def test_get_domains_app_not_found
    assert_raises(Heroku::API::Errors::NotFound) do
      heroku.get_domains(random_name)
    end
  end

  def test_post_domain
    with_app do |app_data|
      domain = random_domain
      response = heroku.post_domain(app_data['name'], domain)

      assert_equal(201, response.status)
      assert_equal({'domain' => domain}, response.body)

      heroku.delete_domain(app_data['name'], domain)
    end
  end

  def test_post_domain_app_not_found
    assert_raises(Heroku::API::Errors::NotFound) do
      heroku.post_domain(random_name, 'example.com')
    end
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
heroku-api-0.4.3 test/test_domains.rb
heroku-api-0.4.2 test/test_domains.rb
heroku-api-0.4.1 test/test_domains.rb
heroku-api-0.4.0 test/test_domains.rb
heroku-api-0.3.23 test/test_domains.rb
heroku-api-0.3.22 test/test_domains.rb
heroku-api-0.3.21 test/test_domains.rb
heroku-api-0.3.20 test/test_domains.rb
heroku-api-0.3.19 test/test_domains.rb
heroku-api-0.3.18 test/test_domains.rb
heroku-api-0.3.17 test/test_domains.rb
heroku-api-0.3.16 test/test_domains.rb
heroku-api-0.3.15 test/test_domains.rb
heroku-api-0.3.14 test/test_domains.rb
heroku-api-0.3.13 test/test_domains.rb
heroku-api-0.3.12 test/test_domains.rb