Created
April 16, 2009 04:05
-
-
Save diegorv/96206 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | |
| describe EmployeesController do | |
| describe "route generation" do | |
| it "maps #index" do | |
| route_for(:controller => "employees", :action => "index").should == "/employees" | |
| end | |
| it "maps #new" do | |
| route_for(:controller => "employees", :action => "new").should == "/employees/new" | |
| end | |
| it "maps #show" do | |
| route_for(:controller => "employees", :action => "show", :id => "1").should == "/employees/1" | |
| end | |
| it "maps #edit" do | |
| route_for(:controller => "employees", :action => "edit", :id => "1").should == "/employees/1/edit" | |
| end | |
| it "maps #create" do | |
| route_for(:controller => "employees", :action => "create").should == {:path => "/employees", :method => :post} | |
| end | |
| it "maps #update" do | |
| route_for(:controller => "employees", :action => "update", :id => "1").should == {:path =>"/employees/1", :method => :put} | |
| end | |
| it "maps #destroy" do | |
| route_for(:controller => "employees", :action => "destroy", :id => "1").should == {:path =>"/employees/1", :method => :delete} | |
| end | |
| end | |
| describe "route recognition" do | |
| it "generates params for #index" do | |
| params_from(:get, "/employees").should == {:controller => "employees", :action => "index"} | |
| end | |
| it "generates params for #new" do | |
| params_from(:get, "/employees/new").should == {:controller => "employees", :action => "new"} | |
| end | |
| it "generates params for #create" do | |
| params_from(:post, "/employees").should == {:controller => "employees", :action => "create"} | |
| end | |
| it "generates params for #show" do | |
| params_from(:get, "/employees/1").should == {:controller => "employees", :action => "show", :id => "1"} | |
| end | |
| it "generates params for #edit" do | |
| params_from(:get, "/employees/1/edit").should == {:controller => "employees", :action => "edit", :id => "1"} | |
| end | |
| it "generates params for #update" do | |
| params_from(:put, "/employees/1").should == {:controller => "employees", :action => "update", :id => "1"} | |
| end | |
| it "generates params for #destroy" do | |
| params_from(:delete, "/employees/1").should == {:controller => "employees", :action => "destroy", :id => "1"} | |
| end | |
| end | |
| end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment