Permalink
Browse files

Added some specs for routes

  • Loading branch information...
1 parent 48d30da commit 96dfcb60965ed98f5ce036e8c87c1356f5e5852b @Bodacious Bodacious committed Jan 11, 2012
Showing with 20 additions and 2 deletions.
  1. +20 −2 spec/routing/post_routing_spec.rb
View
22 spec/routing/post_routing_spec.rb
@@ -1,12 +1,30 @@
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

0 comments on commit 96dfcb6

Please sign in to comment.