|
10 | 10 | let(:site) { Jekyll::Site.new(Jekyll::Configuration.from(user_config)) }
|
11 | 11 | subject { described_class.new(site) }
|
12 | 12 | let!(:stubs) { stub_all_api_requests }
|
| 13 | + let(:unified_payload) { site.site_payload } |
13 | 14 |
|
14 | 15 | context "generating" do
|
15 | 16 | before(:each) do
|
16 | 17 | ENV["JEKYLL_ENV"] = "production"
|
17 | 18 | subject.munge!
|
| 19 | + subject.inject_metadata!(unified_payload) |
18 | 20 | end
|
19 | 21 |
|
20 | 22 | context "with site.github as nil" do
|
21 |
| - it "replaces site.github with the drop" do |
22 |
| - expect(site.config["github"]).to be_a(Liquid::Drop) |
| 23 | + it "sets site.github to the drop" do |
| 24 | + expect(unified_payload.site["github"]).to be_a(Liquid::Drop) |
23 | 25 | end
|
24 | 26 | end
|
25 | 27 |
|
26 | 28 | context "without site.github" do
|
27 | 29 | let(:user_config) { {} }
|
28 | 30 |
|
29 | 31 | it "replaces site.github with the drop" do
|
30 |
| - expect(site.config["github"]).to be_a(Liquid::Drop) |
| 32 | + expect(unified_payload.site["github"]).to be_a(Liquid::Drop) |
31 | 33 | end
|
32 | 34 | end
|
33 | 35 |
|
34 | 36 | context "with site.github as a non-hash" do
|
35 | 37 | let(:github_namespace) { "foo" }
|
36 | 38 |
|
37 | 39 | it "doesn't munge" do
|
38 |
| - expect(site.config["github"]).to eql("foo") |
| 40 | + expect(unified_payload.site["github"]).to eql("foo") |
39 | 41 | end
|
40 | 42 | end
|
41 | 43 |
|
42 | 44 | context "with site.github as a hash" do
|
43 | 45 | let(:github_namespace) { { "source" => { "branch" => "foo" } } }
|
44 | 46 |
|
45 | 47 | it "lets user-specified values override the drop" do
|
46 |
| - expect(site.config["github"].invoke_drop("source")["branch"]).to eql("foo") |
| 48 | + expect(unified_payload.site["github"].invoke_drop("source")["branch"]).to eql("foo") |
47 | 49 | end
|
48 | 50 |
|
49 | 51 | it "still sets other values" do
|
50 |
| - expect(site.config["github"].invoke_drop("source")["path"]).to eql("/") |
| 52 | + expect(unified_payload.site["github"].invoke_drop("source")["path"]).to eql("/") |
51 | 53 | end
|
52 | 54 | end
|
53 | 55 |
|
|
202 | 204 | end
|
203 | 205 |
|
204 | 206 | it "sets the site.github config" do
|
205 |
| - subject.munge! |
206 |
| - expect(site.config["github"]).to be_instance_of(Jekyll::GitHubMetadata::MetadataDrop) |
| 207 | + subject.inject_metadata!(unified_payload) |
| 208 | + expect(unified_payload.site["github"]).to be_instance_of(Jekyll::GitHubMetadata::MetadataDrop) |
207 | 209 | end
|
208 | 210 | end
|
209 | 211 |
|
|
223 | 225 |
|
224 | 226 | it "fails loudly upon call to any drop method" do
|
225 | 227 | subject.munge!
|
| 228 | + subject.inject_metadata!(unified_payload) |
226 | 229 | expect do
|
227 |
| - site.config["github"]["url"] |
| 230 | + unified_payload.site["github"]["url"] |
228 | 231 | end.to raise_error(Jekyll::GitHubMetadata::Client::BadCredentialsError)
|
229 | 232 | end
|
230 | 233 | end
|
|
0 commit comments