Sha256: adfc2bc027b4c8c7b507071555d19b6360c58b552961068bb01431dbd88b7e44

Contents?: true

Size: 976 Bytes

Versions: 10

Compression:

Stored size: 976 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

  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

10 entries across 10 versions & 1 rubygems

Version Path
roadie-3.5.1 spec/lib/roadie/utils_spec.rb
roadie-3.5.0 spec/lib/roadie/utils_spec.rb
roadie-3.4.0 spec/lib/roadie/utils_spec.rb
roadie-3.3.0 spec/lib/roadie/utils_spec.rb
roadie-3.2.2 spec/lib/roadie/utils_spec.rb
roadie-3.2.1 spec/lib/roadie/utils_spec.rb
roadie-3.2.0 spec/lib/roadie/utils_spec.rb
roadie-3.1.1 spec/lib/roadie/utils_spec.rb
roadie-3.1.0 spec/lib/roadie/utils_spec.rb
roadie-3.1.0.rc1 spec/lib/roadie/utils_spec.rb