Skip to content

Commit

Permalink
Fix (some) issues with test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredcwhite committed Oct 8, 2022
1 parent 4ed524b commit 686c43c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion bridgetown-seo-tag.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions lib/bridgetown-seo-tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion spec/bridgetown_seo_tag/drop_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/bridgetown_seo_tag_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion spec/bridgetown_seo_tag_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 9 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 686c43c

Please sign in to comment.