Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require File.dirname(__FILE__) + '/../spec_helper'
- describe PostsController do
- fixtures :posts, :users, :categories
- it "should map { :controller => 'posts', :action => 'index' } to /posts" do
- route_for(:controller => "posts", :action => "index").should == "/posts"
- end
- it "should map { :controller => 'posts', :action => 'show' } to /posts/:id" do
- post = create_post
- route_for(:controller => "posts", :action => "show", :id => post.id).should == "/posts/#{:id}"
- end
- it "should map { :controller => 'posts', :action => 'edit } to /posts/:id/edit" do
- post = create_post
- route_for(:controller => "posts", :action => "edit", :id => posts(:first_post).id).should == "/posts/#{:id}/edit"
- end
- def create_post(options = {})
- Post.create({:title => "new post", :body => "This is the body", :user => users(:quentin), :category => categories(:news)}.merge(options))
- end
- end
Add Comment
Please, Sign In to add comment