contentful_bootstrap 3.5.0 → 3.5.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/contentful_bootstrap.gemspec +1 -0
- data/lib/contentful/bootstrap/commands/create_space.rb +3 -2
- data/lib/contentful/bootstrap/version.rb +1 -1
- data/spec/contentful/bootstrap/commands/create_space_spec.rb +21 -0
- data/spec/fixtures/ini_fixtures/no_org.ini +2 -0
- data/spec/fixtures/vcr_fixtures/multiple_organizations.yml +50850 -0
- data/spec/spec_helper.rb +3 -0
- metadata +21 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a980f96add79c447bc7c0fefe9a9adf6ca7a0a2
|
4
|
+
data.tar.gz: c985777812c51b5ea56cbb72b408dc4084c4fd37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98d0f125902b0f630e68d221cc1d1f46e8e10bc4d8269053b8900a3b8cf6860a0ddc7734203672ae5e38cf95aaa57c07342b128a808ebc4a4dc6a3d778fe09e5
|
7
|
+
data.tar.gz: 0efd66ede3afb522c91aeea013097e7a638ac5e68ea9d0b38da2c28b1b722523e1e077848c5e09c5658b4f8841d948547aaafbbe7e9f7dedc83ba6ae81c91467
|
data/CHANGELOG.md
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "vcr", '~> 2.9'
|
25
25
|
spec.add_development_dependency "webmock", '~> 1.24'
|
26
26
|
spec.add_development_dependency "rr"
|
27
|
+
spec.add_development_dependency "simplecov"
|
27
28
|
spec.add_development_dependency "guard"
|
28
29
|
spec.add_development_dependency "guard-rspec"
|
29
30
|
spec.add_development_dependency 'listen', '~> 3.0.0'
|
@@ -48,6 +48,7 @@ module Contentful
|
|
48
48
|
name: @space
|
49
49
|
}
|
50
50
|
options[:organization_id] = @token.read_organization_id unless @token.read_organization_id.nil?
|
51
|
+
management_client_init
|
51
52
|
new_space = client.spaces.create(options)
|
52
53
|
rescue Contentful::Management::NotFound
|
53
54
|
fail "Organization ID is required, provide it in Configuration File" if no_input
|
@@ -71,9 +72,9 @@ module Contentful
|
|
71
72
|
private
|
72
73
|
|
73
74
|
def organizations
|
74
|
-
|
75
|
+
management_client_init
|
75
76
|
url = client.base_url.sub('spaces', 'token')
|
76
|
-
response = client.get_http(url, nil, client.request_headers)
|
77
|
+
response = client.class.get_http(url, nil, client.request_headers)
|
77
78
|
organization_ids = JSON.load(response.body.to_s)['includes']['Organization'].map do |org|
|
78
79
|
sprintf('%-20s %s', org['name'], org['sys']['id'])
|
79
80
|
end
|
@@ -85,6 +85,27 @@ describe Contentful::Bootstrap::Commands::CreateSpace do
|
|
85
85
|
command.run
|
86
86
|
}
|
87
87
|
end
|
88
|
+
|
89
|
+
it 'doesnt fail on multiple organizations #54' do
|
90
|
+
vcr('multiple_organizations') {
|
91
|
+
path = File.expand_path(File.join('spec', 'fixtures', 'ini_fixtures', 'no_org.ini'))
|
92
|
+
token = Contentful::Bootstrap::Token.new path
|
93
|
+
|
94
|
+
allow(Contentful::Bootstrap::Support).to receive(:gets).and_return('y')
|
95
|
+
allow(Contentful::Bootstrap::Support).to receive(:gets).and_return('n')
|
96
|
+
subject = described_class.new token, 'foo', quiet: true
|
97
|
+
|
98
|
+
expect(subject).to receive(:generate_token).with(space_double)
|
99
|
+
expect(Contentful::Bootstrap::Support).to receive(:gets) { 'foobar' }
|
100
|
+
expect(token).to receive(:write_organization_id).with('foobar')
|
101
|
+
expect(subject.client).to receive(:spaces).and_call_original
|
102
|
+
space_proxy_double = Object.new
|
103
|
+
expect(subject.client).to receive(:spaces) { space_proxy_double }
|
104
|
+
expect(space_proxy_double).to receive(:create).with(name: 'foo', organization_id: 'foobar') { space_double }
|
105
|
+
|
106
|
+
subject.run
|
107
|
+
}
|
108
|
+
end
|
88
109
|
end
|
89
110
|
|
90
111
|
describe 'integration' do
|