diff options
Diffstat (limited to 'spec/ruby/library/pathname/sub_spec.rb')
| -rw-r--r-- | spec/ruby/library/pathname/sub_spec.rb | 15 |
1 files changed, 15 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..ad2900f62b --- /dev/null +++ b/spec/ruby/library/pathname/sub_spec.rb @@ -0,0 +1,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 |
