From 686c43c075c077845162ed0be1019da60775ce00 Mon Sep 17 00:00:00 2001 From: Jared White Date: Sat, 8 Oct 2022 16:27:17 -0700 Subject: [PATCH] Fix (some) issues with test suite --- bridgetown-seo-tag.gemspec | 2 +- lib/bridgetown-seo-tag.rb | 4 ++-- spec/bridgetown_seo_tag/drop_spec.rb | 2 +- spec/bridgetown_seo_tag_integration_spec.rb | 4 ++-- spec/bridgetown_seo_tag_spec.rb | 2 +- spec/spec_helper.rb | 13 +++++++++---- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/bridgetown-seo-tag.gemspec b/bridgetown-seo-tag.gemspec index c13592c..d4ca950 100644 --- a/bridgetown-seo-tag.gemspec +++ b/bridgetown-seo-tag.gemspec @@ -16,7 +16,7 @@ Gem::Specification.new do |spec| spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|script|spec|features)/!) } spec.require_paths = ["lib"] - spec.add_dependency "bridgetown", ">= 1.2.0.beta1", "< 2.0" + spec.add_dependency "bridgetown", ">= 1.2.0.beta2", "< 2.0" spec.add_development_dependency "bundler", ">= 1.15" spec.add_development_dependency "html-proofer", "~> 3.7" diff --git a/lib/bridgetown-seo-tag.rb b/lib/bridgetown-seo-tag.rb index 401967d..e89cbcc 100644 --- a/lib/bridgetown-seo-tag.rb +++ b/lib/bridgetown-seo-tag.rb @@ -94,6 +94,6 @@ def template_path Liquid::Template.register_tag("seo", Bridgetown::SeoTag) require "bridgetown-seo-tag/builder" -Bridgetown.initializer :"bridgetown-seo-tag" do - builder Bridgetown::SeoTag::Builder +Bridgetown.initializer :"bridgetown-seo-tag" do |config| + config.builder Bridgetown::SeoTag::Builder end diff --git a/spec/bridgetown_seo_tag/drop_spec.rb b/spec/bridgetown_seo_tag/drop_spec.rb index e53a3a4..b464bf0 100644 --- a/spec/bridgetown_seo_tag/drop_spec.rb +++ b/spec/bridgetown_seo_tag/drop_spec.rb @@ -493,7 +493,7 @@ context "when canonical url is not specified for a page" do it "uses site specific canonical url" do - expect(subject.canonical_url).to eq("http://example.com/page.html") + expect(subject.canonical_url).to eq("http://example.com/page/") end end end diff --git a/spec/bridgetown_seo_tag_integration_spec.rb b/spec/bridgetown_seo_tag_integration_spec.rb index 1fb2ccb..6ac9e53 100755 --- a/spec/bridgetown_seo_tag_integration_spec.rb +++ b/spec/bridgetown_seo_tag_integration_spec.rb @@ -13,7 +13,7 @@ let(:paginator) { { "previous_page" => true, "previous_page_path" => "foo", "next_page" => true, "next_page_path" => "bar" } } let(:page) do make_page.yield_self do |page| - page.pager = paginator + page.paginator = paginator page end end @@ -51,7 +51,7 @@ let(:post_output) do site.read site.data.site_metadata = { title: "Site name" } - Bridgetown::Renderer.new(site, post).run + post.transform! post.output end diff --git a/spec/bridgetown_seo_tag_spec.rb b/spec/bridgetown_seo_tag_spec.rb index bafdf1d..cb54f53 100644 --- a/spec/bridgetown_seo_tag_spec.rb +++ b/spec/bridgetown_seo_tag_spec.rb @@ -38,7 +38,7 @@ end it "contains the page" do - expect(payload["page"]).to be_a(Bridgetown::Page) + expect(payload["page"]).to be_a(Bridgetown::GeneratedPage) end it "contains the site" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 02d99bd..ef8bbc1 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,6 +2,9 @@ $LOAD_PATH.unshift File.expand_path("../lib", __dir__) require "bridgetown" + +Bridgetown.begin! + # rubocop:disable Lint/Void Bridgetown::Site # resolve weird autoload issue # rubocop:enable Lint/Void @@ -38,16 +41,18 @@ def dest_dir }.freeze def make_page(options = {}) - page = Bridgetown::Page.new site, CONFIG_DEFAULTS["source"], "", "page.md" - page.data = options + page = Bridgetown::GeneratedPage.new site, CONFIG_DEFAULTS["source"], "", "page.md" + page.data = options.with_dot_access page end def make_post(options = {}) filename = File.expand_path("_posts/2015-01-01-post.md", CONFIG_DEFAULTS["source"]) config = { site: site, collection: site.collections["posts"] } - page = Bridgetown::Document.new filename, config - page.merge_data!(options) + origin = Bridgetown::Model::RepoOrigin.new_with_collection_path(:posts, "_posts/2015-01-01-post.md") + page = Bridgetown::Model::Base.new(origin.read).to_resource +# page = Bridgetown::Resource::Base.new filename, config + page.data.merge!(options) page end