Converted Rates routing test to Test::Unit.

This commit is contained in:
Eric Davis
2010-07-23 08:18:37 -07:00
parent 5b372b2bef
commit 44963ac96b
2 changed files with 16 additions and 59 deletions

View File

@@ -1,59 +0,0 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe RatesController do
describe "route generation" do
it "should map #index" do
route_for(:controller => "rates", :action => "index").should == "/rates"
end
it "should map #new" do
route_for(:controller => "rates", :action => "new").should == "/rates/new"
end
it "should map #show" do
route_for(:controller => "rates", :action => "show", :id => 1).should == "/rates/1"
end
it "should map #edit" do
route_for(:controller => "rates", :action => "edit", :id => 1).should == "/rates/1/edit"
end
it "should map #update" do
route_for(:controller => "rates", :action => "update", :id => 1).should == "/rates/1"
end
it "should map #destroy" do
route_for(:controller => "rates", :action => "destroy", :id => 1).should == "/rates/1"
end
end
describe "route recognition" do
it "should generate params for #index" do
params_from(:get, "/rates").should == {:controller => "rates", :action => "index"}
end
it "should generate params for #new" do
params_from(:get, "/rates/new").should == {:controller => "rates", :action => "new"}
end
it "should generate params for #create" do
params_from(:post, "/rates").should == {:controller => "rates", :action => "create"}
end
it "should generate params for #show" do
params_from(:get, "/rates/1").should == {:controller => "rates", :action => "show", :id => "1"}
end
it "should generate params for #edit" do
params_from(:get, "/rates/1/edit").should == {:controller => "rates", :action => "edit", :id => "1"}
end
it "should generate params for #update" do
params_from(:put, "/rates/1").should == {:controller => "rates", :action => "update", :id => "1"}
end
it "should generate params for #destroy" do
params_from(:delete, "/rates/1").should == {:controller => "rates", :action => "destroy", :id => "1"}
end
end
end

View File

@@ -0,0 +1,16 @@
require "#{File.dirname(__FILE__)}/../test_helper"
class RoutingTest < ActionController::IntegrationTest
context "routing rates" do
should_route :get, "/rates", :controller => "rates", :action => "index"
should_route :get, "/rates/new", :controller => "rates", :action => "new"
should_route :get, "/rates/1", :controller => "rates", :action => "show", :id => "1"
should_route :get, "/rates/1/edit", :controller => "rates", :action => "edit", :id => "1"
should_route :post, "/rates", :controller => "rates", :action => "create"
should_route :put, "/rates/1", :controller => "rates", :action => "update", :id => "1"
should_route :delete, "/rates/1", :controller => "rates", :action => "destroy", :id => "1"
end
end