Permalink
Browse files

Added layout links(with routes)

  • Loading branch information...
1 parent a2e645e commit 3e1fb861e6427d0092cbfa17526d84888a735002 @esnake0 committed Mar 29, 2012
@@ -12,4 +12,8 @@ def about
@title = "About"
end
+ def help
+ @title = "Help"
+ end
+
end
@@ -1,7 +1,8 @@
<footer>
<nav class="round">
<ul>
- <li><%= link_to "About", '#' %></li>
- <li><%= link_to "Contact", '#' %></li>
+ <li><%= link_to "About", about_path %></li>
+ <li><%= link_to "Contact", contact_path %></li>
</ul>
+ </nav>
</footer>
@@ -2,9 +2,9 @@
<%= image_tag("logo.png", :alt => "Sample App", :class => "round") %>
<nav class="round">
<ul>
- <li><%= link_to "Home", '#' %></li>
- <li><%= link_to "Help", '#' %></li>
- <li><%= link_to "Sign in", '#' %></li>
+ <li><%= link_to "Home", root_path %></li>
+ <li><%= link_to "Help", help_path %></li>
+ <li><%= link_to "Sign in", '#'%></li>
</ul>
</nav>
</header>
@@ -0,0 +1,7 @@
+<h1>Help</h1>
+<p>
+ Get help on Ruby on Rails Tutorial at the
+ <a href="http://railstutorial.org/help">Rails Tutorial help page</a>.
+ To get help on this sample app, see the
+ <a href="http://railstutorial.org/book">Rails Tutorial book</a>.
+</p>
View
@@ -1,9 +1,10 @@
SampleApp::Application.routes.draw do
- get "pages/home"
- get "pages/contact"
+ root :to => "pages#home"
- get "pages/about"
+ match '/contact', :to => 'pages#contact'
+ match '/about', :to => 'pages#about'
+ match '/help', :to => 'pages#help'
# The priority is based upon order of creation:
# first created -> highest priority.
@@ -19,9 +19,12 @@ section {
margin-top: 1em;
font_size: 120%;
padding: 20px;
- background: #fff
+ background: #fff;
}
+section h1 {
+ font-size: 200%;
+}
/* links */
@@ -49,4 +49,17 @@
end
+ describe "GET 'help'" do
+ it "should be successful" do
+ get 'help'
+ response.should be_success
+ end
+
+ it "should have the right title" do
+ get 'help'
+ response.should have_selector("title", :content => "#@base_title | Help")
+ end
+
+ end
+
end
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+describe "LayoutLinks" do
+
+ it "should have a Home page at '/'" do
+ get '/'
+ response.should have_selector('title', :content => "Home")
+ end
+
+ it "should have a Contact page at '/contact'" do
+ get '/contact'
+ response.should have_selector('title', :content => "Contact")
+ end
+
+ it "should have a About page at '/about'" do
+ get '/about'
+ response.should have_selector('title', :content => "About")
+ end
+
+
+end

0 comments on commit 3e1fb86

Please sign in to comment.