Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- fixed the rails root to rails 2.0.2

- updated the rails root to rails 2 standards
- added .autotest file to fix autotest
- fixed bug in determining the resource path



git-svn-id: https://svn.thoughtbot.com/plugins/shoulda/trunk@286 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
  • Loading branch information...
commit 46f8ff243700e15bc6c4b1b08a4494ba7c9559c9 1 parent 91a3bb5
tsaleh authored
View
8 .autotest
@@ -0,0 +1,8 @@
+Autotest.add_hook :initialize do |at|
+ at.add_mapping(%r{^test/rails_root/\w.*}) do
+ at.files_matching(%r{^test/*/\w.*_test\.rb})
+ end
+
+ at.add_exception(%r{.svn})
+ at.add_exception(%r{.log$})
+end
View
2  lib/shoulda/controller_tests/controller_tests.rb
@@ -244,7 +244,7 @@ def normalize!(target) # :nodoc:
@parent ||= []
@parent = [@parent] unless @parent.is_a? Array
- collection_helper = [@parent, @object.pluralize, 'url'].flatten.join('_')
+ collection_helper = [@parent, @object.to_s.pluralize, 'url'].flatten.join('_')
collection_args = @parent.map {|n| "@#{object}.#{n}"}.join(', ')
@destroy.redirect ||= "#{collection_helper}(#{collection_args})"
View
8 test/rails_root/app/controllers/posts_controller.rb
@@ -34,8 +34,8 @@ def create
respond_to do |format|
if @post.save
flash[:notice] = 'Post was successfully created.'
- format.html { redirect_to post_url(@post.user, @post) }
- format.xml { head :created, :location => post_url(@post.user, @post) }
+ format.html { redirect_to user_post_url(@post.user, @post) }
+ format.xml { head :created, :location => user_post_url(@post.user, @post) }
else
format.html { render :action => "new" }
format.xml { render :xml => @post.errors.to_xml }
@@ -49,7 +49,7 @@ def update
respond_to do |format|
if @post.update_attributes(params[:post])
flash[:notice] = 'Post was successfully updated.'
- format.html { redirect_to post_url(@post.user, @post) }
+ format.html { redirect_to user_post_url(@post.user, @post) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
@@ -65,7 +65,7 @@ def destroy
flash[:notice] = "Post was removed"
respond_to do |format|
- format.html { redirect_to posts_url(@post.user) }
+ format.html { redirect_to user_posts_url(@post.user) }
format.xml { head :ok }
end
end
View
6 test/rails_root/app/views/posts/edit.rhtml
@@ -2,7 +2,7 @@
<%= error_messages_for :post %>
-<% form_for(:post, :url => post_path(@post.user, @post), :html => { :method => :put }) do |f| %>
+<% form_for(:post, :url => user_post_path(@post.user, @post), :html => { :method => :put }) do |f| %>
<p>
<b>User</b><br />
<%= f.text_field :user_id %>
@@ -23,5 +23,5 @@
</p>
<% end %>
-<%= link_to 'Show', post_path(@post.user, @post) %> |
-<%= link_to 'Back', posts_path(@post.user) %>
+<%= link_to 'Show', user_post_path(@post.user, @post) %> |
+<%= link_to 'Back', user_posts_path(@post.user) %>
View
9 test/rails_root/app/views/posts/index.rhtml
@@ -12,13 +12,14 @@
<td><%=h post.user_id %></td>
<td><%=h post.title %></td>
<td><%=h post.body %></td>
- <td><%= link_to 'Show', post_path(post.user, post) %></td>
- <td><%= link_to 'Edit', edit_post_path(post.user, post) %></td>
- <td><%= link_to 'Destroy', post_path(post.user, post), :confirm => 'Are you sure?', :method => :delete %></td>
+ <td><%= link_to 'Show', user_post_path(post.user, post) %></td>
+ <td><%= link_to 'Edit', edit_user_post_path(post.user, post) %></td>
+ <td><%= link_to 'Destroy', user_post_path(post.user, post), :confirm => 'Are you sure?',
+ :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
-<%= link_to 'New post', new_post_path(post.user) %>
+<%= link_to 'New post', new_user_post_path(post.user) %>
View
4 test/rails_root/app/views/posts/new.rhtml
@@ -2,7 +2,7 @@
<%= error_messages_for :post %>
-<% form_for(:post, :url => posts_path(@user)) do |f| %>
+<% form_for(:post, :url => user_posts_path(@user)) do |f| %>
<p>
<b>User</b><br />
<%= f.text_field :user_id %>
@@ -23,4 +23,4 @@
</p>
<% end %>
-<%= link_to 'Back', posts_path(@user) %>
+<%= link_to 'Back', user_posts_path(@user) %>
View
4 test/rails_root/app/views/posts/show.rhtml
@@ -14,5 +14,5 @@
</p>
-<%= link_to 'Edit', edit_post_path(@post.user, @post) %> |
-<%= link_to 'Back', posts_path(@post.user) %>
+<%= link_to 'Edit', edit_user_post_path(@post.user, @post) %> |
+<%= link_to 'Back', user_posts_path(@post.user) %>
View
7 test/rails_root/config/environment.rb
@@ -1,6 +1,6 @@
# Specifies gem version of Rails to use when vendor/rails is not present
old_verbose, $VERBOSE = $VERBOSE, nil
-RAILS_GEM_VERSION = '1.2.3'
+RAILS_GEM_VERSION = '2.0.2'
$VERBOSE = old_verbose
require File.join(File.dirname(__FILE__), 'boot')
@@ -12,8 +12,7 @@
config.log_level = :debug
config.cache_classes = false
config.whiny_nils = true
- config.breakpoint_server = true
- config.load_paths << File.join(File.dirname(__FILE__), *%w{.. .. .. lib})
+ # config.load_paths << File.join(File.dirname(__FILE__), *%w{.. .. .. lib})
end
-Dependencies.log_activity = true
+# Dependencies.log_activity = true
View
7 test/rails_root/config/routes.rb
@@ -1,5 +1,6 @@
ActionController::Routing::Routes.draw do |map|
- map.resources :users do |user|
- user.resources :posts
- end
+
+ map.resources :posts
+ map.resources :users, :has_many => :posts
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.