zanzibar 0.1.13 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +3 -0
- data/.rspec +1 -1
- data/.rubocop.yml +5 -0
- data/Gemfile +0 -13
- data/README.md +68 -6
- data/Rakefile +11 -11
- data/bin/zamioculcas +3 -1
- data/bin/zanzibar +2 -68
- data/lib/zanzibar/actions/base.rb +27 -0
- data/lib/zanzibar/actions/bundle.rb +119 -0
- data/lib/zanzibar/actions/get.rb +61 -0
- data/lib/zanzibar/actions/init.rb +40 -0
- data/lib/zanzibar/actions.rb +3 -0
- data/lib/zanzibar/cli.rb +126 -0
- data/lib/zanzibar/defaults.rb +14 -0
- data/lib/zanzibar/error.rb +6 -0
- data/lib/zanzibar/ui.rb +42 -0
- data/lib/zanzibar/version.rb +4 -3
- data/lib/zanzibar.rb +190 -190
- data/spec/files/.gitignore +1 -0
- data/spec/files/Zanzifile +11 -0
- data/spec/files/scrt.wsdl +629 -0
- data/spec/lib/zanzibar/actions/bundle_spec.rb +95 -0
- data/spec/lib/zanzibar/actions/get_spec.rb +64 -0
- data/spec/lib/zanzibar/actions/init_spec.rb +53 -0
- data/spec/lib/zanzibar/version_spec.rb +12 -0
- data/spec/{zanzibar_spec.rb → lib/zanzibar_spec.rb} +116 -123
- data/spec/spec_helper.rb +37 -0
- data/templates/Zanzifile.erb +11 -0
- data/zanzibar.gemspec +12 -4
- metadata +142 -19
- data/spec/spec/spec_helper.rb +0 -95
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'zanzibar/cli'
|
2
|
+
require 'zanzibar/defaults'
|
3
|
+
require 'rspec'
|
4
|
+
require 'fakefs/spec_helpers'
|
5
|
+
require 'webmock'
|
6
|
+
require 'rspec'
|
7
|
+
require 'webmock/rspec'
|
8
|
+
|
9
|
+
include WebMock::API
|
10
|
+
|
11
|
+
describe Zanzibar::Cli do
|
12
|
+
include FakeFS::SpecHelpers
|
13
|
+
|
14
|
+
describe '#bundle' do
|
15
|
+
context 'when Zanzifile already exists' do
|
16
|
+
before(:each) do
|
17
|
+
spec_root = File.join(source_root, 'spec')
|
18
|
+
response_root = File.join(spec_root, 'responses')
|
19
|
+
wsdl = File.join(spec_root, 'scrt.wsdl')
|
20
|
+
files = File.join(spec_root, 'files')
|
21
|
+
|
22
|
+
FakeFS::FileSystem.clone response_root
|
23
|
+
FakeFS::FileSystem.clone wsdl
|
24
|
+
FakeFS::FileSystem.clone files
|
25
|
+
|
26
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
27
|
+
.to_return(body: AUTH_XML, status: 200).then
|
28
|
+
.to_return(body: SECRET_WITH_KEY_XML, status: 200).then
|
29
|
+
.to_return(body: PRIVATE_KEY_XML, status: 200)
|
30
|
+
|
31
|
+
Dir.chdir File.join(source_root, 'spec', 'files')
|
32
|
+
end
|
33
|
+
|
34
|
+
before(:all) do
|
35
|
+
ENV['ZANZIBAR_PASSWORD'] = 'password'
|
36
|
+
end
|
37
|
+
|
38
|
+
after(:all) do
|
39
|
+
ENV.delete 'ZANZIBAR_PASSWORD'
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should have a Zanzifile' do
|
43
|
+
expect(FakeFS::FileTest.file? Zanzibar::ZANZIFILE_NAME).to be(true)
|
44
|
+
expect(File.read(Zanzibar::ZANZIFILE_NAME)).to include('zanzitest')
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should download a file' do
|
48
|
+
expect(FakeFS::FileTest.file? File.join('secrets', 'zanzi_key')).to be(false)
|
49
|
+
expect { subject.bundle }.to output(/Finished downloading secrets/).to_stdout
|
50
|
+
expect(FakeFS::FileTest.file? File.join('secrets', 'zanzi_key')).to be(true)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should create a resolved file' do
|
54
|
+
expect(FakeFS::FileTest.file? Zanzibar::RESOLVED_NAME).to be(false)
|
55
|
+
expect { subject.bundle }.to output(/Finished downloading secrets/).to_stdout
|
56
|
+
expect(FakeFS::FileTest.file? Zanzibar::RESOLVED_NAME).to be(true)
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should not redownload files it already has' do
|
60
|
+
expect { subject.bundle }.to output(/Finished downloading secrets/).to_stdout
|
61
|
+
expect(WebMock).to have_requested(:post, 'https://www.zanzitest.net/webservices/sswebservice.asmx').times(3)
|
62
|
+
|
63
|
+
WebMock.reset!
|
64
|
+
|
65
|
+
expect { subject.bundle }.to output(/Finished downloading secrets/).to_stdout
|
66
|
+
expect(WebMock).not_to have_requested(:post, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should redownload on update action' do
|
70
|
+
expect { subject.bundle }.to output(/Finished downloading secrets/).to_stdout
|
71
|
+
expect(WebMock).to have_requested(:post, 'https://www.zanzitest.net/webservices/sswebservice.asmx').times(3)
|
72
|
+
|
73
|
+
WebMock.reset!
|
74
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
75
|
+
.to_return(body: AUTH_XML, status: 200).then
|
76
|
+
.to_return(body: SECRET_WITH_KEY_XML, status: 200).then
|
77
|
+
.to_return(body: PRIVATE_KEY_XML, status: 200)
|
78
|
+
|
79
|
+
expect { subject.update }.to output(/Finished downloading secrets/).to_stdout
|
80
|
+
expect(WebMock).to have_requested(:post, 'https://www.zanzitest.net/webservices/sswebservice.asmx').times(3)
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should reject a malformed Zanzifile' do
|
84
|
+
File.write('Zanzifile', 'broken YAML')
|
85
|
+
expect { subject.bundle }.to raise_error.with_message(/#{Zanzibar::INVALID_ZANZIFILE_ERROR}/)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
context 'when Zanzifile does not exist' do
|
90
|
+
it 'should return an error' do
|
91
|
+
expect { subject.bundle }.to raise_error.with_message(/#{Zanzibar::NO_ZANZIFILE_ERROR}/)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'zanzibar/cli'
|
2
|
+
require 'rspec'
|
3
|
+
require 'fakefs/spec_helpers'
|
4
|
+
require 'webmock'
|
5
|
+
require 'rspec'
|
6
|
+
require 'webmock/rspec'
|
7
|
+
require 'zanzibar/defaults'
|
8
|
+
|
9
|
+
include WebMock::API
|
10
|
+
|
11
|
+
describe Zanzibar::Cli do
|
12
|
+
include FakeFS::SpecHelpers
|
13
|
+
|
14
|
+
describe '#get' do
|
15
|
+
before(:each) do
|
16
|
+
spec_root = File.join(source_root, 'spec')
|
17
|
+
response_root = File.join(spec_root, 'responses')
|
18
|
+
wsdl = File.join(spec_root, 'scrt.wsdl')
|
19
|
+
files = File.join(spec_root, 'files')
|
20
|
+
|
21
|
+
FakeFS::FileSystem.clone response_root
|
22
|
+
FakeFS::FileSystem.clone wsdl
|
23
|
+
FakeFS::FileSystem.clone files
|
24
|
+
|
25
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
26
|
+
.to_return(body: AUTH_XML, status: 200).then
|
27
|
+
.to_return(body: SECRET_XML, status: 200)
|
28
|
+
|
29
|
+
Dir.chdir File.join(source_root, 'spec', 'files')
|
30
|
+
end
|
31
|
+
|
32
|
+
before(:all) do
|
33
|
+
ENV['ZANZIBAR_PASSWORD'] = 'password'
|
34
|
+
end
|
35
|
+
|
36
|
+
after(:all) do
|
37
|
+
ENV.delete 'ZANZIBAR_PASSWORD'
|
38
|
+
WebMock.reset!
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should print a password to stdout' do
|
42
|
+
subject.options = { 'domain' => 'zanzitest.net', 'wsdl' => 'scrt.wsdl' }
|
43
|
+
expect { subject.get(1234) }.to output(/zanziUserPassword/).to_stdout
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'should require a wsdl' do
|
47
|
+
expect { subject.get(1234) }.to raise_error.with_message(/#{Zanzibar::NO_WSDL_ERROR}/)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should be able to download files' do
|
51
|
+
WebMock.reset!
|
52
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
53
|
+
.to_return(body: AUTH_XML, status: 200).then
|
54
|
+
.to_return(body: SECRET_WITH_KEY_XML, status: 200).then
|
55
|
+
.to_return(body: PRIVATE_KEY_XML, status: 200)
|
56
|
+
|
57
|
+
subject.options = { 'domain' => 'zanzitest.net', 'wsdl' => 'scrt.wsdl', 'filelabel' => 'Private Key' }
|
58
|
+
|
59
|
+
expect(FakeFS::FileTest.file? 'zanzi_key').to be(false)
|
60
|
+
expect { subject.get(2345) }.to output(/zanzi_key/).to_stdout
|
61
|
+
expect(FakeFS::FileTest.file? 'zanzi_key')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'zanzibar/cli'
|
2
|
+
require 'zanzibar/defaults'
|
3
|
+
require 'rspec'
|
4
|
+
require 'fakefs/spec_helpers'
|
5
|
+
|
6
|
+
describe Zanzibar::Cli do
|
7
|
+
include FakeFS::SpecHelpers
|
8
|
+
|
9
|
+
describe '#init' do
|
10
|
+
before(:each) do
|
11
|
+
templates_root = File.join(source_root, 'templates')
|
12
|
+
FakeFS::FileSystem.clone templates_root
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when a file does not yet exist' do
|
16
|
+
it 'should create a template file' do
|
17
|
+
expect { subject.init }.to output(/has been created/).to_stdout
|
18
|
+
expect(FakeFS::FileTest.file? Zanzibar::ZANZIFILE_NAME).to be(true)
|
19
|
+
expect(File.read Zanzibar::ZANZIFILE_NAME).to match(/fill in your secrets/)
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'should accept settings as options' do
|
23
|
+
subject.options = { 'wsdl' => 'http://example.com/ss?wsdl',
|
24
|
+
'domain' => 'example.com',
|
25
|
+
'secretdir' => 'testfolderplzignore',
|
26
|
+
'ignoressl' => true }
|
27
|
+
|
28
|
+
expect { subject.init }.to output(/has been created/).to_stdout
|
29
|
+
contents = File.read Zanzibar::ZANZIFILE_NAME
|
30
|
+
expect(contents).to include('wsdl: http://example.com/ss?wsdl')
|
31
|
+
expect(contents).to include('domain: example.com')
|
32
|
+
expect(contents).to include('secret_dir: testfolderplzignore')
|
33
|
+
expect(contents).to include('ignore_ssl: true')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context 'when a file already exists' do
|
38
|
+
before(:each) { File.write(Zanzibar::ZANZIFILE_NAME, 'test value') }
|
39
|
+
|
40
|
+
it 'should not overwrite an existing file' do
|
41
|
+
expect { subject.init }.to raise_error.with_message(/#{Zanzibar::ALREADY_EXISTS_ERROR}/)
|
42
|
+
expect(File.read Zanzibar::ZANZIFILE_NAME).to eq('test value')
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should obey the force flag' do
|
46
|
+
subject.options = { 'force' => true }
|
47
|
+
|
48
|
+
expect { subject.init }.to output(/has been created/).to_stdout
|
49
|
+
expect(File.read Zanzibar::ZANZIFILE_NAME).to match('fill in your secrets')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'zanzibar/cli'
|
2
|
+
require 'zanzibar/version'
|
3
|
+
require 'zanzibar/defaults'
|
4
|
+
require 'rspec'
|
5
|
+
|
6
|
+
describe Zanzibar::Cli do
|
7
|
+
describe '#version' do
|
8
|
+
it 'should print the gem version' do
|
9
|
+
expect { subject.version }.to output(/#{Zanzibar::APPLICATION_NAME} Version/).to_stdout
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -1,123 +1,116 @@
|
|
1
|
-
require 'zanzibar'
|
2
|
-
require 'savon'
|
3
|
-
require 'webmock'
|
4
|
-
require 'rspec'
|
5
|
-
require 'webmock/rspec'
|
6
|
-
|
7
|
-
include WebMock::API
|
8
|
-
|
9
|
-
describe 'Zanzibar Test' do
|
10
|
-
client = Zanzibar::Zanzibar.new(domain: 'zanzitest.net', pwd: 'password', wsdl: 'spec/scrt.wsdl')
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
it 'should
|
20
|
-
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
21
|
-
.to_return(body:
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
.to_return(body:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
.to_return(body:
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
client = Zanzibar::Zanzibar.new(domain: 'zanzitest.net', wsdl: 'spec/scrt.wsdl')
|
118
|
-
expect(client.get_client_username).to eq(ENV['ZANZIBAR_USER'])
|
119
|
-
expect(client.get_client_password).to eq(ENV['ZANZIBAR_PASSWORD'])
|
120
|
-
ENV.delete 'ZANZIBAR_PASSWORD'
|
121
|
-
ENV.delete 'ZANZIBAR_USER'
|
122
|
-
end
|
123
|
-
end
|
1
|
+
require 'zanzibar'
|
2
|
+
require 'savon'
|
3
|
+
require 'webmock'
|
4
|
+
require 'rspec'
|
5
|
+
require 'webmock/rspec'
|
6
|
+
|
7
|
+
include WebMock::API
|
8
|
+
|
9
|
+
describe 'Zanzibar Test' do
|
10
|
+
client = Zanzibar::Zanzibar.new(domain: 'zanzitest.net', pwd: 'password', wsdl: 'spec/scrt.wsdl')
|
11
|
+
|
12
|
+
it 'should return an auth token' do
|
13
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
14
|
+
.to_return(body: AUTH_XML, status: 200)
|
15
|
+
|
16
|
+
expect(client.get_token).to eq('imatoken')
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should get a secret' do
|
20
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
21
|
+
.to_return(body: AUTH_XML, status: 200).then
|
22
|
+
.to_return(body: SECRET_XML, status: 200)
|
23
|
+
|
24
|
+
expect(client.get_secret(1234)[:secret][:name]).to eq('Zanzi Test Secret')
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should get a password' do
|
28
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
29
|
+
.to_return(body: AUTH_XML, status: 200).then
|
30
|
+
.to_return(body: SECRET_XML, status: 200)
|
31
|
+
|
32
|
+
expect(client.get_password(1234)).to eq('zanziUserPassword')
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should download a private key' do
|
36
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
37
|
+
.to_return(body: AUTH_XML, status: 200).then
|
38
|
+
.to_return(body: SECRET_WITH_KEY_XML, status: 200).then
|
39
|
+
.to_return(body: PRIVATE_KEY_XML, status: 200)
|
40
|
+
|
41
|
+
client.download_secret_file(scrt_id: 2345, type: 'Private Key')
|
42
|
+
expect(File.exist? 'zanzi_key')
|
43
|
+
expect(File.read('zanzi_key')).to eq("-----BEGIN RSA PRIVATE KEY -----\nzanzibarTestPassword\n-----END RSA PRIVATE KEY-----\n")
|
44
|
+
File.delete('zanzi_key')
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should download a private key legacy' do
|
48
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
49
|
+
.to_return(body: AUTH_XML, status: 200).then
|
50
|
+
.to_return(body: SECRET_WITH_KEY_XML, status: 200).then
|
51
|
+
.to_return(body: PRIVATE_KEY_XML, status: 200)
|
52
|
+
|
53
|
+
client.download_private_key(scrt_id: 2345)
|
54
|
+
expect(File.exist? 'zanzi_key')
|
55
|
+
expect(File.read('zanzi_key')).to eq("-----BEGIN RSA PRIVATE KEY -----\nzanzibarTestPassword\n-----END RSA PRIVATE KEY-----\n")
|
56
|
+
File.delete('zanzi_key')
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should download a public key' do
|
60
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
61
|
+
.to_return(body: AUTH_XML, status: 200).then
|
62
|
+
.to_return(body: SECRET_WITH_KEY_XML, status: 200).then
|
63
|
+
.to_return(body: PUBLIC_KEY_XML, status: 200)
|
64
|
+
|
65
|
+
client.download_secret_file(scrt_id: 2345, type: 'Public Key')
|
66
|
+
expect(File.exist? 'zanzi_key.pub')
|
67
|
+
expect(File.read('zanzi_key.pub')).to eq("1234PublicKey5678==\n")
|
68
|
+
File.delete('zanzi_key.pub')
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should download a public key legacy' do
|
72
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
73
|
+
.to_return(body: AUTH_XML, status: 200).then
|
74
|
+
.to_return(body: SECRET_WITH_KEY_XML, status: 200).then
|
75
|
+
.to_return(body: PUBLIC_KEY_XML, status: 200)
|
76
|
+
|
77
|
+
client.download_public_key(scrt_id: 2345)
|
78
|
+
expect(File.exist? 'zanzi_key.pub')
|
79
|
+
expect(File.read('zanzi_key.pub')).to eq("1234PublicKey5678==\n")
|
80
|
+
File.delete('zanzi_key.pub')
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should download an attachment' do
|
84
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
85
|
+
.to_return(body: AUTH_XML, status: 200).then
|
86
|
+
.to_return(body: SECRET_WITH_ATTACHMENT_XML, status: 200).then
|
87
|
+
.to_return(body: ATTACHMENT_XML, status: 200)
|
88
|
+
|
89
|
+
client.download_secret_file(scrt_id: 3456, type: 'Attachment')
|
90
|
+
expect(File.exist? 'attachment.txt')
|
91
|
+
expect(File.read('attachment.txt')).to eq("I am a secret attachment\n")
|
92
|
+
File.delete('attachment.txt')
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'should download an attachment legacy' do
|
96
|
+
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
97
|
+
.to_return(body: AUTH_XML, status: 200).then
|
98
|
+
.to_return(body: SECRET_WITH_ATTACHMENT_XML, status: 200).then
|
99
|
+
.to_return(body: ATTACHMENT_XML, status: 200)
|
100
|
+
|
101
|
+
client.download_attachment(scrt_id: 3456)
|
102
|
+
expect(File.exist? 'attachment.txt')
|
103
|
+
expect(File.read('attachment.txt')).to eq("I am a secret attachment\n")
|
104
|
+
File.delete('attachment.txt')
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'should use environment variables for credentials' do
|
108
|
+
ENV['ZANZIBAR_USER'] = 'environment_user'
|
109
|
+
ENV['ZANZIBAR_PASSWORD'] = 'environment_password'
|
110
|
+
client = Zanzibar::Zanzibar.new(domain: 'zanzitest.net', wsdl: 'spec/scrt.wsdl')
|
111
|
+
expect(client.get_client_username).to eq(ENV['ZANZIBAR_USER'])
|
112
|
+
expect(client.get_client_password).to eq(ENV['ZANZIBAR_PASSWORD'])
|
113
|
+
ENV.delete 'ZANZIBAR_PASSWORD'
|
114
|
+
ENV.delete 'ZANZIBAR_USER'
|
115
|
+
end
|
116
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
4
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
require 'webmock/rspec'
|
8
|
+
require 'codeclimate-test-reporter'
|
9
|
+
require 'simplecov'
|
10
|
+
CodeClimate::TestReporter.start
|
11
|
+
SimpleCov.start
|
12
|
+
|
13
|
+
RSpec.configure do |config|
|
14
|
+
config.expect_with :rspec do |expectations|
|
15
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
16
|
+
end
|
17
|
+
|
18
|
+
config.mock_with :rspec do |mocks|
|
19
|
+
mocks.verify_partial_doubles = true
|
20
|
+
end
|
21
|
+
|
22
|
+
config.after(:suite) do
|
23
|
+
WebMock.disable_net_connect!(allow: 'codeclimate.com')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def source_root
|
28
|
+
File.expand_path('../../', __FILE__)
|
29
|
+
end
|
30
|
+
|
31
|
+
AUTH_XML = File.read('spec/responses/authenticate_response.xml')
|
32
|
+
SECRET_XML = File.read('spec/responses/get_secret_response.xml')
|
33
|
+
SECRET_WITH_KEY_XML = File.read('spec/responses/get_secret_with_keys_response.xml')
|
34
|
+
SECRET_WITH_ATTACHMENT_XML = File.read('spec/responses/get_secret_with_attachment_response.xml')
|
35
|
+
PRIVATE_KEY_XML = File.read('spec/responses/download_private_key_response.xml')
|
36
|
+
PUBLIC_KEY_XML = File.read('spec/responses/download_public_key_response.xml')
|
37
|
+
ATTACHMENT_XML = File.read('spec/responses/attachment_response.xml')
|
data/zanzibar.gemspec
CHANGED
@@ -14,13 +14,21 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.license = 'Apache 2.0'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(
|
18
|
-
spec.test_files = spec.files.grep(
|
17
|
+
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'rubyntlm', '~> 0.4.0'
|
22
21
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
23
22
|
spec.add_development_dependency 'rake', '~> 10.0'
|
24
|
-
spec.add_development_dependency 'rubocop', '~>0.
|
23
|
+
spec.add_development_dependency 'rubocop', '~> 0.28.0'
|
24
|
+
spec.add_development_dependency 'savon_spec', '~> 0.1.6'
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.1.0'
|
26
|
+
spec.add_development_dependency 'webmock', '~> 1.20.4'
|
27
|
+
spec.add_development_dependency 'codeclimate-test-reporter'
|
28
|
+
spec.add_development_dependency 'fakefs', '~> 0.6.4'
|
29
|
+
spec.add_development_dependency 'simplecov', '~> 0.9.1'
|
30
|
+
|
25
31
|
spec.add_runtime_dependency 'savon', '~> 2.8.0'
|
32
|
+
spec.add_runtime_dependency 'rubyntlm', '~> 0.4.0'
|
33
|
+
spec.add_runtime_dependency 'thor', '~> 0.19.0'
|
26
34
|
end
|