spec/routing/post_routing_spec.rb in blogit-0.4.5 vs spec/routing/post_routing_spec.rb in blogit-0.4.6
- old
+ new
@@ -1,13 +1,31 @@
require "spec_helper"
-# TODO: Find out how to spec routes in a Mounted engine :S
describe PostsController do
+
describe "routing" do
before do
- Blogit.configuration.include_admin_actions = true
+ # Use blogit's routes instead
+ @routes = Blogit::Engine.routes
end
+
+ it "routes /posts/page/:page to posts#index with page param" do
+ { get: "posts/page/2" }.should route_to({
+ controller: "blogit/posts",
+ action: "index",
+ page: "2"
+ })
+ end
+
+ it "routes /posts/tagged/:tag to posts#tagged with tag param" do
+ { get: "posts/tagged/Spiceworld" }.should route_to({
+ controller: "blogit/posts",
+ action: "tagged",
+ tag: "Spiceworld"
+ })
+ end
+
describe "when Blogit.configuration.include_admin_actions is true" do
before do
Blogit.configuration.include_admin_actions = true