boxen-linux 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.travis.yml +7 -0
- data/Gemfile +2 -0
- data/LICENSE +20 -0
- data/README.md +50 -0
- data/boxen.gemspec +26 -0
- data/lib/boxen/check.rb +72 -0
- data/lib/boxen/checkout.rb +25 -0
- data/lib/boxen/cli.rb +63 -0
- data/lib/boxen/config.rb +330 -0
- data/lib/boxen/error.rb +4 -0
- data/lib/boxen/flags.rb +272 -0
- data/lib/boxen/hook.rb +47 -0
- data/lib/boxen/hook/github_issue.rb +120 -0
- data/lib/boxen/hook/web.rb +56 -0
- data/lib/boxen/keychain.rb +63 -0
- data/lib/boxen/postflight.rb +13 -0
- data/lib/boxen/postflight/active.rb +16 -0
- data/lib/boxen/postflight/env.rb +34 -0
- data/lib/boxen/preflight.rb +13 -0
- data/lib/boxen/preflight/creds.rb +108 -0
- data/lib/boxen/preflight/directories.rb +32 -0
- data/lib/boxen/preflight/etc_my_cnf.rb +12 -0
- data/lib/boxen/preflight/homebrew.rb +13 -0
- data/lib/boxen/preflight/identity.rb +16 -0
- data/lib/boxen/preflight/os.rb +33 -0
- data/lib/boxen/preflight/rbenv.rb +12 -0
- data/lib/boxen/preflight/rvm.rb +12 -0
- data/lib/boxen/project.rb +20 -0
- data/lib/boxen/puppeteer.rb +122 -0
- data/lib/boxen/runner.rb +149 -0
- data/lib/boxen/service.rb +58 -0
- data/lib/boxen/util.rb +17 -0
- data/lib/facter/boxen.rb +34 -0
- data/lib/system_timer.rb +13 -0
- data/script/Boxen +0 -0
- data/script/Boxen-linux +0 -0
- data/script/bootstrap +7 -0
- data/script/build-keychain-helper +6 -0
- data/script/build-keyring-helper +9 -0
- data/script/release +38 -0
- data/script/tests +10 -0
- data/src/keychain-helper.c +85 -0
- data/src/keyring-helper.c +86 -0
- data/test/boxen/test.rb +7 -0
- data/test/boxen_check_test.rb +55 -0
- data/test/boxen_checkout_test.rb +42 -0
- data/test/boxen_cli_test.rb +39 -0
- data/test/boxen_config_test.rb +393 -0
- data/test/boxen_directories_test.rb +40 -0
- data/test/boxen_flags_test.rb +217 -0
- data/test/boxen_hook_github_issue_test.rb +294 -0
- data/test/boxen_hook_web_test.rb +58 -0
- data/test/boxen_keychain_test.rb +24 -0
- data/test/boxen_postflight_active_test.rb +29 -0
- data/test/boxen_postflight_env_test.rb +6 -0
- data/test/boxen_preflight_creds_test.rb +80 -0
- data/test/boxen_preflight_etc_my_cnf_test.rb +10 -0
- data/test/boxen_preflight_homebrew_test.rb +10 -0
- data/test/boxen_preflight_rvm_test.rb +10 -0
- data/test/boxen_project_test.rb +14 -0
- data/test/boxen_puppeteer_test.rb +101 -0
- data/test/boxen_runner_test.rb +171 -0
- data/test/boxen_service_test.rb +39 -0
- data/test/boxen_util_test.rb +21 -0
- data/test/fixtures/repo/modules/projects/manifests/first-project.pp +0 -0
- data/test/fixtures/repo/modules/projects/manifests/second-project.pp +0 -0
- data/test/system_timer.rb +10 -0
- metadata +279 -0
data/test/boxen/test.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require "boxen/test"
|
2
|
+
require "boxen/check"
|
3
|
+
|
4
|
+
class BoxenCheckTest < Boxen::Test
|
5
|
+
def test_initialize
|
6
|
+
check = Boxen::Check.new :config
|
7
|
+
assert_equal :config, check.config
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_ok?
|
11
|
+
ex = assert_raises RuntimeError do
|
12
|
+
Boxen::Check.new(:config).ok?
|
13
|
+
end
|
14
|
+
|
15
|
+
assert_match "must implement", ex.message
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_run
|
19
|
+
ex = assert_raises RuntimeError do
|
20
|
+
Boxen::Check.new(:config).run
|
21
|
+
end
|
22
|
+
|
23
|
+
assert_match "must implement", ex.message
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_self_checks
|
27
|
+
subclass = Class.new Boxen::Check
|
28
|
+
Boxen::Check.const_set :TestCheck, subclass
|
29
|
+
|
30
|
+
assert Boxen::Check.checks(:config).any? { |c| subclass === c },
|
31
|
+
"an instance of TestCheck exists in checks"
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_self_checks_subclasses
|
35
|
+
klass = Struct.new :config
|
36
|
+
Boxen::Check.const_set :TestBadCheck, klass
|
37
|
+
|
38
|
+
refute Boxen::Check.checks(:config).any? { |c| klass === c },
|
39
|
+
"checks are subclasses of Boxen::Check"
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_self_run
|
43
|
+
willrun = mock do
|
44
|
+
expects(:ok?).returns false
|
45
|
+
expects(:run)
|
46
|
+
end
|
47
|
+
|
48
|
+
wontrun = mock do
|
49
|
+
expects(:ok?).returns true
|
50
|
+
end
|
51
|
+
|
52
|
+
Boxen::Check.expects(:checks).with(:config).returns [willrun, wontrun]
|
53
|
+
Boxen::Check.run :config
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require "boxen/test"
|
2
|
+
require "boxen/checkout"
|
3
|
+
|
4
|
+
class BoxenCheckoutTest < Boxen::Test
|
5
|
+
def setup
|
6
|
+
@config = Boxen::Config.new { |c| c.repodir = 'test/fixtures/repo' }
|
7
|
+
@checkout = Boxen::Checkout.new @config
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_initialize
|
11
|
+
checkout = Boxen::Checkout.new :config
|
12
|
+
assert_equal :config, checkout.config
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_sha
|
16
|
+
sha = 'deadbeef'
|
17
|
+
@checkout.expects(:"`").with("git rev-parse HEAD").returns("#{sha}\n")
|
18
|
+
assert_equal sha, @checkout.sha
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_master?
|
22
|
+
@checkout.stubs(:"`").with("git symbolic-ref HEAD").returns("refs/heads/topic\n")
|
23
|
+
assert !@checkout.master?
|
24
|
+
|
25
|
+
@checkout.stubs(:"`").with("git symbolic-ref HEAD").returns("refs/heads/master\n")
|
26
|
+
assert @checkout.master?
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_changes
|
30
|
+
changes = ' maybe a bunch of stuff happened '
|
31
|
+
@checkout.expects(:"`").with("git status --porcelain").returns(changes)
|
32
|
+
assert_equal changes.strip, @checkout.changes
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_dirty?
|
36
|
+
@checkout.stubs(:changes).returns('stuff happened')
|
37
|
+
assert @checkout.dirty?
|
38
|
+
|
39
|
+
@checkout.stubs(:changes).returns('')
|
40
|
+
assert !@checkout.dirty?
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "boxen/test"
|
2
|
+
require "boxen/cli"
|
3
|
+
|
4
|
+
class BoxenCLITest < Boxen::Test
|
5
|
+
def setup
|
6
|
+
@config = Boxen::Config.new
|
7
|
+
@flags = Boxen::Flags.new
|
8
|
+
@cli = Boxen::CLI.new(@config, @flags)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_initialize
|
12
|
+
config = Boxen::Config.new
|
13
|
+
flags = Boxen::Flags.new
|
14
|
+
|
15
|
+
cli = Boxen::CLI.new config, flags
|
16
|
+
|
17
|
+
assert_equal config, cli.config
|
18
|
+
assert_equal flags, cli.flags
|
19
|
+
|
20
|
+
assert_equal config, cli.runner.config
|
21
|
+
assert_equal flags, cli.runner.flags
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_run
|
25
|
+
@cli.runner.expects(:run)
|
26
|
+
@cli.run
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_help
|
30
|
+
$stdout.stubs(:write)
|
31
|
+
|
32
|
+
flags = Boxen::Flags.new('--help')
|
33
|
+
cli = Boxen::CLI.new(@config, flags)
|
34
|
+
cli.runner.expects(:run).never
|
35
|
+
assert_raises SystemExit do
|
36
|
+
cli.run
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,393 @@
|
|
1
|
+
require "boxen/test"
|
2
|
+
require "boxen/config"
|
3
|
+
|
4
|
+
class BoxenConfigTest < Boxen::Test
|
5
|
+
def setup
|
6
|
+
@config = Boxen::Config.new
|
7
|
+
@config.repodir = "test/fixtures/repo"
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_debug?
|
11
|
+
refute @config.debug?
|
12
|
+
|
13
|
+
@config.debug = true
|
14
|
+
assert @config.debug?
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_email
|
18
|
+
assert_nil @config.email
|
19
|
+
|
20
|
+
@config.email = "foo"
|
21
|
+
assert_equal "foo", @config.email
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_fde?
|
25
|
+
assert @config.fde?
|
26
|
+
|
27
|
+
@config.fde = false
|
28
|
+
refute @config.fde?
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_fde_env_var
|
32
|
+
val = ENV["BOXEN_NO_FDE"]
|
33
|
+
|
34
|
+
ENV["BOXEN_NO_FDE"] = "1"
|
35
|
+
refute @config.fde?
|
36
|
+
|
37
|
+
ENV["BOXEN_NO_FDE"] = val
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_homedir
|
41
|
+
val = ENV["BOXEN_HOME"]
|
42
|
+
ENV["BOXEN_HOME"] = nil
|
43
|
+
|
44
|
+
assert_equal "/opt/boxen", @config.homedir
|
45
|
+
|
46
|
+
@config.homedir = "foo"
|
47
|
+
assert_equal "foo", @config.homedir
|
48
|
+
|
49
|
+
ENV["BOXEN_HOME"] = val
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_homedir_env_var_boxen_home
|
53
|
+
val = ENV["BOXEN_HOME"]
|
54
|
+
|
55
|
+
ENV["BOXEN_HOME"] = "foo"
|
56
|
+
assert_equal "foo", @config.homedir
|
57
|
+
|
58
|
+
ENV["BOXEN_HOME"] = val
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_initialize
|
62
|
+
config = Boxen::Config.new do |c|
|
63
|
+
c.homedir = "foo"
|
64
|
+
end
|
65
|
+
|
66
|
+
assert_equal "foo", config.homedir
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_logfile
|
70
|
+
assert_equal "#{@config.repodir}/log/boxen.log", @config.logfile
|
71
|
+
|
72
|
+
@config.logfile = "foo"
|
73
|
+
assert_equal "foo", @config.logfile
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_logfile_env_var
|
77
|
+
val = ENV["BOXEN_LOG_FILE"]
|
78
|
+
|
79
|
+
ENV["BOXEN_LOG_FILE"] = "foo"
|
80
|
+
assert_equal "foo", @config.logfile
|
81
|
+
|
82
|
+
ENV["BOXEN_LOG_FILE"] = val
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_login
|
86
|
+
assert_nil @config.login
|
87
|
+
|
88
|
+
@config.login = "foo"
|
89
|
+
assert_equal "foo", @config.login
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_name
|
93
|
+
assert_nil @config.name
|
94
|
+
|
95
|
+
@config.name = "foo"
|
96
|
+
assert_equal "foo", @config.name
|
97
|
+
end
|
98
|
+
|
99
|
+
def test_pretend?
|
100
|
+
refute @config.pretend?
|
101
|
+
|
102
|
+
@config.pretend = true
|
103
|
+
assert @config.pretend?
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_profile?
|
107
|
+
refute @config.profile?
|
108
|
+
|
109
|
+
@config.profile = true
|
110
|
+
assert @config.profile?
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_future_parser?
|
114
|
+
refute @config.future_parser?
|
115
|
+
|
116
|
+
@config.future_parser = true
|
117
|
+
assert @config.future_parser?
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_projects
|
121
|
+
files = Dir["#{@config.repodir}/modules/projects/manifests/*.pp"]
|
122
|
+
assert_equal files.size, @config.projects.size
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_puppetdir
|
126
|
+
assert_equal "/tmp/boxen/puppet", @config.puppetdir
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_puppetdir_env_var
|
130
|
+
val = ENV["BOXEN_PUPPET_DIR"]
|
131
|
+
|
132
|
+
ENV["BOXEN_PUPPET_DIR"] = "foo"
|
133
|
+
assert_equal "foo", @config.puppetdir
|
134
|
+
|
135
|
+
ENV["BOXEN_PUPPET_DIR"] = val
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_ghurl
|
139
|
+
@config.ghurl = "https://git.foo.com"
|
140
|
+
assert_equal "https://git.foo.com", @config.ghurl
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_ghurl_blank
|
144
|
+
assert_equal "https://github.com", @config.ghurl
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_gheurl_env_var
|
148
|
+
val = ENV['BOXEN_GITHUB_ENTERPRISE_URL']
|
149
|
+
|
150
|
+
ENV['BOXEN_GITHUB_ENTERPRISE_URL'] = 'https://git.foo.com'
|
151
|
+
assert_equal "https://git.foo.com", @config.ghurl
|
152
|
+
|
153
|
+
ENV['BOXEN_GITHUB_ENTERPRISE_URL'] = val
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_enterprise_true
|
157
|
+
@config.ghurl = "https://git.foo.com"
|
158
|
+
assert @config.enterprise?
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_enterprise_false
|
162
|
+
assert @config.enterprise? == false
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_repotemplate
|
166
|
+
@config.repotemplate = 'https://git.foo.com/%s'
|
167
|
+
assert_equal 'https://git.foo.com/%s', @config.repotemplate
|
168
|
+
end
|
169
|
+
|
170
|
+
def test_repotemplate_blank
|
171
|
+
assert_equal 'https://github.com/%s', @config.repotemplate
|
172
|
+
end
|
173
|
+
|
174
|
+
def test_repotemplate_env_var
|
175
|
+
val = ENV['BOXEN_REPO_URL_TEMPLATE']
|
176
|
+
|
177
|
+
ENV['BOXEN_REPO_URL_TEMPLATE'] = 'https://git.foo.com/%s'
|
178
|
+
assert_equal 'https://git.foo.com/%s', @config.repotemplate
|
179
|
+
|
180
|
+
ENV['BOXEN_REPO_URL_TEMPLATE'] = val
|
181
|
+
end
|
182
|
+
|
183
|
+
def test_repodir
|
184
|
+
@config.repodir = nil
|
185
|
+
assert_equal Dir.pwd, @config.repodir
|
186
|
+
|
187
|
+
@config.repodir = "foo"
|
188
|
+
assert_equal "foo", @config.repodir
|
189
|
+
end
|
190
|
+
|
191
|
+
def test_repodir_env_var
|
192
|
+
@config.repodir = nil
|
193
|
+
|
194
|
+
val = ENV["BOXEN_REPO_DIR"]
|
195
|
+
|
196
|
+
ENV["BOXEN_REPO_DIR"] = "foo"
|
197
|
+
assert_equal "foo", @config.repodir
|
198
|
+
|
199
|
+
ENV["BOXEN_REPO_DIR"] = val
|
200
|
+
end
|
201
|
+
|
202
|
+
def test_reponame
|
203
|
+
@config.reponame = "something/explicit"
|
204
|
+
assert_equal "something/explicit", @config.reponame
|
205
|
+
end
|
206
|
+
|
207
|
+
def test_reponame_env_var
|
208
|
+
val = ENV["BOXEN_REPO_NAME"]
|
209
|
+
|
210
|
+
ENV["BOXEN_REPO_NAME"] = "env/var"
|
211
|
+
assert_equal "env/var", @config.reponame
|
212
|
+
|
213
|
+
ENV["BOXEN_REPO_NAME"] = val
|
214
|
+
end
|
215
|
+
|
216
|
+
def test_reponame_git_config
|
217
|
+
@config.expects(:"`").with("git config remote.origin.url").
|
218
|
+
returns "https://github.com/some-org/our-boxen\n"
|
219
|
+
|
220
|
+
assert_equal "some-org/our-boxen", @config.reponame
|
221
|
+
end
|
222
|
+
|
223
|
+
def test_reponame_git_config_ghurl
|
224
|
+
@config.ghurl = 'https://git.foo.com'
|
225
|
+
@config.expects(:"`").with("git config remote.origin.url").
|
226
|
+
returns "https://git.foo.com/some-org/our-boxen\n"
|
227
|
+
|
228
|
+
assert_equal "some-org/our-boxen", @config.reponame
|
229
|
+
end
|
230
|
+
|
231
|
+
def test_reponame_git_config_git_protocol
|
232
|
+
@config.expects(:"`").with("git config remote.origin.url").
|
233
|
+
returns "git@github.com:some-org/our-boxen.git\n"
|
234
|
+
|
235
|
+
assert_equal "some-org/our-boxen", @config.reponame
|
236
|
+
end
|
237
|
+
|
238
|
+
def test_reponame_git_config_git_protocol_ghurl
|
239
|
+
@config.ghurl = 'https://git.foo.com'
|
240
|
+
@config.expects(:"`").with("git config remote.origin.url").
|
241
|
+
returns "git@git.foo.com:some-org/our-boxen.git\n"
|
242
|
+
|
243
|
+
assert_equal "some-org/our-boxen", @config.reponame
|
244
|
+
end
|
245
|
+
|
246
|
+
def test_reponame_git_config_bad_exit
|
247
|
+
@config.expects(:"`").with("git config remote.origin.url").returns ""
|
248
|
+
$?.expects(:success?).returns false
|
249
|
+
|
250
|
+
assert_nil @config.reponame
|
251
|
+
end
|
252
|
+
|
253
|
+
def test_reponame_git_config_bad_url
|
254
|
+
@config.expects(:"`").with("git config remote.origin.url").
|
255
|
+
returns "https://spumco.com/some-org/our-boxen\n"
|
256
|
+
$?.expects(:success?).returns true
|
257
|
+
|
258
|
+
assert_nil @config.reponame
|
259
|
+
end
|
260
|
+
|
261
|
+
def test_reponame_git_config_bad_url_git_protocol
|
262
|
+
@config.expects(:"`").with("git config remote.origin.url").
|
263
|
+
returns "git@spumco.com:some-org/our-boxen.git\n"
|
264
|
+
$?.expects(:success?).returns true
|
265
|
+
|
266
|
+
assert_nil @config.reponame
|
267
|
+
end
|
268
|
+
|
269
|
+
def test_reponame_git_config_git_extension
|
270
|
+
@config.expects(:"`").with("git config remote.origin.url").
|
271
|
+
returns "https://github.com/some-org/our-boxen.git\n"
|
272
|
+
$?.expects(:success?).returns true
|
273
|
+
|
274
|
+
assert_equal "some-org/our-boxen", @config.reponame
|
275
|
+
end
|
276
|
+
|
277
|
+
def test_reponame_git_config_git_extension_ghurl
|
278
|
+
@config.ghurl = 'https://git.foo.com'
|
279
|
+
@config.expects(:"`").with("git config remote.origin.url").
|
280
|
+
returns "https://git.foo.com/some-org/our-boxen.git\n"
|
281
|
+
$?.expects(:success?).returns true
|
282
|
+
|
283
|
+
assert_equal "some-org/our-boxen", @config.reponame
|
284
|
+
end
|
285
|
+
|
286
|
+
def test_srcdir
|
287
|
+
val = ENV["BOXEN_SRC_DIR"]
|
288
|
+
ENV["BOXEN_SRC_DIR"] = nil
|
289
|
+
|
290
|
+
@config.expects(:user).returns "foo"
|
291
|
+
assert_equal "/Users/foo/src", @config.srcdir
|
292
|
+
|
293
|
+
@config.srcdir = "elsewhere"
|
294
|
+
assert_equal "elsewhere", @config.srcdir
|
295
|
+
|
296
|
+
ENV["BOXEN_SRC_DIR"] = val
|
297
|
+
end
|
298
|
+
|
299
|
+
def test_srcdir_env_var
|
300
|
+
@config.srcdir = nil
|
301
|
+
|
302
|
+
val = ENV["BOXEN_SRC_DIR"]
|
303
|
+
|
304
|
+
ENV["BOXEN_SRC_DIR"] = "Projects"
|
305
|
+
assert_equal "Projects", @config.srcdir
|
306
|
+
|
307
|
+
ENV["BOXEN_SRC_DIR"] = val
|
308
|
+
end
|
309
|
+
|
310
|
+
def test_stealth?
|
311
|
+
refute @config.stealth?
|
312
|
+
|
313
|
+
@config.stealth = true
|
314
|
+
assert @config.stealth?
|
315
|
+
end
|
316
|
+
|
317
|
+
def test_stealth_env_var
|
318
|
+
val = ENV["BOXEN_NO_ISSUE"]
|
319
|
+
|
320
|
+
ENV["BOXEN_NO_ISSUE"] = "1"
|
321
|
+
assert @config.stealth?
|
322
|
+
|
323
|
+
ENV["BOXEN_NO_ISSUE"] = val
|
324
|
+
end
|
325
|
+
|
326
|
+
def test_token
|
327
|
+
assert_nil @config.token
|
328
|
+
|
329
|
+
@config.token = "foo"
|
330
|
+
assert_equal "foo", @config.token
|
331
|
+
end
|
332
|
+
|
333
|
+
def test_user
|
334
|
+
ENV["USER"] = "foo"
|
335
|
+
assert_equal "foo", @config.user
|
336
|
+
|
337
|
+
@config.user = "bar"
|
338
|
+
assert_equal "bar", @config.user
|
339
|
+
end
|
340
|
+
|
341
|
+
def test_api
|
342
|
+
@config.token = token = "s3kr!7"
|
343
|
+
|
344
|
+
api = Object.new
|
345
|
+
Octokit::Client.expects(:new).with(:login => token, :password => 'x-oauth-basic').once.returns(api)
|
346
|
+
|
347
|
+
assert_equal api, @config.api
|
348
|
+
assert_equal api, @config.api # This extra call plus the `once` on the expectation is for the ivar cache.
|
349
|
+
end
|
350
|
+
|
351
|
+
def test_s3host
|
352
|
+
val = ENV["BOXEN_S3_HOST"]
|
353
|
+
ENV["BOXEN_S3_HOST"] = nil
|
354
|
+
|
355
|
+
assert_equal "s3.amazonaws.com", @config.s3host
|
356
|
+
|
357
|
+
@config.s3host = "example.com"
|
358
|
+
assert_equal "example.com", @config.s3host
|
359
|
+
ensure
|
360
|
+
ENV["BOXEN_S3_HOST"] = val
|
361
|
+
end
|
362
|
+
|
363
|
+
def test_s3host_env_var
|
364
|
+
val = ENV["BOXEN_S3_HOST"]
|
365
|
+
|
366
|
+
ENV["BOXEN_S3_HOST"] = "example.com"
|
367
|
+
assert_equal "example.com", @config.s3host
|
368
|
+
|
369
|
+
ensure
|
370
|
+
ENV["BOXEN_S3_HOST"] = val
|
371
|
+
end
|
372
|
+
|
373
|
+
def test_s3bucket
|
374
|
+
val = ENV["BOXEN_S3_BUCKET"]
|
375
|
+
ENV["BOXEN_S3_BUCKET"] = nil
|
376
|
+
|
377
|
+
assert_equal "boxen-downloads", @config.s3bucket
|
378
|
+
|
379
|
+
@config.s3bucket = "my-bucket"
|
380
|
+
assert_equal "my-bucket", @config.s3bucket
|
381
|
+
ensure
|
382
|
+
ENV["BOXEN_S3_BUCKET"] = val
|
383
|
+
end
|
384
|
+
|
385
|
+
def test_s3host_env_var
|
386
|
+
val = ENV["BOXEN_S3_BUCKET"]
|
387
|
+
|
388
|
+
ENV["BOXEN_S3_BUCKET"] = "my-bucket"
|
389
|
+
assert_equal "my-bucket", @config.s3bucket
|
390
|
+
ensure
|
391
|
+
ENV["BOXEN_S3_BUCKET"] = val
|
392
|
+
end
|
393
|
+
end
|