|
19 | 19 | end
|
20 | 20 | let(:site) { Jekyll::Site.new(config) }
|
21 | 21 | let(:contents) { File.read(dest_dir("app.yaml")) }
|
22 |
| - let(:handlers) { YAML.load_file(dest_dir("app.yaml"))["handlers"] } |
| 22 | + let(:app_yaml) { YAML.load_file(dest_dir("app.yaml")) } |
| 23 | + let(:handlers) { app_yaml["handlers"] } |
23 | 24 | before(:each) do
|
24 | 25 | site.process
|
25 | 26 | end
|
|
41 | 42 | expect(handlers).to include({
|
42 | 43 | "url" => "/",
|
43 | 44 | "static_files" => "spec/dest/index.html",
|
44 |
| - "upload" => "spec/dest/index.html" |
| 45 | + "upload" => "spec/dest/index.html", |
| 46 | + "http_headers" => { |
| 47 | + "Cache-Control" => "max-age=3600" |
| 48 | + } |
45 | 49 | })
|
46 | 50 | expect(handlers).to include({
|
47 | 51 | "url" => "/some-subfolder/this-is-a-subpage.html",
|
|
85 | 89 | })
|
86 | 90 | end
|
87 | 91 |
|
88 |
| - # describe "collections" do |
89 |
| - # it "puts all the `output:true` into app.yaml" do |
90 |
| - # expect(contents).to match /<loc>http:\/\/example\.org\/my_collection\/test\.html<\/loc>/ |
91 |
| - # end |
92 |
| - # |
93 |
| - # it "doesn't put all the `output:false` into app.yaml" do |
94 |
| - # expect(contents).to_not match /<loc>http:\/\/example\.org\/other_things\/test2\.html<\/loc>/ |
95 |
| - # end |
96 |
| - # |
97 |
| - # it "remove 'index.html' for directory custom permalinks" do |
98 |
| - # expect(contents).to match /<loc>http:\/\/example\.org\/permalink\/<\/loc>/ |
99 |
| - # end |
100 |
| - # |
101 |
| - # it "doesn't remove filename for non-directory custom permalinks" do |
102 |
| - # expect(contents).to match /<loc>http:\/\/example\.org\/permalink\/unique_name\.html<\/loc>/ |
103 |
| - # end |
104 |
| - # |
105 |
| - # it "performs URI encoding of site paths" do |
106 |
| - # expect(contents).to match /<loc>http:\/\/example\.org\/this%20url%20has%20an%20%C3%BCmlaut<\/loc>/ |
107 |
| - # end |
108 |
| - # end |
| 92 | + describe "collections" do |
| 93 | + it "puts all the `output:true` into app.yaml" do |
| 94 | + expect(handlers).to include({ |
| 95 | + "url" => "/my_collection/test.html", |
| 96 | + "static_files" => "spec/dest/my_collection/test.html", |
| 97 | + "upload" => "spec/dest/my_collection/test.html" |
| 98 | + }) |
| 99 | + end |
| 100 | + |
| 101 | + it "doesn't put all the `output:false` into app.yaml" do |
| 102 | + expect(contents).to_not match /\/other_things\/test2\.html/ |
| 103 | + end |
| 104 | + end |
109 | 105 |
|
110 | 106 | it "puts all the static HTML files in the app.yaml file" do
|
111 | 107 | expect(handlers).to include({
|
|
115 | 111 | })
|
116 | 112 | end
|
117 | 113 |
|
118 |
| - # it "does not include assets or any static files that aren't .html" do |
119 |
| - # expect(contents).not_to match /<loc>http:\/\/example\.org\/images\/hubot\.png<\/loc>/ |
120 |
| - # expect(contents).not_to match /<loc>http:\/\/example\.org\/feeds\/atom\.xml<\/loc>/ |
121 |
| - # end |
122 |
| - # |
123 |
| - # it "does include assets or any static files with .xhtml and .htm extensions" do |
124 |
| - # expect(contents).to match /\/some-subfolder\/xhtml\.xhtml/ |
125 |
| - # expect(contents).to match /\/some-subfolder\/htm\.htm/ |
126 |
| - # end |
127 |
| - |
128 | 114 | it "includes the correct number of items" do
|
129 |
| - expect(handlers.length).to eql 15 |
| 115 | + expect(handlers.length).to eql 17 |
130 | 116 | end
|
131 | 117 |
|
132 |
| - # context "with a baseurl" do |
133 |
| - # let(:config) do |
134 |
| - # Jekyll.configuration(Jekyll::Utils.deep_merge_hashes(overrides, {"baseurl" => "/bass"})) |
135 |
| - # end |
136 |
| - # |
137 |
| - # it "correctly adds the baseurl to the static files" do |
138 |
| - # expect(contents).to match /<loc>http:\/\/example\.org\/bass\/some-subfolder\/this-is-a-subfile\.html<\/loc>/ |
139 |
| - # end |
140 |
| - # |
141 |
| - # it "correctly adds the baseurl to the collections" do |
142 |
| - # expect(contents).to match /<loc>http:\/\/example\.org\/bass\/my_collection\/test\.html<\/loc>/ |
143 |
| - # end |
144 |
| - # |
145 |
| - # it "correctly adds the baseurl to the pages" do |
146 |
| - # expect(contents).to match /<loc>http:\/\/example\.org\/bass\/<\/loc>/ |
147 |
| - # expect(contents).to match /<loc>http:\/\/example\.org\/bass\/some-subfolder\/this-is-a-subpage\.html<\/loc>/ |
148 |
| - # end |
149 |
| - # |
150 |
| - # it "correctly adds the baseurl to the posts" do |
151 |
| - # expect(contents).to match /<loc>http:\/\/example\.org\/bass\/2014\/03\/04\/march-the-fourth\.html<\/loc>/ |
152 |
| - # expect(contents).to match /<loc>http:\/\/example\.org\/bass\/2014\/03\/02\/march-the-second\.html<\/loc>/ |
153 |
| - # expect(contents).to match /<loc>http:\/\/example\.org\/bass\/2013\/12\/12\/dec-the-second\.html<\/loc>/ |
154 |
| - # end |
155 |
| - # end |
| 118 | + context "with a base in _config.yml" do |
| 119 | + let(:config) do |
| 120 | + config_override = { "app_engine" => { |
| 121 | + "runtime" => "python27", |
| 122 | + "api_version" => 1 |
| 123 | + } } |
| 124 | + Jekyll.configuration(Jekyll::Utils.deep_merge_hashes(overrides, config_override)) |
| 125 | + end |
| 126 | + |
| 127 | + it "correctly uses _config.yml runtime" do |
| 128 | + expect(app_yaml["runtime"]).to eql "python27" |
| 129 | + end |
| 130 | + end |
156 | 131 | end
|
0 commit comments