paratrooper 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,11 +30,23 @@ module Paratrooper
30
30
 
31
31
  private
32
32
  def app_domain_name
33
- heroku_api.get_domains(app_name).body.last['domain']
33
+ if custom_domain_response
34
+ custom_domain_response['domain']
35
+ else
36
+ default_domain_name
37
+ end
34
38
  end
35
39
 
36
40
  def app_maintenance(flag)
37
41
  heroku_api.post_app_maintenance(app_name, flag)
38
42
  end
43
+
44
+ def default_domain_name
45
+ heroku_api.get_app(app_name).body['domain_name']['domain']
46
+ end
47
+
48
+ def custom_domain_response
49
+ @custom_domain_response ||= heroku_api.get_domains(app_name).body.last
50
+ end
39
51
  end
40
52
  end
@@ -1,3 +1,3 @@
1
1
  module Paratrooper
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
@@ -62,11 +62,33 @@ describe Paratrooper::HerokuWrapper do
62
62
  end
63
63
  end
64
64
 
65
- describe '#app_domain_name' do
66
- let(:response) { double(:response, body: [{'domain' => 'APP_URL'}]) }
67
- it "calls down to heroku api" do
68
- heroku_api.should_receive(:get_domains).with(app_name).and_return(response)
69
- wrapper.app_url
65
+ describe '#app_url' do
66
+ context 'when custom domains are available' do
67
+ let(:response) { double(:response, body: [{'domain' => 'APP_URL'}]) }
68
+
69
+ it "calls down to heroku api" do
70
+ heroku_api.should_receive(:get_domains).with(app_name).and_return(response)
71
+ wrapper.app_url
72
+ end
73
+ end
74
+
75
+ context 'when custom urls are not available' do
76
+ let(:response) do
77
+ double(:response, body: { 'domain_name' => { 'domain' => 'APP_URL' } })
78
+ end
79
+
80
+ let(:domain_response) do
81
+ double(:domain_response, body: [])
82
+ end
83
+
84
+ before do
85
+ heroku_api.stub(:get_domains).and_return(domain_response)
86
+ end
87
+
88
+ it "makes call to get default heroku app url" do
89
+ heroku_api.should_receive(:get_app).with(app_name).and_return(response)
90
+ expect(wrapper.app_url).to eq('APP_URL')
91
+ end
70
92
  end
71
93
  end
72
94
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paratrooper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-02-11 00:00:00.000000000 Z
13
+ date: 2013-02-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake