heroku_hatchet 2.0.3 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2724cc73ce141dda01c9cb487f5ec17d6aee3aa
4
- data.tar.gz: abdf9b2be53bef8b915d37a95813cd900dd9a6d7
3
+ metadata.gz: d7fac9a7bda1bf9b9ee01876740f59342084d594
4
+ data.tar.gz: 26c04c978734810553e0d6fb67ecd5b0ab2dc47b
5
5
  SHA512:
6
- metadata.gz: 7f9a3853d46f8e7d3d5f223328340bcdad156b5579cc3ab5d5ce54d916b6f0657335ff3a43396d991ad5dcea93585376725e60979e3dc8a1d2fbde0e685a6c5a
7
- data.tar.gz: 7864116c20872b21b4b05f5d4f2102f752825c590a40b69184c1dcef3f697fdb48ac570a6c83c4ecd34da4c096d8c39d00a08593483ce4c6d854d17bb58dbbe8
6
+ metadata.gz: d4ade0ea4eb6be0cac69f1b434652ce9f08fd578309cb4c5fa68e969b75483b1cf7dbe8250ea5db4134aeee0e999cafeee06861786ea975649393687ccc2b8dc
7
+ data.tar.gz: d6b04a0aaf3fc458f32ed5d872ebff3ec4a385da6e95be8e5145740fd858111eaf30e791c12575a0b6512e97f985f5d08f71f8dad2dfd6c0fb22796c0cfbfd6b
data/.travis.yml CHANGED
@@ -9,8 +9,10 @@ env:
9
9
  - HATCHET_BUILDPACK_BRANCH=master
10
10
  - HATCHET_RETRIES=3
11
11
  - HATCHET_APP_LIMIT=80
12
- - secure: TvpZ0CrIe0FqjyTUOAtVqjHHrtF1esMroa00bYYRBas050/y7ygVpAn9utFZZChgt1PUbM48I01UaQglGxtmXVl3ahQXtPpXlzlwJOlDS09dlZFfLenkv530/pxIlpRtqk4q18gCoLBblXX7RZu3TGt0qds+o8dQrBzL6QifAHs=
12
+ - secure: KvuEChRTZYrWd1Q4PKt3YM5FkfuCAOtsKgjC4HDGjCYVNee3793XGwAr0e5LiQqrvHDmbJS7ZPelV3ptor2QJTdmZjPhu/tZKPMLQg7wm8vTcrJflkJDqJl6ECxd40zbUgmo+wSPSvx+K3ZGKqLF4D43vvFJaqBUoAVOGdt66c8=
13
+ - secure: XuJ4XUraWzNlfY9a+6Mh9lVlLuRY988YAaA8LKQOe2KAT5MRqcZzqlKOwDeTWK0tas68bzK7T8RT/L+6/nck0u5VrPHMhkc8QDBSqcle8kFcBxf/64EnCzB40lZoxvcdQ3wm8E41DRwsI7hAHLdVVNXC8f1/wQOAm77nOEvPdvM=
13
14
  sudo: false
15
+ dist: trusty
14
16
  addons:
15
17
  apt:
16
18
  sources:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## HEAD
2
2
 
3
+ ## 3.0.0
4
+
5
+ - Use v3 of the Heroku API because Heroku is deprecating v2
6
+
3
7
  ## 2.0.3
4
8
 
5
9
  - Fix CI support to include multi nodes of output.
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
+
5
+ gem 'm'
data/hatchet.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ["lib"]
20
20
 
21
- gem.add_dependency "platform-api", "~> 1"
21
+ gem.add_dependency "platform-api", "~> 2"
22
22
  gem.add_dependency "heroku-api", "~> 0"
23
23
  gem.add_dependency "activesupport", "~> 4"
24
24
  gem.add_dependency "rrrretry", "~> 1"
@@ -29,11 +29,9 @@ Gem::Specification.new do |gem|
29
29
  gem.add_dependency "threaded", "~> 0"
30
30
 
31
31
 
