contentful_bootstrap 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e7ea53fc8910927ad570b01662d13508ceeb6f2
4
- data.tar.gz: b31f21982faf8bc39fb074b4f7b07bb6dda3b2b8
3
+ metadata.gz: 707aaf25b774e94bc57a7a4fcbafca299a087c0b
4
+ data.tar.gz: 931621f83a894b336f81fcd65b729dcd90c0e03f
5
5
  SHA512:
6
- metadata.gz: 1961e824b175b3875c5763bccc14a514cc8a4620df2db15119c8d4b56ae713b8c84d2b1b907ac4e577d7f14338666cb9b36f37fff758d39fe0904be1abf299ae
7
- data.tar.gz: 313723cd33fdf169acd945e675dd448e2db5930905a3d722197aaa71fc373079e166ef59739700c09af25c19b039c543a82e52027c098f6f683757d9bc75d2e5
6
+ metadata.gz: 4c306b28133c2411c327b6ee266ad8ec04f9eaa1284dc40a82dd798b8c332f1571c856bd010c7ebb330e45696ef2f3bb483d9b1771e13bf8bca074edba074a90
7
+ data.tar.gz: 20b2c92ab22e7b511fafb1cb9735e72a4fd8ec9ca0d37829d346245add717c80041dcc99594605dd72e1e4954a90ede31b5cb0110d4c372a7cba17f455e896a3
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## v3.1.1
6
+ ### Fixed
7
+ * Fixes a bug where `display_field` was not properly populated when being generated from JSON templates [#35](https://github.com/contentful/contentful-bootstrap.rb/issues/35)
8
+
5
9
  ## v3.1.0
6
10
  ### Fixed
7
11
  * Version Locked Webmock causing all our VCRs to fail
@@ -17,7 +17,12 @@ module Contentful
17
17
  end
18
18
 
19
19
  def content_types
20
- json.fetch('contentTypes', [])
20
+ processed_content_types = json.fetch('contentTypes', [])
21
+ processed_content_types.each do |content_type|
22
+ content_type['display_field'] = content_type.key?('displayField') ? content_type.delete('displayField') : content_type['display_field']
23
+ end
24
+
25
+ processed_content_types
21
26
  end
22
27
 
23
28
  def assets
@@ -1,6 +1,6 @@
1
1
  module Contentful
2
2
  module Bootstrap
3
- VERSION = '3.1.0'
3
+ VERSION = '3.1.1'
4
4
 
5
5
  def self.major_version
6
6
  VERSION.split('.').first.to_i
@@ -6,23 +6,35 @@ describe Contentful::Bootstrap::Templates::JsonTemplate do
6
6
  subject { described_class.new space, path }
7
7
 
8
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
- )
9
+ describe '#content_types' do
10
+ it 'fetches content types' do
11
+ expect(subject.content_types.first).to eq(
12
+ {
13
+ "id" => "cat",
14
+ "name" => "Cat",
15
+ "display_field" => "name",
16
+ "fields" => [
17
+ {
18
+ "id" => "name",
19
+ "name" => "Name",
20
+ "type" => "Symbol"
21
+ }
22
+ ]
23
+ }
24
+ )
25
+
26
+ expect(subject.content_types.size).to eq(1)
27
+ end
28
+
29
+ it 'uses displayField if found' do
30
+ expect(subject.content_types.first['display_field']).to eq 'name'
31
+ end
32
+
33
+ it 'uses display_field if not' do
34
+ subject = described_class.new(space, File.expand_path(File.join('spec', 'fixtures', 'json_fixtures', 'display_field.json')))
24
35
 
25
- expect(subject.content_types.size).to eq(1)
36
+ expect(subject.content_types.first['display_field']).to eq 'name'
37
+ end
26
38
  end
27
39
 
28
40
  it '#assets' do
@@ -0,0 +1,39 @@
1
+ {
2
+ "version": 3,
3
+ "contentTypes": [
4
+ {
5
+ "id": "cat",
6
+ "name": "Cat",
7
+ "display_field": "name",
8
+ "fields": [
9
+ {
10
+ "id": "name",
11
+ "name": "Name",
12
+ "type": "Symbol"
13
+ }
14
+ ]
15
+ }
16
+ ],
17
+ "assets": [
18
+ {
19
+ "id": "cat_asset",
20
+ "title": "Cat",
21
+ "file": {
22
+ "filename": "cat",
23
+ "url": "https://somecat.com/my_cat.jpeg"
24
+ }
25
+ }
26
+ ],
27
+ "entries": {
28
+ "cat": [
29
+ {
30
+ "sys": {
31
+ "id": "nyancat"
32
+ },
33
+ "fields": {
34
+ "name": "Nyan Cat"
35
+ }
36
+ }
37
+ ]
38
+ }
39
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: contentful_bootstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Litvak Bruno
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-29 00:00:00.000000000 Z
11
+ date: 2016-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -260,6 +260,7 @@ files:
260
260
  - spec/fixtures/ini_fixtures/no_global.ini
261
261
  - spec/fixtures/ini_fixtures/no_token.ini
262
262
  - spec/fixtures/ini_fixtures/sections.ini
263
+ - spec/fixtures/json_fixtures/display_field.json
263
264
  - spec/fixtures/json_fixtures/high.json
264
265
  - spec/fixtures/json_fixtures/invalid.json
265
266
  - spec/fixtures/json_fixtures/issue_22.json
@@ -325,6 +326,7 @@ test_files:
325
326
  - spec/fixtures/ini_fixtures/no_global.ini
326
327
  - spec/fixtures/ini_fixtures/no_token.ini
327
328
  - spec/fixtures/ini_fixtures/sections.ini
329
+ - spec/fixtures/json_fixtures/display_field.json
328
330
  - spec/fixtures/json_fixtures/high.json
329
331
  - spec/fixtures/json_fixtures/invalid.json
330
332
  - spec/fixtures/json_fixtures/issue_22.json