Sha256: b478479e371eab980725a93edb2a3c8f0d38a73aeaf78f80bd97172a96d355f0

Contents?: true

Size: 776 Bytes

Versions: 1

Compression:

Stored size: 776 Bytes

Contents

require "spec_helper"

module Roadie
  describe Utils, "path_is_absolute?" do
    RSpec::Matchers.define :be_absolute do
      match { |path| Utils.path_is_absolute?(path) }
    end

    it "detects absolute HTTP URLs" do
      expect("http://example.com").to be_absolute
      expect("https://example.com").to be_absolute
      expect("https://example.com/path?foo=bar").to be_absolute
    end

    it "detects absolute URLs without schemes" do
      expect("//example.com").to be_absolute
      expect("//").to be_absolute
    end

    it "detects relative URLs without hosts" do
      expect("path/to/me").not_to be_absolute
      expect("/path/to/me").not_to be_absolute
      expect("../../path").not_to be_absolute
      expect("/").not_to be_absolute
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
roadie-3.0.5 spec/lib/roadie/utils_spec.rb