engineyard 3.1.2 → 3.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/engineyard/version.rb +2 -2
- data/spec/engineyard/cli/api_spec.rb +6 -6
- data/spec/engineyard/cli_spec.rb +5 -5
- data/spec/engineyard/config_spec.rb +7 -7
- data/spec/engineyard/deploy_config_spec.rb +39 -39
- data/spec/engineyard/eyrc_spec.rb +13 -13
- data/spec/engineyard/repo_spec.rb +8 -8
- data/spec/engineyard_spec.rb +1 -1
- data/spec/ey/deploy_spec.rb +64 -64
- data/spec/ey/ey_spec.rb +3 -3
- data/spec/ey/list_environments_spec.rb +28 -28
- data/spec/ey/login_spec.rb +5 -5
- data/spec/ey/logout_spec.rb +5 -5
- data/spec/ey/logs_spec.rb +5 -5
- data/spec/ey/rebuild_spec.rb +1 -1
- data/spec/ey/recipes/apply_spec.rb +2 -2
- data/spec/ey/recipes/download_spec.rb +3 -3
- data/spec/ey/recipes/upload_spec.rb +8 -8
- data/spec/ey/rollback_spec.rb +13 -13
- data/spec/ey/scp_spec.rb +6 -6
- data/spec/ey/servers_spec.rb +49 -49
- data/spec/ey/ssh_spec.rb +14 -14
- data/spec/ey/status_spec.rb +21 -21
- data/spec/ey/timeout_deploy_spec.rb +3 -3
- data/spec/ey/web/disable_spec.rb +1 -1
- data/spec/ey/web/enable_spec.rb +2 -2
- data/spec/ey/web/restart_spec.rb +1 -1
- data/spec/ey/whoami_spec.rb +5 -5
- data/spec/support/shared_behavior.rb +30 -30
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db1c2f9e038b686249fa2d9de438e2a4b15b97e5
|
4
|
+
data.tar.gz: 812ae3efa8e5b4548ef34740ccf76e4f1121a0ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8e2f9e4d93b5482a9901c5f0074ff19a9ec27d417b2137024894b1ffc21a67dd3a2ffa0bc4d25adec738f9ddb597d4b22217527bc8c056145fe9aae1d5ce577
|
7
|
+
data.tar.gz: bdb090c43460f0e3bbf695f8229485633052456a390e5239377a1a6a162631c5289de1b9506d496026f384c35965261f291d52714c7b38661194e6de5923d0a5
|
data/lib/engineyard/version.rb
CHANGED
@@ -4,19 +4,19 @@ require 'engineyard/cli'
|
|
4
4
|
describe EY::CLI::API do
|
5
5
|
it "gets the api token from ~/.eyrc if possible" do
|
6
6
|
write_eyrc({"api_token" => "asdf"})
|
7
|
-
EY::CLI::API.new('http://fake.local', EY::CLI::UI.new).token.
|
7
|
+
expect(EY::CLI::API.new('http://fake.local', EY::CLI::UI.new).token).to eq("asdf")
|
8
8
|
clean_eyrc
|
9
9
|
end
|
10
10
|
|
11
11
|
it "uses the token specified token over the ENV token if passed" do
|
12
12
|
ENV['ENGINEYARD_API_TOKEN'] = 'envtoken'
|
13
|
-
EY::CLI::API.new('http://fake.local', EY::CLI::UI.new, 'specifiedtoken').token.
|
13
|
+
expect(EY::CLI::API.new('http://fake.local', EY::CLI::UI.new, 'specifiedtoken').token).to eq('specifiedtoken')
|
14
14
|
ENV.delete('ENGINEYARD_API_TOKEN')
|
15
15
|
end
|
16
16
|
|
17
17
|
it "uses the token from $ENGINEYARD_API_TOKEN if set" do
|
18
18
|
ENV['ENGINEYARD_API_TOKEN'] = 'envtoken'
|
19
|
-
EY::CLI::API.new('http://fake.local', EY::CLI::UI.new).token.
|
19
|
+
expect(EY::CLI::API.new('http://fake.local', EY::CLI::UI.new).token).to eq('envtoken')
|
20
20
|
ENV.delete('ENGINEYARD_API_TOKEN')
|
21
21
|
end
|
22
22
|
|
@@ -35,15 +35,15 @@ describe EY::CLI::API do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it "asks you for your credentials" do
|
38
|
-
EY::CLI::UI::Prompter.questions.
|
38
|
+
expect(EY::CLI::UI::Prompter.questions).to eq(["Email: ","Password: "])
|
39
39
|
end
|
40
40
|
|
41
41
|
it "gets the api token" do
|
42
|
-
@api.token.
|
42
|
+
expect(@api.token).to eq("asdf")
|
43
43
|
end
|
44
44
|
|
45
45
|
it "saves the api token to ~/.eyrc" do
|
46
|
-
read_eyrc.
|
46
|
+
expect(read_eyrc).to eq({"api_token" => "asdf"})
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
data/spec/engineyard/cli_spec.rb
CHANGED
@@ -8,9 +8,9 @@ describe EY::CLI do
|
|
8
8
|
EY::CLI.start(["help"])
|
9
9
|
end
|
10
10
|
|
11
|
-
out.
|
12
|
-
out.
|
13
|
-
out.
|
11
|
+
expect(out).to include("ey deploy")
|
12
|
+
expect(out).to include("ey ssh")
|
13
|
+
expect(out).to include("ey web enable")
|
14
14
|
end
|
15
15
|
|
16
16
|
it "delegates help" do
|
@@ -18,11 +18,11 @@ describe EY::CLI do
|
|
18
18
|
EY::CLI.start(%w[help web enable])
|
19
19
|
end
|
20
20
|
|
21
|
-
out.
|
21
|
+
expect(out).to match(/remove the maintenance page/i)
|
22
22
|
end
|
23
23
|
|
24
24
|
it "provides error classes" do
|
25
|
-
EY::DeployArgumentError.
|
25
|
+
expect(EY::DeployArgumentError).to be
|
26
26
|
end
|
27
27
|
|
28
28
|
end # EY::CLI
|
@@ -7,12 +7,12 @@ describe EY::Config do
|
|
7
7
|
|
8
8
|
it "get loaded from the config file" do
|
9
9
|
write_yaml({"environments" => {"production" => {"default" => true}}}, 'ey.yml')
|
10
|
-
EY::Config.new.environments["production"]["default"].
|
10
|
+
expect(EY::Config.new.environments["production"]["default"]).to be_truthy
|
11
11
|
end
|
12
12
|
|
13
13
|
it "are present when the config file has no environments key" do
|
14
14
|
write_yaml({}, 'ey.yml')
|
15
|
-
EY::Config.new.environments.
|
15
|
+
expect(EY::Config.new.environments).to eq({})
|
16
16
|
end
|
17
17
|
|
18
18
|
it "rases an error when yaml produces an unexpected result" do
|
@@ -22,18 +22,18 @@ describe EY::Config do
|
|
22
22
|
|
23
23
|
it "doesnt crash on nil environment" do
|
24
24
|
write_yaml({"environments" => {"production" => nil}}, 'ey.yml')
|
25
|
-
EY::Config.new.default_environment.
|
25
|
+
expect(EY::Config.new.default_environment).to be_nil
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
describe "endpoint" do
|
30
30
|
it "defaults to production Engine Yard Cloud" do
|
31
|
-
EY::Config.new.endpoint.
|
31
|
+
expect(EY::Config.new.endpoint).to eq(EY::Config.new.default_endpoint)
|
32
32
|
end
|
33
33
|
|
34
34
|
it "loads the endpoint from $CLOUD_URL" do
|
35
35
|
ENV['CLOUD_URL'] = "http://fake.local/"
|
36
|
-
EY::Config.new.endpoint.
|
36
|
+
expect(EY::Config.new.endpoint).to eq('http://fake.local/')
|
37
37
|
ENV.delete('CLOUD_URL')
|
38
38
|
end
|
39
39
|
end
|
@@ -44,7 +44,7 @@ describe EY::Config do
|
|
44
44
|
|
45
45
|
write_yaml({"environments" => {"staging" => {"default" => true}}}, "ey.yml")
|
46
46
|
write_yaml({"environments" => {"production" => {"default" => true}}}, "config/ey.yml")
|
47
|
-
EY::Config.new.default_environment.
|
47
|
+
expect(EY::Config.new.default_environment).to eq("production")
|
48
48
|
|
49
49
|
File.unlink('config/ey.yml') if File.exist?('config/ey.yml')
|
50
50
|
File.unlink('ey.yml') if File.exist?('ey.yml')
|
@@ -53,7 +53,7 @@ describe EY::Config do
|
|
53
53
|
it "looks for ey.yml" do
|
54
54
|
write_yaml({"environments" => {"staging" => {"default" => true}}}, "ey.yml")
|
55
55
|
|
56
|
-
EY::Config.new.default_environment.
|
56
|
+
expect(EY::Config.new.default_environment).to eq("staging")
|
57
57
|
|
58
58
|
File.unlink('ey.yml') if File.exist?('ey.yml')
|
59
59
|
end
|
@@ -31,20 +31,20 @@ describe EY::DeployConfig do
|
|
31
31
|
context "with the migrate cli option" do
|
32
32
|
it "returns default command when true" do
|
33
33
|
dc = deploy_config({'migrate' => true})
|
34
|
-
dc.migrate.
|
34
|
+
expect(dc.migrate).to be_truthy
|
35
35
|
expect { dc.migrate_command }.to raise_error(EY::Error, /'migration_command' not found/)
|
36
36
|
end
|
37
37
|
|
38
38
|
it "returns false when nil" do
|
39
39
|
dc = deploy_config({'migrate' => nil})
|
40
|
-
dc.migrate.
|
41
|
-
dc.migrate_command.
|
40
|
+
expect(dc.migrate).to be_falsey
|
41
|
+
expect(dc.migrate_command).to be_nil
|
42
42
|
end
|
43
43
|
|
44
44
|
it "return the custom migration command when is a string" do
|
45
45
|
dc = deploy_config({'migrate' => 'foo migrate'})
|
46
|
-
dc.migrate.
|
47
|
-
dc.migrate_command.
|
46
|
+
expect(dc.migrate).to be_truthy
|
47
|
+
expect(dc.migrate_command).to eq('foo migrate')
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -52,47 +52,47 @@ describe EY::DeployConfig do
|
|
52
52
|
it "return the migration command when the option is true" do
|
53
53
|
env = env_config('migrate' => true, 'migration_command' => 'bar migrate')
|
54
54
|
dc = deploy_config({}, env)
|
55
|
-
dc.migrate.
|
56
|
-
dc.migrate_command.
|
55
|
+
expect(dc.migrate).to be_truthy
|
56
|
+
expect(dc.migrate_command).to eq('bar migrate')
|
57
57
|
end
|
58
58
|
|
59
59
|
it "return the false when migrate is false" do
|
60
60
|
env = env_config('migrate' => false, 'migration_command' => 'bar migrate')
|
61
61
|
dc = deploy_config({}, env)
|
62
|
-
dc.migrate.
|
63
|
-
dc.migrate_command.
|
62
|
+
expect(dc.migrate).to be_falsey
|
63
|
+
expect(dc.migrate_command).to be_nil
|
64
64
|
end
|
65
65
|
|
66
66
|
it "tells you to run ey init" do
|
67
67
|
env = env_config('migrate' => true)
|
68
68
|
dc = deploy_config({}, env)
|
69
|
-
expect(dc.migrate).to
|
69
|
+
expect(dc.migrate).to be_truthy
|
70
70
|
expect { dc.migrate_command }.to raise_error(EY::Error, /'migration_command' not found/)
|
71
71
|
end
|
72
72
|
|
73
73
|
it "return the ey.yml migration_command when command line option --migrate is passed" do
|
74
74
|
env = env_config('migrate' => false, 'migration_command' => 'bar migrate')
|
75
75
|
dc = deploy_config({'migrate' => true}, env)
|
76
|
-
dc.migrate.
|
77
|
-
dc.migrate_command.
|
76
|
+
expect(dc.migrate).to be_truthy
|
77
|
+
expect(dc.migrate_command).to eq('bar migrate')
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
81
|
describe "ref" do
|
82
82
|
it "returns the passed ref" do
|
83
|
-
deploy_config({'ref' => 'master'}).ref.
|
83
|
+
expect(deploy_config({'ref' => 'master'}).ref).to eq('master')
|
84
84
|
end
|
85
85
|
|
86
86
|
it "returns the passed force_ref" do
|
87
|
-
deploy_config({'force_ref' => 'force'}).ref.
|
87
|
+
expect(deploy_config({'force_ref' => 'force'}).ref).to eq('force')
|
88
88
|
end
|
89
89
|
|
90
90
|
it "returns the ref if force_ref is true" do
|
91
|
-
deploy_config({'ref' => 'master', 'force_ref' => true}).ref.
|
91
|
+
expect(deploy_config({'ref' => 'master', 'force_ref' => true}).ref).to eq('master')
|
92
92
|
end
|
93
93
|
|
94
94
|
it "overrides the ref if force_ref is set to a string" do
|
95
|
-
deploy_config({'ref' => 'master', 'force_ref' => 'force'}).ref.
|
95
|
+
expect(deploy_config({'ref' => 'master', 'force_ref' => 'force'}).ref).to eq('force')
|
96
96
|
end
|
97
97
|
|
98
98
|
context "with a default branch" do
|
@@ -100,41 +100,41 @@ describe EY::DeployConfig do
|
|
100
100
|
|
101
101
|
it "uses the configured default if ref is not passed" do
|
102
102
|
out = capture_stdout do
|
103
|
-
deploy_config({}).ref.
|
103
|
+
expect(deploy_config({}).ref).to eq('default')
|
104
104
|
end
|
105
|
-
out.
|
105
|
+
expect(out).to match(/Using default branch "default" from ey.yml/)
|
106
106
|
end
|
107
107
|
|
108
108
|
it "raises if a default is set and --ref is passed on the cli (and they don't match)" do
|
109
|
-
|
109
|
+
expect { deploy_config({'ref' => 'master'}).ref }.to raise_error(EY::BranchMismatchError)
|
110
110
|
end
|
111
111
|
|
112
112
|
it "returns the default if a default is set and --ref is the same" do
|
113
|
-
deploy_config({'ref' => 'default'}).ref.
|
113
|
+
expect(deploy_config({'ref' => 'default'}).ref).to eq('default')
|
114
114
|
end
|
115
115
|
|
116
116
|
it "returns the ref if force_ref is set" do
|
117
117
|
out = capture_stdout do
|
118
|
-
deploy_config({'ref' => 'master', 'force_ref' => true}).ref.
|
118
|
+
expect(deploy_config({'ref' => 'master', 'force_ref' => true}).ref).to eq('master')
|
119
119
|
end
|
120
|
-
out.
|
120
|
+
expect(out).to match(/Default ref overridden with "master"/)
|
121
121
|
end
|
122
122
|
|
123
123
|
it "returns the ref if force_ref is a branch" do
|
124
124
|
out = capture_stdout do
|
125
|
-
deploy_config({'force_ref' => 'master'}).ref.
|
125
|
+
expect(deploy_config({'force_ref' => 'master'}).ref).to eq('master')
|
126
126
|
end
|
127
|
-
out.
|
127
|
+
expect(out).to match(/Default ref overridden with "master"/)
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
131
|
context "no options, no default" do
|
132
132
|
it "uses the repo's current branch" do
|
133
|
-
repo.
|
133
|
+
expect(repo).to receive(:current_branch).and_return('current')
|
134
134
|
out = capture_stdout do
|
135
|
-
deploy_config({}).ref.
|
135
|
+
expect(deploy_config({}).ref).to eq('current')
|
136
136
|
end
|
137
|
-
out.
|
137
|
+
expect(out).to match(/Using current HEAD branch "current"/)
|
138
138
|
end
|
139
139
|
end
|
140
140
|
end
|
@@ -144,50 +144,50 @@ describe EY::DeployConfig do
|
|
144
144
|
describe "migrate" do
|
145
145
|
it "returns the default migration command when migrate is true" do
|
146
146
|
dc = deploy_config({'app' => 'app', 'migrate' => true})
|
147
|
-
dc.migrate.
|
148
|
-
dc.migrate_command.
|
147
|
+
expect(dc.migrate).to be_truthy
|
148
|
+
expect(dc.migrate_command).to eq('rake db:migrate --trace')
|
149
149
|
end
|
150
150
|
|
151
151
|
it "returns false when nil" do
|
152
152
|
dc = deploy_config({'app' => 'app', 'migrate' => nil})
|
153
|
-
dc.migrate.
|
154
|
-
dc.migrate_command.
|
153
|
+
expect(dc.migrate).to be_falsey
|
154
|
+
expect(dc.migrate_command).to be_nil
|
155
155
|
end
|
156
156
|
|
157
157
|
it "return the custom migration command when is a string" do
|
158
158
|
dc = deploy_config({'app' => 'app', 'migrate' => 'foo migrate'})
|
159
|
-
dc.migrate.
|
160
|
-
dc.migrate_command.
|
159
|
+
expect(dc.migrate).to be_truthy
|
160
|
+
expect(dc.migrate_command).to eq('foo migrate')
|
161
161
|
end
|
162
162
|
|
163
163
|
it "raises if migrate is not passed" do
|
164
|
-
|
164
|
+
expect { deploy_config({'app' => 'app'}).migrate }.to raise_error(EY::RefAndMigrateRequiredOutsideRepo)
|
165
165
|
end
|
166
166
|
end
|
167
167
|
|
168
168
|
describe "ref" do
|
169
169
|
it "returns the passed ref" do
|
170
170
|
dc = deploy_config({'app' => 'app', 'ref' => 'master'})
|
171
|
-
dc.ref.
|
171
|
+
expect(dc.ref).to eq('master')
|
172
172
|
end
|
173
173
|
|
174
174
|
it "returns the passed force_ref" do
|
175
175
|
dc = deploy_config({'app' => 'app', 'force_ref' => 'force'})
|
176
|
-
dc.ref.
|
176
|
+
expect(dc.ref).to eq('force')
|
177
177
|
end
|
178
178
|
|
179
179
|
it "returns the ref if force_ref is true" do
|
180
180
|
dc = deploy_config({'app' => 'app', 'ref' => 'master', 'force_ref' => true})
|
181
|
-
dc.ref.
|
181
|
+
expect(dc.ref).to eq('master')
|
182
182
|
end
|
183
183
|
|
184
184
|
it "overrides the ref if force_ref is set to a string" do
|
185
185
|
dc = deploy_config({'app' => 'app', 'ref' => 'master', 'force_ref' => 'force'})
|
186
|
-
dc.ref.
|
186
|
+
expect(dc.ref).to eq('force')
|
187
187
|
end
|
188
188
|
|
189
189
|
it "raises if ref is not passed" do
|
190
|
-
|
190
|
+
expect { deploy_config({'app' => 'app'}).ref }.to raise_error(EY::RefAndMigrateRequiredOutsideRepo)
|
191
191
|
end
|
192
192
|
end
|
193
193
|
end
|
@@ -6,27 +6,27 @@ describe EY::EYRC do
|
|
6
6
|
|
7
7
|
describe ".load" do
|
8
8
|
it "looks for .eyrc in $EYRC if set" do
|
9
|
-
EY::EYRC.load.path.
|
9
|
+
expect(EY::EYRC.load.path).to eq(Pathname.new(ENV['EYRC']))
|
10
10
|
end
|
11
11
|
|
12
12
|
it "looks for .eyrc in $HOME/.eyrc by default" do
|
13
13
|
ENV.delete('EYRC')
|
14
|
-
EY::EYRC.load.path.
|
14
|
+
expect(EY::EYRC.load.path).to eq(Pathname.new("#{ENV['HOME']}/.eyrc"))
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
18
|
describe ".new" do
|
19
19
|
it "looks for eyrc in any passed file location" do
|
20
|
-
EY::EYRC.new('/tmp/neweyrc').path.
|
20
|
+
expect(EY::EYRC.new('/tmp/neweyrc').path).to eq(Pathname.new('/tmp/neweyrc'))
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
context "with a non-existing .eyrc file" do
|
25
25
|
it "has nil api_token" do
|
26
|
-
File.exists?("/tmp/nonexistant").
|
26
|
+
expect(File.exists?("/tmp/nonexistant")).to be_falsey
|
27
27
|
eyrc = EY::EYRC.new('/tmp/nonexistant')
|
28
|
-
eyrc.exist
|
29
|
-
eyrc.api_token.
|
28
|
+
expect(eyrc.exist?).to be_falsey
|
29
|
+
expect(eyrc.api_token).to be_nil
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -36,20 +36,20 @@ describe EY::EYRC do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it "exists" do
|
39
|
-
EY::EYRC.load.exist
|
39
|
+
expect(EY::EYRC.load.exist?).to be_truthy
|
40
40
|
end
|
41
41
|
|
42
42
|
it "recalls the api_token" do
|
43
|
-
EY::EYRC.load.api_token.
|
43
|
+
expect(EY::EYRC.load.api_token).to eq('abcd')
|
44
44
|
end
|
45
45
|
|
46
46
|
it "deletes the api_token" do
|
47
47
|
EY::EYRC.load.delete_api_token
|
48
|
-
EY::EYRC.load.api_token.
|
48
|
+
expect(EY::EYRC.load.api_token).to be_nil
|
49
49
|
end
|
50
50
|
|
51
51
|
it "writes the api_token to api_token: .eyrc" do
|
52
|
-
read_yaml(ENV['EYRC']).
|
52
|
+
expect(read_yaml(ENV['EYRC'])).to eq({"api_token" => "abcd"})
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -61,16 +61,16 @@ describe EY::EYRC do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
it "recalls the api_token" do
|
64
|
-
EY::EYRC.load.api_token.
|
64
|
+
expect(EY::EYRC.load.api_token).to eq('abcd')
|
65
65
|
end
|
66
66
|
|
67
67
|
it "deletes the api token safely on logout" do
|
68
68
|
EY::EYRC.load.delete_api_token
|
69
|
-
read_yaml(ENV['EYRC']).
|
69
|
+
expect(read_yaml(ENV['EYRC'])).to eq({"http://localhost/" => {"api_token" => "5678"}})
|
70
70
|
end
|
71
71
|
|
72
72
|
it "maintains other random info in the file" do
|
73
|
-
read_yaml(ENV['EYRC']).
|
73
|
+
expect(read_yaml(ENV['EYRC'])).to eq({"api_token" => "abcd", "http://localhost/" => {"api_token" => "5678"}})
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
@@ -23,34 +23,34 @@ describe EY::Repo do
|
|
23
23
|
|
24
24
|
describe ".new" do
|
25
25
|
it "creates a working repo object in a repo" do
|
26
|
-
EY::Repo.new.remotes.
|
26
|
+
expect(EY::Repo.new.remotes).to be_empty
|
27
27
|
end
|
28
28
|
|
29
29
|
it "doesn't raise if created outside a repository until trying to do something" do
|
30
30
|
ENV['GIT_DIR'] = nil
|
31
31
|
Dir.chdir('/tmp') do
|
32
32
|
repo = EY::Repo.new
|
33
|
-
|
33
|
+
expect { repo.remotes }.to raise_error(EY::Repo::NotAGitRepository)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
describe ".exist?" do
|
39
39
|
it "is true when env vars are set to a repo" do
|
40
|
-
EY::Repo.
|
40
|
+
expect(EY::Repo).to be_exist
|
41
41
|
end
|
42
42
|
|
43
43
|
it "is true when pwd is a repo" do
|
44
44
|
Dir.chdir(File.dirname(ENV['GIT_DIR'])) do
|
45
45
|
ENV['GIT_DIR'] = nil
|
46
|
-
EY::Repo.
|
46
|
+
expect(EY::Repo).to be_exist
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
50
|
it "is false when outside of any repo" do
|
51
51
|
ENV['GIT_DIR'] = nil
|
52
52
|
Dir.chdir('/tmp') do
|
53
|
-
EY::Repo.
|
53
|
+
expect(EY::Repo).not_to be_exist
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -64,18 +64,18 @@ describe EY::Repo do
|
|
64
64
|
describe "current_branch method" do
|
65
65
|
it "returns the name of the current branch" do
|
66
66
|
set_head "ref: refs/heads/master"
|
67
|
-
@repo.current_branch.
|
67
|
+
expect(@repo.current_branch).to eq("master")
|
68
68
|
end
|
69
69
|
|
70
70
|
it "returns nil if there is no current branch" do
|
71
71
|
set_head "20bf478ab6a91ec5771130aa4c8cfd3d150c4146"
|
72
|
-
@repo.current_branch.
|
72
|
+
expect(@repo.current_branch).to be_nil
|
73
73
|
end
|
74
74
|
end # current_branch
|
75
75
|
|
76
76
|
describe "#fail_on_no_remotes!" do
|
77
77
|
it "raises when there are no remotes" do
|
78
|
-
|
78
|
+
expect { @repo.fail_on_no_remotes! }.to raise_error(EY::Repo::NoRemotesError)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|