aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/library/pathname/sub_spec.rb
blob: 2fb274e7901cf7d7a0f492f5fd76d9c306d4bd35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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