32
- gem.add_development_dependency "test-unit", "~> 3.0"
33
- gem.add_development_dependency "minitest", "~> 4.0"
32
+ gem.add_development_dependency "minitest", "~> 4.2"
34
33
  gem.add_development_dependency "rake", "~> 10"
35
34
  gem.add_development_dependency "mocha", "~> 1"
36
35
  gem.add_development_dependency "parallel_tests", "~> 0"
37
36
  gem.add_development_dependency "travis", "~> 1"
38
37
  end
39
-
data/lib/hatchet/app.rb CHANGED
@@ -28,7 +28,7 @@ module Hatchet
28
28
  @allow_failure = options[:allow_failure] || false
29
29
  @labs = ([] << options[:labs]).flatten.compact
30
30
  @buildpack = options[:buildpack] || options[:buildpack_url] || [HATCHET_BUILDPACK_BASE, HATCHET_BUILDPACK_BRANCH.call].join("#")
31
- @reaper = Reaper.new(heroku)
31
+ @reaper = Reaper.new(platform_api: platform_api)
32
32
  end
33
33
 
34
34
  def allow_failure?
@@ -46,12 +46,14 @@ module Hatchet
46
46
 
47
47
  def set_config(options = {})
48
48
  options.each do |key, value|
49
- heroku.put_config_vars(name, key => value)
49
+ # heroku.put_config_vars(name, key => value)
50
+ platform_api.config_var.update(name, key => value)
50
51
  end
51
52
  end
52
53
 
53
54
  def get_config
54
- heroku.get_config_vars(name).body
55
+ # heroku.get_config_vars(name).body
56
+ platform_api.config_var.info_for_app(name)
55
57
  end
56
58
 
57
59
  def lab_is_installed?(lab)
@@ -59,7 +61,8 @@ module Hatchet
59
61
  end
60
62
 
61
63
  def get_labs
62
- heroku.get_features(name).body
64
+ # heroku.get_features(name).body
65
+ platform_api.app_feature.list(name)
63
66
  end
64
67
 
65
68
  def set_labs!
@@ -67,12 +70,14 @@ module Hatchet
67
70
  end
68
71
 
69
72
  def set_lab(lab)
70
- heroku.post_feature(lab, name)
73
+ # heroku.post_feature(lab, name)
74
+ platform_api.app_feature.update(name, lab, enabled: true)
71
75
  end
72
76
 
73
- def add_database(db_name = 'heroku-postgresql:dev', match_val = "HEROKU_POSTGRESQL_[A-Z]+_URL")
77
+ def add_database(plan_name = 'heroku-postgresql:dev', match_val = "HEROKU_POSTGRESQL_[A-Z]+_URL")
74
78
  Hatchet::RETRIES.times.retry do
