Sha256: f1a5b0e5d61d53859048bdb30d65a42dbaf49a3b8cc9a42837ed049e9bac51f0

Contents?: true

Size: 1007 Bytes

Versions: 6

Compression:

Stored size: 1007 Bytes

Contents

# frozen_string_literal: true

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

  describe Utils, "warn" do
    it "passes the message on to Kernel.warn" do
      expect(Kernel).to receive(:warn).with("Roadie: Hello from specs")
      Utils.warn "Hello from specs"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
roadie-5.2.1 spec/lib/roadie/utils_spec.rb
roadie-5.2.0 spec/lib/roadie/utils_spec.rb
roadie-5.1.0 spec/lib/roadie/utils_spec.rb
roadie-5.0.1 spec/lib/roadie/utils_spec.rb
roadie-5.0.0 spec/lib/roadie/utils_spec.rb
roadie-4.0.0 spec/lib/roadie/utils_spec.rb