playgroundbook 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +110 -0
  3. data/Changelog.md +4 -0
  4. data/Gemfile +10 -9
  5. data/Gemfile.lock +4 -2
  6. data/Guardfile +2 -2
  7. data/Rakefile +3 -3
  8. data/bin/playgroundbook +9 -7
  9. data/lib/{playgroundbook_lint → linter}/abstract_linter.rb +2 -2
  10. data/lib/{playgroundbook_lint → linter}/chapter_linter.rb +4 -4
  11. data/lib/{playgroundbook_lint → linter}/chapter_manifest_linter.rb +5 -5
  12. data/lib/{playgroundbook_lint → linter}/contents_linter.rb +3 -3
  13. data/lib/{playgroundbook_lint → linter}/cutscene_page_linter.rb +2 -2
  14. data/lib/{playgroundbook_lint → linter}/cutscene_page_manifest_linter.rb +2 -2
  15. data/lib/{playgroundbook_lint → linter}/manifest_linter.rb +5 -5
  16. data/lib/{playgroundbook_lint → linter}/page_linter.rb +2 -2
  17. data/lib/{playgroundbook_lint → linter}/page_manifest_linter.rb +3 -3
  18. data/lib/{playgroundbook_lint → linter}/playgroundbook_lint.rb +6 -6
  19. data/lib/{playgroundbook_lint → linter}/root_manifest_linter.rb +9 -9
  20. data/lib/playgroundbook.rb +8 -7
  21. data/lib/{playgroundbook_renderer → renderer}/chapter_collator.rb +18 -18
  22. data/lib/renderer/contents_manifest_generator.rb +35 -0
  23. data/lib/{playgroundbook_renderer → renderer}/glossary_generator.rb +13 -16
  24. data/lib/{playgroundbook_renderer → renderer}/page_parser.rb +4 -3
  25. data/lib/{playgroundbook_renderer → renderer}/page_processor.rb +0 -0
  26. data/lib/{playgroundbook_renderer → renderer}/page_writer.rb +11 -11
  27. data/lib/{playgroundbook_renderer → renderer}/playgroundbook_renderer.rb +29 -29
  28. data/lib/version.rb +1 -1
  29. data/lib/wrapper/markdown_wrapper.rb +58 -0
  30. data/playground_book_lint.gemspec +14 -14
  31. data/spec/fixtures/wrapper/destination/swift_at_artsy_1.swift +199 -0
  32. data/spec/fixtures/wrapper/source/Swift-at-Artsy.playground/Contents.swift +199 -0
  33. data/spec/fixtures/wrapper/source/Swift-at-Artsy.playground/contents.xcplayground +4 -0
  34. data/spec/fixtures/wrapper/source/swift_at_artsy_1.md +183 -0
  35. data/spec/{playground_book_lint → linter}/chapter_linter_spec.rb +5 -5
  36. data/spec/{playground_book_lint → linter}/chapter_manifest_linter_spec.rb +12 -12
  37. data/spec/{playground_book_lint → linter}/contents_linter_spec.rb +3 -3
  38. data/spec/{playground_book_lint → linter}/cutscene_page_linter_spec.rb +2 -2
  39. data/spec/linter/cutscene_page_manifest_linter_spec.rb +63 -0
  40. data/spec/linter/manfiest_linter_spec.rb +71 -0
  41. data/spec/{playground_book_lint → linter}/page_linter_spec.rb +4 -4
  42. data/spec/{playground_book_lint → linter}/page_manifest_linter_spec.rb +13 -13
  43. data/spec/{playground_book_lint → linter}/playgroundbook_lint_spec.rb +6 -6
  44. data/spec/linter/root_manifest_linter_spec.rb +35 -0
  45. data/spec/renderer/chapter_collator_spec.rb +70 -0
  46. data/spec/renderer/contents_manfiest_generator_spec.rb +41 -0
  47. data/spec/renderer/glossary_generator_spec.rb +54 -0
  48. data/spec/{playgroundbook_renderer_spec → renderer}/page_processor_spec.rb +12 -12
  49. data/spec/{playgroundbook_renderer_spec → renderer}/page_writer_spec.rb +19 -19
  50. data/spec/renderer/playgroundbook_renderer_spec.rb +122 -0
  51. data/spec/spec_helper.rb +38 -38
  52. data/spec/wrapper/markdown_wrapper_spec.rb +33 -0
  53. metadata +43 -37
  54. data/lib/playgroundbook_renderer/contents_manifest_generator.rb +0 -35
  55. data/spec/playground_book_lint/cutscene_page_manifest_linter_spec.rb +0 -63
  56. data/spec/playground_book_lint/manfiest_linter_spec.rb +0 -71
  57. data/spec/playground_book_lint/root_manifest_linter_spec.rb +0 -35
  58. data/spec/playgroundbook_renderer_spec/chapter_collator_spec.rb +0 -70
  59. data/spec/playgroundbook_renderer_spec/contents_manfiest_generator_spec.rb +0 -41
  60. data/spec/playgroundbook_renderer_spec/glossary_generator_spec.rb +0 -52
  61. data/spec/playgroundbook_renderer_spec/playgroundbook_renderer_spec.rb +0 -122
