Sha256: e8f8fe7d26f48ce65aa636d6a8f2e4a6372b43d900592a54ad53c74320eba51c
Contents?: true
Size: 1.43 KB
Versions: 4
Compression:
Stored size: 1.43 KB
Contents
# frozen_string_literal: true class RedirectableTestHelper include JekyllRedirectFrom::Redirectable attr_reader :to_liquid def initialize(data) @to_liquid = data end end RSpec.describe JekyllRedirectFrom::Redirectable do let(:data) { "" } subject { RedirectableTestHelper.new(data) } context "with strings" do let(:data) { { "redirect_from" => "/foo", "redirect_to" => "/bar" } } it "returns redirect_from" do expect(subject.redirect_from).to eql(["/foo"]) end it "returns redirect_to" do expect(subject.redirect_to).to eql("/bar") end end context "with arrays" do let(:data) { { "redirect_from" => ["/foo"], "redirect_to" => ["/bar"] } } it "returns redirect_from" do expect(subject.redirect_from).to eql(["/foo"]) end it "returns redirect_to" do expect(subject.redirect_to).to eql("/bar") end end context "with fields missing" do let(:data) { {} } it "returns an empty array for redirect_from" do expect(subject.redirect_from).to eql([]) end it "returns nil for redirect_to" do expect(subject.redirect_to).to be_nil end end context "with nils" do let(:data) { { "redirect_from" => nil, "redirect_to" => nil } } it "returns an empty array for redirect_from" do expect(subject.redirect_from).to eql([]) end it "returns nil for redirect_to" do expect(subject.redirect_to).to be_nil end end end
Version data entries
4 entries across 4 versions & 1 rubygems