Skip to content

Commit 8e7eec2

Browse files
author
Raven
committed
Finished layout and routes
1 parent 2f8afda commit 8e7eec2

File tree

7 files changed

+63
-1
lines changed

7 files changed

+63
-1
lines changed

app/controllers/users_controller.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class UsersController < ApplicationController
2+
3+
def new
4+
@title = "Sign up"
5+
end
6+
7+
end

app/helpers/users_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module UsersHelper
2+
end

app/views/pages/home.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
sample application.
66
</p>
77

8-
<%= link_to "#", :class => "button" do %>
8+
<%= link_to "signup", :class => "button" do %>
99
<span class="plus icon"></span>Sign up now!
1010
<%end%>
1111

app/views/users/new.html.erb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<h1>Users#new</h1>
2+
<p>Find me in app/views/users/new.html.erb</p>

config/routes.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
MicroTwitter::Application.routes.draw do
2+
get "users/new"
3+
24
root :to => 'pages#home'
35

46
match '/contact', :to => 'pages#contact'
@@ -7,6 +9,8 @@
79

810
match '/help', :to => 'pages#help'
911

12+
match '/signup', :to => 'users#new'
13+
1014
# The priority is based upon order of creation:
1115
# first created -> highest priority.
1216

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
require 'spec_helper'
2+
3+
describe UsersController do
4+
render_views
5+
6+
describe "GET 'new'" do
7+
it "should be successful" do
8+
get 'new'
9+
response.should be_success
10+
end
11+
12+
it "should have the right title" do
13+
get 'new'
14+
response.should have_selector("title", :content => "Sign up")
15+
end
16+
end
17+
end

spec/requests/layout_links_spec.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
require 'spec_helper'
2+
3+
describe "LayoutLinks" do
4+
5+
it "should have a Home page at '/'" do
6+
get '/'
7+
response.should have_selector('title', :content => "Home")
8+
end
9+
10+
it "should have a Contact page at '/contact'" do
11+
get '/contact'
12+
response.should have_selector('title', :content => "Contact")
13+
end
14+
15+
it "should have an About page at '/about'" do
16+
get '/about'
17+
response.should have_selector('title', :content => "About")
18+
end
19+
20+
it "should have a Help page at '/help'" do
21+
get '/help'
22+
response.should have_selector('title', :content => "Help")
23+
end
24+
25+
it "should have a signup page at '/signup'" do
26+
get '/help'
27+
response.should have_selector('title', :content => "Sign up")
28+
end
29+
30+
end

0 commit comments

Comments
 (0)