aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/library/pathname/sub_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/pathname/sub_spec.rb')
-rw-r--r--spec/ruby/library/pathname/sub_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/ruby/library/pathname/sub_spec.rb b/spec/ruby/library/pathname/sub_spec.rb
new file mode 100644
index 0000000000..36b6ebb247
--- /dev/null
+++ b/spec/ruby/library/pathname/sub_spec.rb
@@ -0,0 +1,16 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+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
+