75
- heroku.post_addon(name, db_name)
79
+ # heroku.post_addon(name, plan_name)
80
+ platform_api.addon.create(name, plan: plan_name )
76
81
  _, value = get_config.detect {|k, v| k.match(/#{match_val}/) }
77
82
  set_config('DATABASE_URL' => value)
78
83
  end
@@ -107,13 +112,17 @@ module Hatchet
107
112
  alias :no_debug? :not_debugging?
108
113
 
109
114
  def deployed?
110
- !heroku.get_ps(name).body.detect {|ps| ps["process"].include?("web") }.nil?
115
+ # !heroku.get_ps(name).body.detect {|ps| ps["process"].include?("web") }.nil?
116
+ platform_api.formation.list(name).detect {|ps| ps["type"] == "web"}
111
117
  end
112
118
 
113
119
  def create_app
114
120
  3.times.retry do
115
121
  begin
116
- heroku.post_app({ name: name, stack: stack }.delete_if {|k,v| v.nil? })
122
+ # heroku.post_app({ name: name, stack: stack }.delete_if {|k,v| v.nil? })
123
+ hash = { name: name, stack: stack }
124
+ hash.delete_if { |k,v| v.nil? }
125
+ platform_api.app.create(hash)
117
126
  rescue Heroku::API::Errors::RequestFailed => e
118
127
  @reaper.cycle if e.message.match(/app limit/)
119
128
  raise e
@@ -127,6 +136,8 @@ module Hatchet
127
136
  puts "Hatchet setup: #{name.inspect} for #{repo_name.inspect}"
128
137
  create_app
129
138
  set_labs!
139
+ # heroku.put_config_vars(name, 'BUILDPACK_URL' => @buildpack)
140
+ platform_api.buildpack_installation.update(name, updates: [{buildpack: @buildpack}])
130
141
  @app_is_setup = true
131
142
  self
132
143
  end
@@ -162,7 +173,7 @@ module Hatchet
162
173
  in_directory do
163
174
  self.setup!
164
175
  self.push_with_retry!
165
- block.call(self, heroku, output) if block_given?
176
+ block.call(self, platform_api, output) if block_given?
166
177
  end
167
178
  ensure
168
179
  self.teardown!
@@ -201,6 +212,7 @@ module Hatchet
201
212
  end
202
213
 
203
214
  def heroku
215
+ raise "Not supported, use `platform_api` instead."
204
216
  @heroku ||= Heroku::API.new(api_key: api_key)
205
217
  end
206
218
 
@@ -253,7 +265,8 @@ module Hatchet
253
265
  end
254
266
 
255
267
  def platform_api
256
- @platform_api ||= PlatformAPI.connect_oauth(api_key)
268
+ # We have to not use a cache due to https://github.com/heroku/platform-api/issues/73
269
+ @platform_api ||= PlatformAPI.connect_oauth(api_key, cache: Moneta.new(:Null))
257
270
  end
258
271
 
259
272
  private
@@ -1,12 +1,6 @@
1
1
  module Hatchet
2
2
  # used for deploying a test app to heroku via git
3
3
  class GitApp < App
4
- def setup!
5
- super
6
- heroku.put_config_vars(name, 'BUILDPACK_URL' => @buildpack)
7
- self
8
- end
9
-
10
4
  def git_repo
11
5
  "https://git.heroku.com/#{name}.git"
12
6
  end
@@ -11,19 +11,20 @@ module Hatchet
11
11
  attr_accessor :apps
12
12
 
13
13
 
14
- def initialize(heroku, regex = DEFAULT_REGEX)
15
- @heroku = heroku
16
- @regex = regex
14
+ def initialize(platform_api:, regex: DEFAULT_REGEX)
15
+ @platform_api = platform_api
16
+ @regex = regex
17
17
  end
18
18
 
19
19
  # Ascending order, oldest is last
20
20
  def get_apps
21
- @apps = @heroku.get_apps.body.sort_by {|app| DateTime.parse(app["created_at"]) }.reverse
22
- @hatchet_apps = @apps.select {|app| app["name"].match(@regex) }
23
- @apps
21
+ apps = @platform_api.app.list.sort_by { |app| DateTime.parse(app["created_at"]) }.reverse
22
+ @app_count = apps.count
23
+ @hatchet_apps = apps.select {|app| app["name"].match(@regex) }
24
24
  end
25
25
 
26
- def cycle(apps = get_apps)
26
+ def cycle
27
+ get_apps
27
28
  if over_limit?
28
29
  if @hatchet_apps.count > 1
29
30
  destroy_oldest
@@ -37,28 +38,31 @@ module Hatchet
37
38
  end
38
39
 
39
40
  def destroy_oldest
40
- oldest_name = @hatchet_apps.pop["name"]
41
- destroy_by_name(oldest_name, "Hatchet app limit: #{HATCHET_APP_LIMT}")
42
- rescue Heroku::API::Errors::NotFound
41
+ oldest = @hatchet_apps.pop
42
+ destroy_by_id(name: oldest["name"], id: oldest["id"], details: "Hatchet app limit: #{HATCHET_APP_LIMT}")
43
+ rescue Heroku::API::Errors::NotFound, Excon::Error::NotFound => e
44
+ puts "Error while destroying an app, maybe it's already deleted?"
45
+ puts oldest.inspect
46
+ puts e.inspect
43
47
  # app already deleted, cycle will catch if there's still too many
44
48
  end
45
49
 
46
50
  def destroy_all
47
51
  get_apps
48
52
  @hatchet_apps.each do |app|
49
- destroy_by_name(app["name"])
53
+ destroy_by_id(name: app["name"], id: app["id"])
50
54
  end
51
55
  end
52
56
 
53
- def destroy_by_name(name, details="")
54
- puts "Destroying #{name.inspect}. #{details}"
55
- @heroku.delete_app(name)
57
+ def destroy_by_id(name:, id:, details: "")
58
+ puts "Destroying #{name.inspect}: #{id}. #{details}"
59
+ @platform_api.app.delete(id)
56
60
  end
57
61
 
58
62
  private
59
63
 
60
64
  def over_limit?
61
- @apps.count > HEROKU_APP_LIMIT || @hatchet_apps.count > HATCHET_APP_LIMT
65
+ @app_count > HEROKU_APP_LIMIT || @hatchet_apps.count > HATCHET_APP_LIMT
62
66
  end
63
67
  end
64
68
  end
data/lib/hatchet/tasks.rb CHANGED
@@ -16,18 +16,18 @@ namespace :hatchet do
16
16
  File.open(netrc, 'w') do |file|
17
17
  file.write <<EOF
18
18
  machine git.heroku.com
19
- login #{ENV['HEROKU_API_USER']}
20
- password #{ENV['HEROKU_API_KEY']}
19
+ login #{ENV.fetch('HEROKU_API_USER')}
20
+ password #{ENV.fetch('HEROKU_API_KEY')}
21
21
  EOF
22
22
  end
23
23
  end
24
24
  [
25
25
  "bundle exec hatchet install",
26
- "if [ `git config --get user.email` ]; then echo 'already set'; else `git config --global user.email '#{ENV['HEROKU_API_USER']}'`; fi",
26
+ "if [ `git config --get user.email` ]; then echo 'already set'; else `git config --global user.email '#{ENV.fetch('HEROKU_API_USER')}'`; fi",
27
27
  "if [ `git config --get user.name` ]; then echo 'already set'; else `git config --global user.name 'BuildpackTester'` ; fi",
28
28
  "echo '#{config_ssh}' >> ~/.ssh/config",
29
29
  "ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ''",
30
- "yes | heroku keys:add"
30
+ "yes | heroku keys:add -y"
31
31
  ].each do |command|
32
32
  puts "== Running: #{command}"
33
33
  Bundler.with_clean_env do
@@ -1,3 +1,3 @@
1
1
  module Hatchet
2
- VERSION = "2.0.3"
2
+ VERSION = "3.0.0"
3
3
  end
data/lib/hatchet.rb CHANGED
@@ -12,8 +12,6 @@ require 'stringio'
12
12
  module Hatchet
13
13
  end
14
14
 
15
-
16
-
17
15
  require 'hatchet/version'
18
16
  require 'hatchet/reaper'
19
17
  require 'hatchet/test_run'
@@ -1,7 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class AllowFailureGitTest < Test::Unit::TestCase
4
-
3
+ class AllowFailureGitTest < Minitest::Test
5
4
  def test_allowed_failure
6
5
  Hatchet::GitApp.new("no_lockfile", allow_failure: true).deploy do |app|
7
6
  refute app.deployed?
@@ -1,9 +1,10 @@
1
1
  require 'test_helper'
2
2
 
3
- class AppTest < Test::Unit::TestCase
3
+ class AppTest < Minitest::Test
4
4
  def test_create_app_with_stack
5
- app = Hatchet::App.new("rails3_mri_193", stack: "cedar-14")
5
+ stack = "heroku-16"
6
+ app = Hatchet::App.new("default_ruby", stack: stack)
6
7
  app.create_app
7
- assert_equal 'cedar-14', app.heroku.get_app(app.name).body["stack"]
8
+ assert_equal stack, app.platform_api.app.info(app.name)["build_stack"]["name"]
8
9
  end
9
10
  end
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
3
 
4
- class CITest < Test::Unit::TestCase
4
+ class CITest < Minitest::Test
5
5
 
6
6
  def test_ci_create_app_with_stack
7
7
  Hatchet::GitApp.new("rails5_ruby_schema_format").run_ci do |test_run|
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class ConfigTest < Test::Unit::TestCase
3
+ class ConfigTest < Minitest::Test
4
4
 
5
5
  def setup
6
6
  @config = Hatchet::Config.new
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class EditRepoTest < Test::Unit::TestCase
3
+ class EditRepoTest < Minitest::Test
4
4
  def test_can_deploy_git_app
5
5
  Hatchet::GitApp.new("default_ruby").in_directory do |app|
6
6
  msg = `touch foo`
@@ -1,14 +1,14 @@
1
1
  require 'test_helper'
2
2
 
3
- class GitAppTest < Test::Unit::TestCase
3
+ class GitAppTest < Minitest::Test
4
4
  def test_can_deploy_git_app
5
- Hatchet::GitApp.new("rails3_mri_193", buildpack: "https://github.com/heroku/heroku-buildpack-ruby.git").deploy do |app|
5
+ Hatchet::GitApp.new("rails5_ruby_schema_format").deploy do |app|
6
6
  assert true
7
- assert_match '1.9.3', app.run("ruby -v")
7
+ assert_match '2.4.1', app.run("ruby -v")
8
8
 
9
9
  app.run("bash") do |cmd|
10
10
  # cmd.run("cd public/assets")
11
- cmd.run("ls public/assets") {|r| assert_match "application.css", r}
11
+ cmd.run("ls public/") {|r| assert_match("assets", r) }
12
12
  end
13
13
  end
14
14
  end
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class HerokuApiTest < Test::Unit::TestCase
3
+ class HerokuApiTest < Minitest::Test
4
4
 
5
5
  def test_config_vars
6
6
  runner = Hatchet::Runner.new("no_lockfile").setup!
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- class LabsTest < Test::Unit::TestCase
3
+ class LabsTest < Minitest::Test
4
4
  def setup
5
5
  @buildpack_path = File.expand_path 'test/fixtures/buildpacks/heroku-buildpack-ruby'
6
6
  end
@@ -1,13 +1,12 @@
1
1
  require 'test_helper'
2
2
 
3
- class MultiCmdRunnerTest < Test::Unit::TestCase
3
+ class MultiCmdRunnerTest < Minitest::Test
4
4
  # slow but needed, there are ghosts in the machine
5
5
  # by running common command multiple times we can find them
6
6
  def test_multi_repl_commands
7
7
  Hatchet::GitApp.new("default_ruby").deploy do |app|
8
- app.add_database
9
8
 
10
- assert_raise ReplRunner::UnregisteredCommand do
9
+ assert_raise(ReplRunner::UnregisteredCommand) do
11
10
  app.run("ls", 2) do |ls| # will return right away, should raise error
12
11
  ls.run("cat")
13
12
  end
data/test/test_helper.rb CHANGED
@@ -1,12 +1,22 @@
1
1
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
2
  require 'hatchet'
3
3
 
4
+ require 'bundler'
4
5
  Bundler.require
5
6
 
6
- require 'test/unit'
7
+ # require 'test/unit'
8
+
9
+ require 'minitest/autorun'
7
10
  require "mocha/setup"
8
11
 
9
- def assert_tests_run
12
+ # Not needed if you're using the most recent version
13
+ if defined?(MiniTest::Unit::TestCase)
14
+ Minitest::Test = MiniTest::Unit::TestCase
15
+ end
16
+
17
+ def assert_raise(*args, &block)
18
+ assert_raises(*args, &block)
10
19
  end
11
20
 
12
21
 
22
+ ENV['HATCHET_BUILDPACK_BRANCH'] = "master"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku_hatchet
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Schneeman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-12 00:00:00.000000000 Z
11
+ date: 2017-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: platform-api
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1'
19
+ version: '2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1'
26
+ version: '2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: heroku-api
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -136,34 +136,20 @@ dependencies:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: test-unit
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '3.0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '3.0'
153
139
  - !ruby/object:Gem::Dependency
154
140
  name: minitest
155
141
  requirement: !ruby/object:Gem::Requirement
156
142
  requirements:
157
143
  - - "~>"
158
144
  - !ruby/object:Gem::Version
159
- version: '4.0'
145
+ version: '4.2'
160
146
  type: :development
161
147
  prerelease: false
162
148
  version_requirements: !ruby/object:Gem::Requirement
163
149
  requirements:
164
150
  - - "~>"
165
151
  - !ruby/object:Gem::Version
166
- version: '4.0'
152
+ version: '4.2'
167
153
  - !ruby/object:Gem::Dependency
168
154
  name: rake
169
155
  requirement: !ruby/object:Gem::Requirement
@@ -252,7 +238,6 @@ files:
252
238
  - test/fixtures/buildpacks/null-buildpack/bin/release
253
239
  - test/fixtures/buildpacks/null-buildpack/hatchet.json
254
240
  - test/fixtures/buildpacks/null-buildpack/readme.md
255
- - test/hatchet/allow_failure_anvil_test.rb
256
241
  - test/hatchet/allow_failure_git_test.rb
257
242
  - test/hatchet/app_test.rb
258
243
  - test/hatchet/ci_test.rb
@@ -262,7 +247,6 @@ files:
262
247
  - test/hatchet/heroku_api_test.rb
263
248
  - test/hatchet/labs_test.rb
264
249
  - test/hatchet/multi_cmd_runner_test.rb
265
- - test/hatchet/reaper_test.rb
266
250
  - test/test_helper.rb
267
251
  homepage: https://github.com/heroku/hatchet
268
252
  licenses:
@@ -294,7 +278,6 @@ test_files:
294
278
  - test/fixtures/buildpacks/null-buildpack/bin/release
295
279
  - test/fixtures/buildpacks/null-buildpack/hatchet.json
296
280
  - test/fixtures/buildpacks/null-buildpack/readme.md
297
- - test/hatchet/allow_failure_anvil_test.rb
298
281
  - test/hatchet/allow_failure_git_test.rb
299
282
  - test/hatchet/app_test.rb
300
283
  - test/hatchet/ci_test.rb
@@ -304,5 +287,4 @@ test_files:
304
287
  - test/hatchet/heroku_api_test.rb
305
288
  - test/hatchet/labs_test.rb
306
289
  - test/hatchet/multi_cmd_runner_test.rb
307
- - test/hatchet/reaper_test.rb
308
290
  - test/test_helper.rb
@@ -1,4 +0,0 @@
1
- require 'test_helper'
2
-
3
- class AllowFailureAnvilTest < Test::Unit::TestCase
4
- end
@@ -1,31 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ReaperTest < Test::Unit::TestCase
4
-
5
- def test_destroy_by_name
6
- heroku = mock('heroku')
7
- reaper = Hatchet::Reaper.new(heroku)
8
- heroku.expects(:delete_app).with("my-app-name")
9
- reaper.destroy_by_name("my-app-name")
10
- end
11
-
12
- def test_destroy_all
13
- heroku = stub(:get_apps =>
14
- stub(:body => [{
15
- 'name' => 'hatchet-t-123',
16
- 'created_at' => DateTime.new.to_s
17
- },{
18
- 'name' => 'hatchet-t-abc',
19
- 'created_at' => DateTime.new.to_s
20
- },{
21
- 'name' => 'my-app-name',
22
- 'created_at' => DateTime.new.to_s
23
- }
24
- ])
25
- )
26
- reaper = Hatchet::Reaper.new(heroku)
27
- heroku.expects(:delete_app).with('hatchet-t-123')
28
- heroku.expects(:delete_app).with('hatchet-t-abc')
29
- reaper.destroy_all
30
- end
31
- end