@@ -0,0 +1,33 @@
1
+ require File.expand_path("../../spec_helper", __FILE__)
2
+
3
+ module Playgroundbook
4
+ describe MarkdownWrapper do
5
+ let(:test_ui) { Cork::Board.new(silent: true) }
6
+
7
+ it "creates a swift file from a markdown file" do
8
+ source = "spec/fixtures/wrapper/source/swift_at_artsy_1.md"
9
+ destination = "spec/fixtures/wrapper/destination/swift_at_artsy_1.swift"
10
+ subject = MarkdownWrapper.new(source, "Swift at Artsy")
11
+ contents = File.read(source)
12
+ expect(subject.swap_code_context(contents)).to eq(File.read(destination))
13
+ end
14
+
15
+ it "creates a playground around the file" do
16
+ source = "spec/fixtures/wrapper/source/swift_at_artsy_1.md"
17
+
18
+ Dir.mktmpdir do |dir|
19
+ new_source = File.join(dir, File.basename(source))
20
+ FileUtils.cp(source, new_source)
21
+ subject = MarkdownWrapper.new(new_source, "Swift at Artsy")
22
+
23
+ subject.generate
24
+
25
+ playground = File.join(dir, "Swift at Artsy.playground")
26
+ expect(Dir.exist?(playground)).to eq(true)
27
+ expect(File.exist?(File.join(playground, "Contents.swift"))).to eq(true)
28
+ expect(File.exist?(File.join(playground, "timeline.xctimeline"))).to eq(true)
29
+ expect(File.exist?(File.join(playground, "contents.xcplayground"))).to eq(true)
30
+ end
31
+ end
32
+ end
33
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playgroundbook
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ash Furrow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-07 00:00:00.000000000 Z
11
+ date: 2016-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plist
@@ -71,26 +71,27 @@ files:
71
71
  - README.md
72
72
  - Rakefile
73
73
  - bin/playgroundbook
74
+ - lib/linter/abstract_linter.rb
75
+ - lib/linter/chapter_linter.rb
76
+ - lib/linter/chapter_manifest_linter.rb
77
+ - lib/linter/contents_linter.rb
78
+ - lib/linter/cutscene_page_linter.rb
79
+ - lib/linter/cutscene_page_manifest_linter.rb
80
+ - lib/linter/manifest_linter.rb
81
+ - lib/linter/page_linter.rb
82
+ - lib/linter/page_manifest_linter.rb
83
+ - lib/linter/playgroundbook_lint.rb
84
+ - lib/linter/root_manifest_linter.rb
74
85
  - lib/playgroundbook.rb
