spec/galago/router/path_spec.rb in galago-router-0.1.0 vs spec/galago/router/path_spec.rb in galago-router-0.1.1
- old
+ new
@@ -1,9 +1,26 @@
require 'spec_helper'
module Galago
describe Router::Path do
+ describe ".join" do
+ it "joins the provided segments with a '/'" do
+ path = Router::Path.join('foo', 'bar')
+ expect(path).to eql '/foo/bar'
+ end
+
+ it "removes repeated '/'" do
+ path = Router::Path.join('//foo', '///bar', '/baz')
+ expect(path).to eql '/foo/bar/baz'
+ end
+
+ it "removes trailing '/'" do
+ path = Router::Path.join('foo', 'bar/')
+ expect(path).to eql '/foo/bar'
+ end
+ end
+
describe "#recognizes?" do
it "recognizes exact matches" do
path = Router::Path.new('/users')
expect(path).to be_recognizes '/users'
end