summaryrefslogtreecommitdiff
path: root/spec/ruby/library/pathname/sub_spec.rb
blob: ad2900f62bb2ea1406d7ae1ce1ca64514307cc45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require_relative '../../spec_helper'
require 'pathname'

describe "Pathname#sub" do

  it "replaces the pattern with rest" do
    Pathname.new('/usr/local/bin/').sub(/local/, 'fish').to_s.should == '/usr/fish/bin/'
  end

  it "returns a new object" do
    p = Pathname.new('/usr/local/bin/')
    p.sub(/local/, 'fish').should_not == p
  end

end