75
- - lib/playgroundbook_lint/abstract_linter.rb
76
- - lib/playgroundbook_lint/chapter_linter.rb
77
- - lib/playgroundbook_lint/chapter_manifest_linter.rb
78
- - lib/playgroundbook_lint/contents_linter.rb
79
- - lib/playgroundbook_lint/cutscene_page_linter.rb
80
- - lib/playgroundbook_lint/cutscene_page_manifest_linter.rb
81
- - lib/playgroundbook_lint/manifest_linter.rb
82
- - lib/playgroundbook_lint/page_linter.rb
83
- - lib/playgroundbook_lint/page_manifest_linter.rb
84
- - lib/playgroundbook_lint/playgroundbook_lint.rb
85
- - lib/playgroundbook_lint/root_manifest_linter.rb
86
- - lib/playgroundbook_renderer/chapter_collator.rb
87
- - lib/playgroundbook_renderer/contents_manifest_generator.rb
88
- - lib/playgroundbook_renderer/glossary_generator.rb
89
- - lib/playgroundbook_renderer/page_parser.rb
90
- - lib/playgroundbook_renderer/page_processor.rb
91
- - lib/playgroundbook_renderer/page_writer.rb
92
- - lib/playgroundbook_renderer/playgroundbook_renderer.rb
86
+ - lib/renderer/chapter_collator.rb
87
+ - lib/renderer/contents_manifest_generator.rb
88
+ - lib/renderer/glossary_generator.rb
89
+ - lib/renderer/page_parser.rb
90
+ - lib/renderer/page_processor.rb
91
+ - lib/renderer/page_writer.rb
92
+ - lib/renderer/playgroundbook_renderer.rb
93
93
  - lib/version.rb
94
+ - lib/wrapper/markdown_wrapper.rb
94
95
  - playground_book_lint.gemspec
95
96
  - spec/fixtures/Starter.playgroundbook/Contents/Chapters/Chapter1.playgroundchapter/Manifest.plist
96
97
  - spec/fixtures/Starter.playgroundbook/Contents/Chapters/Chapter1.playgroundchapter/Pages/Page1.playgroundpage/Contents.swift
@@ -102,23 +103,28 @@ files:
102
103
  - spec/fixtures/book.yml
103
104
  - spec/fixtures/test_chapter.playground/Contents.swift
104
105
  - spec/fixtures/test_chapter.playground/contents.xcplayground
105
- - spec/playground_book_lint/chapter_linter_spec.rb
106
- - spec/playground_book_lint/chapter_manifest_linter_spec.rb
107
- - spec/playground_book_lint/contents_linter_spec.rb
108
- - spec/playground_book_lint/cutscene_page_linter_spec.rb
109
- - spec/playground_book_lint/cutscene_page_manifest_linter_spec.rb
110
- - spec/playground_book_lint/manfiest_linter_spec.rb
111
- - spec/playground_book_lint/page_linter_spec.rb
112
- - spec/playground_book_lint/page_manifest_linter_spec.rb
113
- - spec/playground_book_lint/playgroundbook_lint_spec.rb
114
- - spec/playground_book_lint/root_manifest_linter_spec.rb
115
- - spec/playgroundbook_renderer_spec/chapter_collator_spec.rb
116
- - spec/playgroundbook_renderer_spec/contents_manfiest_generator_spec.rb
117
- - spec/playgroundbook_renderer_spec/glossary_generator_spec.rb
118
- - spec/playgroundbook_renderer_spec/page_processor_spec.rb
119
- - spec/playgroundbook_renderer_spec/page_writer_spec.rb
120
- - spec/playgroundbook_renderer_spec/playgroundbook_renderer_spec.rb
106
+ - spec/fixtures/wrapper/destination/swift_at_artsy_1.swift
107
+ - spec/fixtures/wrapper/source/Swift-at-Artsy.playground/Contents.swift
108
+ - spec/fixtures/wrapper/source/Swift-at-Artsy.playground/contents.xcplayground
109
+ - spec/fixtures/wrapper/source/swift_at_artsy_1.md
110
+ - spec/linter/chapter_linter_spec.rb
111
+ - spec/linter/chapter_manifest_linter_spec.rb
112
+ - spec/linter/contents_linter_spec.rb
113
+ - spec/linter/cutscene_page_linter_spec.rb
114
+ - spec/linter/cutscene_page_manifest_linter_spec.rb
115
+ - spec/linter/manfiest_linter_spec.rb
116
+ - spec/linter/page_linter_spec.rb
117
+ - spec/linter/page_manifest_linter_spec.rb
118
+ - spec/linter/playgroundbook_lint_spec.rb
119
+ - spec/linter/root_manifest_linter_spec.rb
120
+ - spec/renderer/chapter_collator_spec.rb
121
+ - spec/renderer/contents_manfiest_generator_spec.rb
122
+ - spec/renderer/glossary_generator_spec.rb
123
+ - spec/renderer/page_processor_spec.rb
124
+ - spec/renderer/page_writer_spec.rb
125
+ - spec/renderer/playgroundbook_renderer_spec.rb
121
126
  - spec/spec_helper.rb
