spec/grapher_spec.rb in joshbuddy-usher-0.3.2 vs spec/grapher_spec.rb in joshbuddy-usher-0.3.3
- old
+ new
@@ -17,9 +17,14 @@
route_set.add_route('/:a/:b')
route_set.add_route('/:a/:b/:c')
route_set.generate_url(nil, {:a => 'A', :b => 'B', :c => 'C'}).should == '/A/B/C'
end
+ it "should fail to generate a route when none matches" do
+ route_set.add_route('/:a/:b')
+ proc {route_set.generate_url(nil, {:c => 'C', :d => 'D'}) }.should raise_error Usher::UnrecognizedException
+ end
+
it "should find the most specific route and append extra parts on as a query string" do
route_set.add_route('/:a/:b/:c')
route_set.add_route('/:a/:b')
route_set.generate_url(nil, {:a => 'A', :b => 'B', :d => 'C'}).should == '/A/B?d=C'
end
\ No newline at end of file