public
Description: Your favorite URL-shortening service in all of Ruby land
Homepage: http://rubyurl.com
Clone URL: git://github.com/robbyrussell/rubyurl.git
Refactoring action name to be create not new in links

git-svn-id: https://svn.roundhaus.com/planetargon/rubyurl_2-0/trunk@43 
f0bc2f90-cf15-dc11-b192-0016e6374d05
robbyrussell (author)
Mon Jul 16 19:34:25 -0700 2007
commit  67785a1434c3332e21f8b09153b4937a7bcb81c2
tree    6303c82b656f74d99bad0010e1f395223758ab12
parent  e6173f7c67d188a7dccf07dc23209817bf71276b
...
4
5
6
7
 
8
9
10
...
4
5
6
 
7
8
9
10
0
@@ -4,7 +4,7 @@ class LinksController < ApplicationController
0
     @link = Link.new
0
   end
0
 
0
- def new
0
+ def create
0
     @link = Link.find_or_create_by_website_url( params[:link][:website_url] )
0
     @link.ip_address = request.remote_ip if @link.new_record?
0
     
...
6
7
8
9
 
10
11
12
13
14
15
 
16
17
18
...
6
7
8
 
9
10
11
12
13
14
 
15
16
17
18
0
@@ -6,13 +6,13 @@ describe LinksController do
0
   controller_name :links
0
   
0
   it "should not save a new link wihout a website url" do
0
- post :new, :link => valid_attributes.except(:website_url)
0
+ post :create, :link => valid_attributes.except(:website_url)
0
     assigns(:link).should have_at_least(1).errors_on(:website_url)
0
   end
0
   
0
   it "should save a new link with valid attributes" do
0
     lambda do
0
- post :new, :link => valid_attributes
0
+ post :create, :link => valid_attributes
0
     end.should change(Link, :count).by(1)
0
   end
0
 end

Comments

    No one has commented yet.