127
+ - spec/wrapper/markdown_wrapper_spec.rb
122
128
  homepage: https://github.com/ashfurrow/playground-book-lint
123
129
  licenses:
124
130
  - MIT
@@ -139,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
145
  version: '0'
140
146
  requirements: []
141
147
  rubyforge_project:
142
- rubygems_version: 2.2.2
148
+ rubygems_version: 2.4.8
143
149
  signing_key:
144
150
  specification_version: 4
145
151
  summary: Lints/renders Swift Playground books.
@@ -1,35 +0,0 @@
1
- require 'plist'
2
-
3
- module Playgroundbook
4
- class ContentsManifestGenerator
5
- def initialize(ui = Cork::Board.new)
6
- @ui = ui
7
- end
8
-
9
- def generate!(book_metadata)
10
- @ui.puts "Generating main manifest file."
11
- write_manifest_file!(book_metadata)
12
- @ui.puts "Manifest file generated."
13
- end
14
-
15
- def write_manifest_file!(book_metadata)
16
- File.open(ManifestFileName, 'w') do |file|
17
- file.write(manifest_contents(book_metadata).to_plist)
18
- end
19
- end
20
-
21
- def manifest_contents(book_metadata)
22
- chapters = book_metadata['chapters'].map{ |c| "#{c}.playgroundchapter" }
23
- manifest_contents = {
24
- 'Name' => book_metadata['name'],
25
- 'ContentIdentifier' => book_metadata['identifier'],
26
- 'DeploymentTarget' => book_metadata['deployment_target'] || 'ios10.0',
27
- 'Chapters' => chapters,
28
- 'Version' => '1.0',
29
- 'ContentVersion' => '1.0',
30
- }
31
- manifest_contents['ImageReference'] = book_metadata['cover'] unless book_metadata['cover'].nil?
32
- manifest_contents
33
- end
34
- end
35
- end
@@ -1,63 +0,0 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
2
-
3
- module Playgroundbook
4
- describe CutscenePageManifestLinter do
5
- include FakeFS::SpecHelpers
6
- let(:cutscene_page_manifest_linter) { CutscenePageManifestLinter.new }
7
-
8
- it 'given a valid manifest does not fail' do
9
- FakeFS do
10
- cutscene_reference = 'RealFile.html'
11
- plist = {
12
- 'Name' => 'Test Page',
13
- 'CutsceneReference' => cutscene_reference
14
- }.to_plist
15
- File.open('Manifest.plist', 'w') { |f| f.write(plist) }
16
- File.open(cutscene_reference, 'w')
17
-
18
- expect { cutscene_page_manifest_linter.lint }.not_to raise_error
19
- end
20
- end
21
-
22
- context 'given a cutscene path' do
23
- it "fails if the key doesn't exist" do
24
- FakeFS do
25
- cutscene_reference = 'FakeFile.html'
26
- plist = {
27
- 'Name' => 'Test Page',
28
- }.to_plist
29
- File.open('Manifest.plist', 'w') { |f| f.write(plist) }
30
-
31
- expect { cutscene_page_manifest_linter.lint }.to raise_error(SystemExit)
32
- end
33
- end
34
-
35
- it "fails if that file doesn't exist" do
36
- FakeFS do
37
- cutscene_reference = 'FakeFile.html'
38
- plist = {
39
- 'Name' => 'Test Page',
40
- 'CutsceneReference' => cutscene_reference
41
- }.to_plist
42
- File.open('Manifest.plist', 'w') { |f| f.write(plist) }
43
-
44
- expect { cutscene_page_manifest_linter.lint }.to raise_error(SystemExit)
45
- end
46
- end
47
-
48
- it 'fails with a non-HTML file' do
49
- FakeFS do
50
- cutscene_reference = 'RealFile.xml'
51
- plist = {
52
- 'Name' => 'Test Page',
53
- 'CutsceneReference' => cutscene_reference
54
- }.to_plist
55
- File.open('Manifest.plist', 'w') { |f| f.write(plist) }
56
- File.open(cutscene_reference, 'w')
57
-
58
- expect { cutscene_page_manifest_linter.lint }.to raise_error(SystemExit)
59
- end
60
- end
61
- end
62
- end
63
- end
@@ -1,71 +0,0 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
2
-
3
- module Playgroundbook
4
- describe RootManifestLinter do
5
- include FakeFS::SpecHelpers
6
- let(:manifest_linter) { ManifestLinter.new }
7
-
8
- it 'fails if a Manifest.plist file does not exist' do
9
- expect { manifest_linter.lint }.to raise_error(SystemExit)
10
- end
11
-
12
- it 'fails if the Manifest.plist file does not contain a Name value' do
13
- FakeFS do
14
- plist = {}.to_plist
15
- File.open('Manifest.plist', 'w') { |f| f.write(plist) }
16
-
17
- expect { manifest_linter.lint }.to raise_error(SystemExit)
18
- end
19
- end
20
-
21
- it 'succeeds if the Manifest.plist file is well-formed' do
22
- FakeFS do
23
- plist = { 'Name' => 'My Test Name' }.to_plist
24
- File.open('Manifest.plist', 'w') { |f| f.write(plist) }
25
-
26
- expect { manifest_linter.lint }.to_not raise_error
27
- end
28
- end
29
-
30
- it 'extracts Manfiest.plist contents from pwd' do
31
- FakeFS do
32
- contents = { 'key' => 'value' }
33
- File.open('Manifest.plist', 'w') { |f| f.write(contents.to_plist) }
34
-
35
- expect(manifest_linter.manifest_plist_contents).to eq(contents)
36
- end
37
- end
38
-
39
- describe 'key-value checking' do
40
- before do
41
- end
42
-
43
- it 'checks for non-defined keys in manifest' do
44
- FakeFS do
45
- plist = {}.to_plist
46
- File.open('Manifest.plist', 'w') { |f| f.write(plist) }
47
-
48
- expect(manifest_linter.value_defined_in_manifest?('key')).to be_falsy
49
- end
50
- end
51
-
52
- it 'checks for nil keys in manifest' do
53
- FakeFS do
54
- plist = { 'key' => nil }.to_plist
55
- File.open('Manifest.plist', 'w') { |f| f.write(plist) }
56
-
57
- expect(manifest_linter.value_defined_in_manifest?('key')).to be_falsy
58
- end
59
- end
60
-
61
- it 'checks for empty keys in manifest' do
62
- FakeFS do
63
- plist = { 'key' => 'value' }.to_plist
64
- File.open('Manifest.plist', 'w') { |f| f.write(plist) }
65
-
66
- expect(manifest_linter.value_defined_in_manifest?('key')).to be_truthy
67
- end
68
- end
69
- end
70
- end
71
- end
@@ -1,35 +0,0 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
2
-
3
- module Playgroundbook
4
- describe RootManifestLinter do
5
- include FakeFS::SpecHelpers
6
- let(:root_manifest_linter) { RootManifestLinter.new(chapter_linter) }
7
- let(:chapter_linter) { double(ChapterLinter) }
8
-
9
- it 'fails if Chapters directory does not exist' do
10
- expect { root_manifest_linter.lint }.to raise_error(SystemExit)
11
- end
12
-
13
- it 'fails if manfiest does not include Chapters' do
14
- FakeFS do
15
- Dir.mkdir('Chapters')
16
- plist = { 'Name' => 'Test' }.to_plist
17
- File.open('Manifest.plist', 'w') { |f| f.write(plist) }
18
-
19
- expect { root_manifest_linter.lint }.to raise_error(SystemExit)
20
- end
21
- end
22
-
23
- it 'calls through to lint each chapter' do
24
- FakeFS do
25
- plist = { 'Chapters' => ['test_chapter_name'], 'Name' => 'Test' }.to_plist
26
- File.open('Manifest.plist', 'w') { |f| f.write(plist) }
27
- Dir.mkdir('Chapters')
28
-
29
- expect(chapter_linter).to receive(:lint).with('test_chapter_name')
30
-
31
- expect { root_manifest_linter.lint }.to_not raise_error
32
- end
33
- end
34
- end
35
- end
@@ -1,70 +0,0 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
2
-
3
- module Playgroundbook
4
- describe ChapterCollator do
5
- include FakeFS::SpecHelpers
6
- let(:collator) { ChapterCollator.new(page_writer, test_ui) }
7
- let(:page_writer) { double(PageWriter) }
8
- let(:test_ui) { Cork::Board.new(silent: true) }
9
- let(:parsed_chapter) { PageParser.new.parse_chapter_pages(test_chapter_contents) }
10
- let(:chapter_name) { 'test_chapter' }
11
-
12
- before do
13
- allow(page_writer).to receive(:write_page!)
14
- end
15
-
16
- it 'creates a chapter manifest' do
17
- collator.collate!(chapter_name, parsed_chapter, [])
18
-
19
- expect(File.exist?("#{chapter_name}.playgroundchapter/#{ManifestFileName}")).to be_truthy
20
- end
21
-
22
- context 'the chapter manifest' do
23
- before do
24
- collator.collate!(chapter_name, parsed_chapter, ['UIKit'])
25
- end
26
-
27
- it 'has the correct name' do
28
- expect(get_manifest("#{chapter_name}.playgroundchapter/#{ManifestFileName}")['Name']).to eq(chapter_name)
29
- end
30
-
31
- it 'has the correct pages' do
32
- expect(get_manifest("#{chapter_name}.playgroundchapter/#{ManifestFileName}")['Pages']).to eq([
33
- 'Page 1.playgroundpage',
34
- 'Page 2.playgroundpage',
35
- ])
36
- end
37
- end
38
-
39
- it 'calls the page_writer for each page' do
40
- expect(page_writer).to receive(:write_page!).with("Page 1", "Page 1.playgroundpage", [], "str = \"Yo, it's page 1.\"\nsharedFunc()")
41
- expect(page_writer).to receive(:write_page!).with("Page 2", "Page 2.playgroundpage", [], "str = \"Page 2 awww yeah.\"\nsharedFunc()")
42
-
43
- collator.collate!(chapter_name, parsed_chapter, [])
44
- end
45
-
46
- it 'does not explode if a Source directory already exists' do
47
- expect{ collator.collate!(chapter_name, parsed_chapter, []) }.to_not raise_error
48
- end
49
-
50
- context 'having colated' do
51
- before do
52
- collator.collate!(chapter_name, parsed_chapter, [])
53
- end
54
-
55
- it 'creates a Source directory if one does not exist' do
56
- expect(Dir.exist?("#{chapter_name}.playgroundchapter/#{SharedSourcesDirectoryName}")).to be_truthy
57
- end
58
-
59
- context 'Sources folder' do
60
- it 'has a Preamble.swift file' do
61
- expect(File.exist?("#{chapter_name}.playgroundchapter/#{SharedSourcesDirectoryName}/#{PreambleFileName}")).to be_truthy
62
- end
63
-
64
- it 'has the correct preamble contents' do
65
- expect(File.read("#{chapter_name}.playgroundchapter/#{SharedSourcesDirectoryName}/#{PreambleFileName}")).to eq("import UIKit\n\nvar str = \"Hello, playground\"\n\nfunc sharedFunc() {\n print(\"This should be accessible to all pages.\")\n}")
66
- end
67
- end
68
- end
69
- end
70
- end
@@ -1,41 +0,0 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
2
-
3
- module Playgroundbook
4
- describe ContentsManifestGenerator do
5
- include FakeFS::SpecHelpers
6
- let(:generator) { ContentsManifestGenerator.new(test_ui) }
7
- let(:test_ui) { Cork::Board.new(silent: true) }
8
-
9
- it 'creates the manifest file' do
10
- generator.generate!(test_book_metadata)
11
-
12
- expect(File.exist?('Manifest.plist')).to be_truthy
13
- end
14
-
15
- describe 'the manifest file' do
16
- before do
17
- generator.generate!(test_book_metadata)
18
- end
19
-
20
- it 'has a book name' do
21
- expect(get_manifest['Name']).to eq('Testing Book')
22
- end
23
-
24
- it 'has an identifier' do
25
- expect(get_manifest['ContentIdentifier']).to eq('com.ashfurrow.testing')
26
- end
27
-
28
- it 'has a deployment target' do
29
- expect(get_manifest['DeploymentTarget']).to eq('ios10.0')
30
- end
31
-
32
- it 'has chapters specified' do
33
- expect(get_manifest['Chapters']).to eq(['test_chapter.playgroundchapter'])
34
- end
35
-
36
- it 'has a ImageReference' do
37
- expect(get_manifest['ImageReference']).to eq('file.jpeg')
38
- end
39
- end
40
- end
41
- end