Skip to content

Commit 013b933

Browse files
committed
tests for home page
1 parent 00290da commit 013b933

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

app/controllers/pages_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def page
1414
end
1515

1616
def ensure_valid
17-
unless %w(home_page).include? page
17+
unless %w(home).include? page
1818
render :nothing => true, :status => 404 and return false
1919
end
2020
end

app/views/pages/home.html.erb

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<div class="span-16">
2+
3+
<h2>Welcome to Portfolio App</h2>
4+
5+
<%= render :partial => 'users/form', :locals => {:user => User.new} %>
6+
</div>

app/views/pages/home_page.html.erb

-6
This file was deleted.

config/routes.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@
5454
# end
5555

5656
# You can have the root of your site routed with map.root -- just remember to delete public/index.html.
57-
map.root :controller => 'pages', :action => 'home_page'
57+
map.root :controller => 'pages', :action => 'home'
5858

5959
end
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require File.dirname(__FILE__) + '/../test_helper'
2+
3+
class PagesControllerTest < ActionController::TestCase
4+
5+
test "Should show home page" do
6+
get :show, :id => 'home'
7+
assert_response :success
8+
end
9+
10+
end

0 commit comments

Comments
 (0)