Sha256: 11463eacd0fbd54f92cc73b9271e446122fc8544f3e2a28e6d88167b4d157079

Contents?: true

Size: 777 Bytes

Versions: 8

Compression:

Stored size: 777 Bytes

Contents

require 'ronin/path'

require 'spec_helper'

describe Path do
  before(:all) do
    @n = 7
    @range = (7..10)
    @sub_path = File.join('one','two')
    @sub_directory = 'three'
  end

  it "should inherit from Pathname" do
    Path.superclass.should == Pathname
  end

  it "should create directory-escaping paths" do
    Path.up(@n).to_s.should == File.join(*(['..'] * @n))
  end

  it "should create a range of directory-escaping paths" do
    Path.up(@range).should == @range.map { |i| Path.up(i) }
  end

  it "should join with sub-paths" do
    Path.up(@n).join(@sub_path).to_s.should == File.join(Path.up(@n),@sub_path)
  end

  it "should join with a sub-directory" do
    (Path.up(@n) / @sub_directory).to_s.should == File.join(Path.up(@n),@sub_directory)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ronin-0.3.0 spec/path_spec.rb
ronin-0.2.4 spec/path_spec.rb
ronin-0.1.4 spec/path_spec.rb
ronin-0.1.3 spec/path_spec.rb
ronin-0.2.2 spec/path_spec.rb
ronin-0.2.0 spec/path_spec.rb
ronin-0.2.1 spec/path_spec.rb
ronin-0.2.3 spec/path_spec.rb