Sha256: 0699056c9952450eaa9470225fc37cd20c80096b05a46f229469456e3af04a2d
Contents?: true
Size: 1.56 KB
Versions: 7
Compression:
Stored size: 1.56 KB
Contents
require "spec_helper" require "microformats/absolute_uri" describe Microformats::AbsoluteUri do describe "#absolutize" do subject { Microformats::AbsoluteUri.new(relative, base: base).absolutize } context "when relative is nil" do let(:relative) { nil } let(:base) { "http://example.com" } it { should eq base } end context "when relative is an empty string" do let(:relative) { "" } let(:base) { "http://example.com" } it { should eq base } end context "when relative is a valid absolute URI" do let(:base) { nil } let(:relative) { "http://google.com" } it { should eq("http://google.com") } end context "when relative is a valid non-absolute URI" do let(:relative) { "bar/qux" } context "and base is present but not absolute" do let(:base) { "foo" } it { should eq("bar/qux") } end context "and base is present and absolute" do let(:base) { "http://google.com" } it { should eq("http://google.com/bar/qux") } end context "and base is not present" do let(:base) { nil } it { should eq("bar/qux") } end context "and base has a subdir" do let(:base) { "http://google.com/asdf.html" } it { should eq("http://google.com/bar/qux") } end end context "when relative is an invalid URI" do let(:base) { nil } let(:relative) { "git@github.com:indieweb/microformats-ruby.git" } it { should eq("git@github.com:indieweb/microformats-ruby.git") } end end end
Version data entries
7 entries across 7 versions & 1 rubygems