contentful_bootstrap 1.6.0 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +26 -0
- data/.rubocop_todo.yml +123 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.md +25 -0
- data/Gemfile +1 -0
- data/Guardfile +5 -0
- data/README.md +40 -14
- data/Rakefile +7 -0
- data/bin/contentful_bootstrap +33 -22
- data/contentful_bootstrap.gemspec +7 -0
- data/lib/contentful/bootstrap.rb +7 -5
- data/lib/contentful/bootstrap/command_runner.rb +45 -0
- data/lib/contentful/bootstrap/commands.rb +3 -168
- data/lib/contentful/bootstrap/commands/base.rb +66 -0
- data/lib/contentful/bootstrap/commands/create_space.rb +111 -0
- data/lib/contentful/bootstrap/commands/generate_json.rb +41 -0
- data/lib/contentful/bootstrap/commands/generate_token.rb +52 -0
- data/lib/contentful/bootstrap/constants.rb +2 -2
- data/lib/contentful/bootstrap/generator.rb +94 -0
- data/lib/contentful/bootstrap/server.rb +25 -17
- data/lib/contentful/bootstrap/support.rb +3 -2
- data/lib/contentful/bootstrap/templates.rb +4 -4
- data/lib/contentful/bootstrap/templates/base.rb +51 -30
- data/lib/contentful/bootstrap/templates/blog.rb +33 -33
- data/lib/contentful/bootstrap/templates/catalogue.rb +103 -103
- data/lib/contentful/bootstrap/templates/gallery.rb +55 -56
- data/lib/contentful/bootstrap/templates/json_template.rb +22 -16
- data/lib/contentful/bootstrap/templates/links.rb +2 -2
- data/lib/contentful/bootstrap/templates/links/asset.rb +2 -2
- data/lib/contentful/bootstrap/templates/links/base.rb +3 -3
- data/lib/contentful/bootstrap/templates/links/entry.rb +2 -2
- data/lib/contentful/bootstrap/token.rb +32 -31
- data/lib/contentful/bootstrap/version.rb +1 -1
- data/spec/contentful/bootstrap/command_runner_spec.rb +111 -0
- data/spec/contentful/bootstrap/commands/base_spec.rb +102 -0
- data/spec/contentful/bootstrap/commands/create_space_spec.rb +72 -0
- data/spec/contentful/bootstrap/commands/generate_json_spec.rb +64 -0
- data/spec/contentful/bootstrap/commands/generate_token_spec.rb +82 -0
- data/spec/contentful/bootstrap/generator_spec.rb +15 -0
- data/spec/contentful/bootstrap/server_spec.rb +154 -0
- data/spec/contentful/bootstrap/support_spec.rb +27 -0
- data/spec/contentful/bootstrap/templates/base_spec.rb +34 -0
- data/spec/contentful/bootstrap/templates/blog_spec.rb +32 -0
- data/spec/contentful/bootstrap/templates/catalogue_spec.rb +40 -0
- data/spec/contentful/bootstrap/templates/gallery_spec.rb +40 -0
- data/spec/contentful/bootstrap/templates/json_template_spec.rb +52 -0
- data/spec/contentful/bootstrap/templates/links/asset_spec.rb +23 -0
- data/spec/contentful/bootstrap/templates/links/base_spec.rb +31 -0
- data/spec/contentful/bootstrap/templates/links/entry_spec.rb +23 -0
- data/spec/contentful/bootstrap/token_spec.rb +143 -0
- data/spec/fixtures/ini_fixtures/contentfulrc.ini +2 -0
- data/spec/fixtures/ini_fixtures/no_global.ini +2 -0
- data/spec/fixtures/ini_fixtures/no_token.ini +1 -0
- data/spec/fixtures/ini_fixtures/sections.ini +5 -0
- data/spec/fixtures/json_fixtures/issue_22.json +77 -0
- data/spec/fixtures/json_fixtures/simple.json +34 -0
- data/spec/fixtures/json_fixtures/wl1z0pal05vy.json +437 -0
- data/spec/fixtures/vcr_fixtures/generate_json.yml +384 -0
- data/spec/fixtures/vcr_fixtures/issue_22.yml +2488 -0
- data/spec/spec_helper.rb +51 -0
- metadata +167 -4
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class ResponseDouble
|
4
|
+
def object
|
5
|
+
{'accessToken' => 'foo'}
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class ErrorDouble < Contentful::Management::Error
|
10
|
+
def initialize
|
11
|
+
end
|
12
|
+
|
13
|
+
def object
|
14
|
+
self.class.new
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe Contentful::Bootstrap::Commands::GenerateToken do
|
19
|
+
let(:path) { File.expand_path(File.join('spec', 'fixtures', 'ini_fixtures', 'contentfulrc.ini')) }
|
20
|
+
let(:token) { Contentful::Bootstrap::Token.new path }
|
21
|
+
subject { Contentful::Bootstrap::Commands::GenerateToken.new token, 'foo', 'bar', false }
|
22
|
+
let(:space_double) { SpaceDouble.new }
|
23
|
+
|
24
|
+
describe 'instance methods' do
|
25
|
+
before do
|
26
|
+
subject.send(:management_client_init)
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#run' do
|
30
|
+
it 'fetches space from api if space is a string' do
|
31
|
+
allow(subject).to receive(:gets) { 'n' }
|
32
|
+
allow_any_instance_of(Contentful::Management::Request).to receive(:post) { ResponseDouble.new }
|
33
|
+
expect(Contentful::Management::Space).to receive(:find).with('foo') { space_double }
|
34
|
+
|
35
|
+
subject.run
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'uses space if space is not a string' do
|
39
|
+
allow(subject).to receive(:gets) { 'n' }
|
40
|
+
allow_any_instance_of(Contentful::Management::Request).to receive(:post) { ResponseDouble.new }
|
41
|
+
expect(Contentful::Management::Space).not_to receive(:find).with('foo') { space_double }
|
42
|
+
|
43
|
+
subject.instance_variable_set(:@actual_space, space_double)
|
44
|
+
|
45
|
+
subject.run
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'returns access token' do
|
49
|
+
allow(subject).to receive(:gets) { 'n' }
|
50
|
+
allow_any_instance_of(Contentful::Management::Request).to receive(:post) { ResponseDouble.new }
|
51
|
+
allow(Contentful::Management::Space).to receive(:find).with('foo') { space_double }
|
52
|
+
|
53
|
+
expect(subject.run).to eq 'foo'
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'fails if API returns an error' do
|
57
|
+
allow(subject).to receive(:gets) { 'n' }
|
58
|
+
allow_any_instance_of(Contentful::Management::Request).to receive(:post) { ErrorDouble.new }
|
59
|
+
allow(Contentful::Management::Space).to receive(:find).with('foo') { space_double }
|
60
|
+
|
61
|
+
expect { subject.run }.to raise_error ErrorDouble
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'token gets written if user input is other than no' do
|
65
|
+
allow(subject).to receive(:gets) { 'y' }
|
66
|
+
allow_any_instance_of(Contentful::Management::Request).to receive(:post) { ResponseDouble.new }
|
67
|
+
allow(Contentful::Management::Space).to receive(:find).with('foo') { space_double }
|
68
|
+
|
69
|
+
expect(token).to receive(:write_access_token).with('foobar', 'foo')
|
70
|
+
expect(token).to receive(:write_space_id).with('foobar', 'foobar')
|
71
|
+
|
72
|
+
subject.run
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
describe 'attributes' do
|
78
|
+
it ':token_name' do
|
79
|
+
expect(subject.token_name).to eq 'bar'
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Contentful::Bootstrap::Generator do
|
4
|
+
subject { Contentful::Bootstrap::Generator.new('wl1z0pal05vy', '48d7db7d4cd9d09df573c251d456f4acc72141b92f36e57f8684b36cf5cfff6e') }
|
5
|
+
|
6
|
+
describe 'JSON template generator' do
|
7
|
+
it 'can generate a JSON template for a given space' do
|
8
|
+
vcr('generate_json') {
|
9
|
+
json_fixture('wl1z0pal05vy') { |json|
|
10
|
+
expect(subject.generate_json).to eq JSON.pretty_generate(json)
|
11
|
+
}
|
12
|
+
}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,154 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Contentful::Bootstrap::OAuthEchoView do
|
4
|
+
describe 'instance methods' do
|
5
|
+
it '#render' do
|
6
|
+
expect(subject.render).to include(
|
7
|
+
'html',
|
8
|
+
'script',
|
9
|
+
'access_token',
|
10
|
+
'window.location.replace',
|
11
|
+
'save_token'
|
12
|
+
)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe Contentful::Bootstrap::ThanksView do
|
18
|
+
describe 'instance methods' do
|
19
|
+
it '#render' do
|
20
|
+
expect(subject.render).to include(
|
21
|
+
'html',
|
22
|
+
'Contentful Bootstrap',
|
23
|
+
'Thanks!'
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe Contentful::Bootstrap::IndexController do
|
30
|
+
subject { Contentful::Bootstrap::IndexController.new(ServerDouble.new) }
|
31
|
+
|
32
|
+
describe 'instance methods' do
|
33
|
+
describe '#do_GET' do
|
34
|
+
it 'launches browser' do
|
35
|
+
expect(Launchy).to receive(:open)
|
36
|
+
subject.do_GET(RequestDouble.new, ResponseDouble.new)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe Contentful::Bootstrap::OAuthCallbackController do
|
43
|
+
subject { Contentful::Bootstrap::OAuthCallbackController.new(ServerDouble.new) }
|
44
|
+
let(:response_double) { ResponseDouble.new }
|
45
|
+
|
46
|
+
describe 'instance methods' do
|
47
|
+
describe '#do_GET' do
|
48
|
+
it 'renders OAuthEchoView' do
|
49
|
+
subject.do_GET(RequestDouble.new, response_double)
|
50
|
+
expect(response_double.body).to eq Contentful::Bootstrap::OAuthEchoView.new.render
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe Contentful::Bootstrap::SaveTokenController do
|
57
|
+
let(:path) { File.expand_path(File.join('spec', 'fixtures', 'ini_fixtures', 'contentfulrc.ini')) }
|
58
|
+
let(:token) { Contentful::Bootstrap::Token.new path }
|
59
|
+
subject { Contentful::Bootstrap::SaveTokenController.new(ServerDouble.new, token) }
|
60
|
+
let(:response_double) { ResponseDouble.new }
|
61
|
+
let(:request_double) { RequestDouble.new }
|
62
|
+
|
63
|
+
describe 'instance methods' do
|
64
|
+
describe '#do_GET' do
|
65
|
+
it 'writes token' do
|
66
|
+
request_double.query = {'token' => 'foo'}
|
67
|
+
|
68
|
+
expect(token).to receive(:write).with('foo')
|
69
|
+
|
70
|
+
subject.do_GET(request_double, response_double)
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'renders ThanksView' do
|
74
|
+
request_double.query = {'token' => 'foo'}
|
75
|
+
allow(token).to receive(:write)
|
76
|
+
|
77
|
+
subject.do_GET(request_double, response_double)
|
78
|
+
|
79
|
+
expect(response_double.body).to eq Contentful::Bootstrap::ThanksView.new.render
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe 'attributes' do
|
85
|
+
it ':token' do
|
86
|
+
expect(subject.token).to eq token
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe Contentful::Bootstrap::Server do
|
92
|
+
let(:path) { File.expand_path(File.join('spec', 'fixtures', 'ini_fixtures', 'contentfulrc.ini')) }
|
93
|
+
let(:token) { Contentful::Bootstrap::Token.new path }
|
94
|
+
subject { Contentful::Bootstrap::Server.new(token) }
|
95
|
+
|
96
|
+
before do
|
97
|
+
allow_any_instance_of(WEBrick::HTTPServer).to receive(:start)
|
98
|
+
allow(WEBrick::Utils).to receive(:create_listeners) { [] } # Mock TCP Port binding
|
99
|
+
end
|
100
|
+
|
101
|
+
describe 'instance methods' do
|
102
|
+
describe '#start' do
|
103
|
+
it 'runs server in a new thread' do
|
104
|
+
expect(Thread).to receive(:new)
|
105
|
+
subject.start
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe '#stop' do
|
110
|
+
it 'shutdowns webrick' do
|
111
|
+
expect(subject.server).to receive(:shutdown)
|
112
|
+
subject.stop
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
describe '#running?' do
|
117
|
+
it 'returns true if webrick is running' do
|
118
|
+
expect(subject.server).to receive(:status) { :Running }
|
119
|
+
expect(subject.running?).to be_truthy
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'returns false if webrick is not running' do
|
123
|
+
expect(subject.server).to receive(:status) { :Stop }
|
124
|
+
expect(subject.running?).to be_falsey
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
describe 'attributes' do
|
130
|
+
describe ':server' do
|
131
|
+
it 'creates the webrick server' do
|
132
|
+
expect(subject.server).to be_kind_of(WEBrick::HTTPServer)
|
133
|
+
end
|
134
|
+
|
135
|
+
describe 'mounted endpoints' do
|
136
|
+
before do
|
137
|
+
@mount_table = subject.server.instance_variable_get(:@mount_tab)
|
138
|
+
end
|
139
|
+
|
140
|
+
it '/' do
|
141
|
+
expect(@mount_table['/'][0]).to eq(Contentful::Bootstrap::IndexController)
|
142
|
+
end
|
143
|
+
|
144
|
+
it '/oauth_callback' do
|
145
|
+
expect(@mount_table['/oauth_callback'][0]).to eq(Contentful::Bootstrap::OAuthCallbackController)
|
146
|
+
end
|
147
|
+
|
148
|
+
it '/save_token' do
|
149
|
+
expect(@mount_table['/save_token'][0]).to eq(Contentful::Bootstrap::SaveTokenController)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
class Double
|
4
|
+
include Contentful::Bootstrap::Support
|
5
|
+
|
6
|
+
def write
|
7
|
+
$stderr.write('foo\n')
|
8
|
+
end
|
9
|
+
|
10
|
+
def muted_write
|
11
|
+
silence_stderr do
|
12
|
+
write
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe Contentful::Bootstrap::Support do
|
18
|
+
subject { Double.new }
|
19
|
+
|
20
|
+
describe 'module methods' do
|
21
|
+
it '#silence_stderr' do
|
22
|
+
expect { subject.write }.to output('foo\n').to_stderr
|
23
|
+
|
24
|
+
expect { subject.muted_write }.to_not output.to_stderr
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Contentful::Bootstrap::Templates::Base do
|
4
|
+
let(:space) { Contentful::Management::Space.new }
|
5
|
+
subject { Contentful::Bootstrap::Templates::Base.new(space) }
|
6
|
+
|
7
|
+
describe 'instance methods' do
|
8
|
+
it '#content_types' do
|
9
|
+
expect(subject.content_types).to eq []
|
10
|
+
end
|
11
|
+
|
12
|
+
it '#entries' do
|
13
|
+
expect(subject.entries).to eq({})
|
14
|
+
end
|
15
|
+
|
16
|
+
it '#assets' do
|
17
|
+
expect(subject.assets).to eq []
|
18
|
+
end
|
19
|
+
|
20
|
+
it '#run' do
|
21
|
+
['content_types', 'assets', 'entries'].each do |name|
|
22
|
+
expect(subject).to receive("create_#{name}".to_sym)
|
23
|
+
end
|
24
|
+
|
25
|
+
subject.run
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'attributes' do
|
30
|
+
it ':space' do
|
31
|
+
expect(subject.space).to eq space
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Contentful::Bootstrap::Templates::Blog do
|
4
|
+
let(:space) { Contentful::Management::Space.new }
|
5
|
+
subject { Contentful::Bootstrap::Templates::Blog.new(space) }
|
6
|
+
|
7
|
+
describe 'content types' do
|
8
|
+
it 'has Post content type' do
|
9
|
+
expect(subject.content_types.detect { |ct| ct['id'] == 'post' }).to be_truthy
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'has Author content type' do
|
13
|
+
expect(subject.content_types.detect { |ct| ct['id'] == 'author' }).to be_truthy
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'entries' do
|
18
|
+
it 'has 2 posts' do
|
19
|
+
expect(subject.entries['post'].size).to eq 2
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'has 2 authors' do
|
23
|
+
expect(subject.entries['author'].size).to eq 2
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'assets' do
|
28
|
+
it 'has no assets' do
|
29
|
+
expect(subject.assets.empty?).to be_truthy
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Contentful::Bootstrap::Templates::Catalogue do
|
4
|
+
let(:space) { Contentful::Management::Space.new }
|
5
|
+
subject { Contentful::Bootstrap::Templates::Catalogue.new(space) }
|
6
|
+
|
7
|
+
describe 'content types' do
|
8
|
+
it 'has Brand content type' do
|
9
|
+
expect(subject.content_types.detect { |ct| ct['id'] == 'brand' }).to be_truthy
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'has Category content type' do
|
13
|
+
expect(subject.content_types.detect { |ct| ct['id'] == 'category' }).to be_truthy
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'has Product content type' do
|
17
|
+
expect(subject.content_types.detect { |ct| ct['id'] == 'product' }).to be_truthy
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'entries' do
|
22
|
+
it 'has 2 brands' do
|
23
|
+
expect(subject.entries['brand'].size).to eq 2
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'has 2 categories' do
|
27
|
+
expect(subject.entries['category'].size).to eq 2
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'has 2 products' do
|
31
|
+
expect(subject.entries['product'].size).to eq 2
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'assets' do
|
36
|
+
it 'has 6 assets' do
|
37
|
+
expect(subject.assets.size).to eq 6
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Contentful::Bootstrap::Templates::Gallery do
|
4
|
+
let(:space) { Contentful::Management::Space.new }
|
5
|
+
subject { Contentful::Bootstrap::Templates::Gallery.new(space) }
|
6
|
+
|
7
|
+
describe 'content types' do
|
8
|
+
it 'has Author content type' do
|
9
|
+
expect(subject.content_types.detect { |ct| ct['id'] == 'author' }).to be_truthy
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'has Image content type' do
|
13
|
+
expect(subject.content_types.detect { |ct| ct['id'] == 'image' }).to be_truthy
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'has Gallery content type' do
|
17
|
+
expect(subject.content_types.detect { |ct| ct['id'] == 'gallery' }).to be_truthy
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe 'entries' do
|
22
|
+
it 'has 1 author' do
|
23
|
+
expect(subject.entries['author'].size).to eq 1
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'has 2 images' do
|
27
|
+
expect(subject.entries['image'].size).to eq 2
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'has 1 gallery' do
|
31
|
+
expect(subject.entries['gallery'].size).to eq 1
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe 'assets' do
|
36
|
+
it 'has 2 assets' do
|
37
|
+
expect(subject.assets.size).to eq 2
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Contentful::Bootstrap::Templates::JsonTemplate do
|
4
|
+
let(:space) { Contentful::Management::Space.new }
|
5
|
+
let(:path) { File.expand_path(File.join('spec', 'fixtures', 'json_fixtures', 'simple.json')) }
|
6
|
+
subject { Contentful::Bootstrap::Templates::JsonTemplate.new space, path }
|
7
|
+
|
8
|
+
describe 'instance methods' do
|
9
|
+
it '#content_types' do
|
10
|
+
expect(subject.content_types.first).to eq(
|
11
|
+
{
|
12
|
+
"id" => "cat",
|
13
|
+
"name" => "Cat",
|
14
|
+
"displayField" => "name",
|
15
|
+
"fields" => [
|
16
|
+
{
|
17
|
+
"id" => "name",
|
18
|
+
"name" => "Name",
|
19
|
+
"type" => "Symbol"
|
20
|
+
}
|
21
|
+
]
|
22
|
+
}
|
23
|
+
)
|
24
|
+
|
25
|
+
expect(subject.content_types.size).to eq(1)
|
26
|
+
end
|
27
|
+
|
28
|
+
it '#assets' do
|
29
|
+
expect(subject.assets.first).to include(
|
30
|
+
{
|
31
|
+
"id" => "cat_asset",
|
32
|
+
"title" => "Cat"
|
33
|
+
}
|
34
|
+
)
|
35
|
+
|
36
|
+
expect(subject.assets.first['file']).to be_kind_of(Contentful::Management::File)
|
37
|
+
|
38
|
+
expect(subject.assets.size).to eq(1)
|
39
|
+
end
|
40
|
+
|
41
|
+
it '#entries' do
|
42
|
+
expect(subject.entries.keys).to include("cat")
|
43
|
+
expect(subject.entries["cat"].size).to eq(1)
|
44
|
+
expect(subject.entries["cat"].first).to eq(
|
45
|
+
{
|
46
|
+
"id" => "nyancat",
|
47
|
+
"name" => "Nyan Cat"
|
48
|
+
}
|
49
|
+
)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|