jekyll / jekyll-redirect-from

:twisted_rightwards_arrows: Seamlessly specify multiple redirections URLs for your pages and posts.
MIT License
780 stars 112 forks source link

Allow redirects from and for subclasses of page and document #204

Closed radoslavkarlik closed 4 years ago

radoslavkarlik commented 5 years ago

Implements the issue #203

parkr commented 5 years ago

Thank you so much! The code looks great. Let's get a quick test in here.

In spec/jekyll_redirect_from/generator_spec.rb, let's add:

context "redirectable_document?" do
  let(:generator) { JekyllRedirectFrom::Generator.new }
  it "accepts subclasses of Jekyll::Document" do
    SubclassOfJekyllDocument = Class.new(Jekyll::Document)
    expect(generator.send(:redirectable_document?, SubclassOfJekyllDocument.new)).to be_truthy
  end

  it "accepts subclasses of Jekyll::Document" do
    SubclassOfJekyllPage = Class.new(Jekyll::Page)
    expect(generator.send(:redirectable_document?, SubclassOfJekyllPage.new)).to be_truthy
  end
end

I haven't run the above code but hopefully it gets you started. 🚀

radoslavkarlik commented 4 years ago

Sorry guys, busy life happened. I have added the tests with a little modification.

DirtyF commented 4 years ago

@jekyllbot: merge +minor