spec/private/rack/route_spec.rb in usher-0.7.4 vs spec/private/rack/route_spec.rb in usher-0.7.5
- old
+ new
@@ -19,9 +19,25 @@
it "should redirect '/index.html' to '/'" do
@route_set.get("/index.html").redirect("/")
status, headers, body = @route_set.call(@env)
headers["Location"].should eql("/")
end
+
+ it "should redirect '/:id.html' to '/:id'" do
+ @route_set.get("/:id.html").redirect('/#{params[:id]}')
+ @env = Rack::MockRequest.env_for("/123.html")
+ status, headers, body = @route_set.call(@env)
+ headers["Location"].should eql("/123")
+ end
+ end
+
+ describe "static file serving" do
+ it "should serve from a static directory" do
+ @route_set.get("/static").serves_static_from(File.dirname(__FILE__))
+ @env = Rack::MockRequest.env_for("/static/#{File.basename(__FILE__)}")
+ status, headers, body = @route_set.call(@env)
+ body.path.should == File.join(File.dirname(__FILE__), File.basename(__FILE__))
+ end
end
describe "chaining" do
it "should be chainable" do
@route_set.get("/index.html").redirect("/").name(:root)