Permalink
Browse files

merged with chapter 5 exersices

  • Loading branch information...
kmoormann committed Mar 29, 2012
1 parent fc20549 commit 4fbcfe4dbbec9415ffe67962e5c82c462a79b35a
View
@@ -0,0 +1,5 @@
+Autotest.add_hook :initialize do |autotest|
+ autotest.add_mapping(%r%^spec/(requests)/.*rb$%) do|filename, _|
+ filename
+ end
+end
@@ -0,0 +1,6 @@
+class UsersController < ApplicationController
+ def new
+ @title = "Sign up"
+ end
+
+end
@@ -0,0 +1,2 @@
+module UsersHelper
+end
@@ -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 pages</a>.
+ To get help on this sample app, see the
+ <a href="http://railstutorial.org/book">Rails Tutorial book</a>
+</p>
@@ -0,0 +1,2 @@
+<h1>Users#new</h1>
+<p>Find me in app/views/users/new.html.erb</p>
View
No changes.
@@ -0,0 +1,18 @@
+require 'spec_helper'
+
+describe UsersController do
+
+ render_views
+
+ describe "GET 'new'" do
+ it "should be successful" do
+ get 'new'
+ response.should be_success
+ end
+
+ it "should have the right title" do
+ get 'new'
+ response.should have_selector("title", :content => "Sign up")
+ end
+ end
+end
@@ -0,0 +1,47 @@
+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
+
+
+ it "should have a Help page at '/help'" do
+ get '/help'
+ response.should have_selector('title', :content => "Help")
+ end
+
+ it "should have a signup page at '/signup'" do
+ get '/signup'
+ response.should have_selector('title', :content => "Sign up")
+ end
+
+ it "should have the right links on the layout" do
+ visit home_path
+ click_link "About"
+ response.should have_selector('title', :content => "About")
+ click_link "Help"
+ response.should have_selector('title', :content => "Help")
+ click_link "Contact"
+ response.should have_selector('title', :content => "Contact")
+ click_link "Home"
+ response.should have_selector('title', :content => "Home")
+ click_link "Sign up now!"
+ response.should have_selector('title', :content => "Sign up")
+ end
+
+end
View
@@ -0,0 +1,25 @@
+# Logfile created on 2012-03-28 21:39:36 -0500 by logger.rb/31641
+REQUESTING PAGE: GET /home with {} and HTTP headers {}
+REQUESTING PAGE: GET /about with {} and HTTP headers {"HTTP_REFERER"=>"/home"}
+REQUESTING PAGE: GET /help with {} and HTTP headers {"HTTP_REFERER"=>"/about"}
+REQUESTING PAGE: GET /contact with {} and HTTP headers {"HTTP_REFERER"=>"/help"}
+REQUESTING PAGE: GET /home with {} and HTTP headers {"HTTP_REFERER"=>"/contact"}
+REQUESTING PAGE: GET /signup with {} and HTTP headers {"HTTP_REFERER"=>"/home"}
+REQUESTING PAGE: GET /home with {} and HTTP headers {}
+REQUESTING PAGE: GET /about with {} and HTTP headers {"HTTP_REFERER"=>"/home"}
+REQUESTING PAGE: GET /help with {} and HTTP headers {"HTTP_REFERER"=>"/about"}
+REQUESTING PAGE: GET /contact with {} and HTTP headers {"HTTP_REFERER"=>"/help"}
+REQUESTING PAGE: GET /home with {} and HTTP headers {"HTTP_REFERER"=>"/contact"}
+REQUESTING PAGE: GET /signup with {} and HTTP headers {"HTTP_REFERER"=>"/home"}
+REQUESTING PAGE: GET /home with {} and HTTP headers {}
+REQUESTING PAGE: GET /about with {} and HTTP headers {"HTTP_REFERER"=>"/home"}
+REQUESTING PAGE: GET /help with {} and HTTP headers {"HTTP_REFERER"=>"/about"}
+REQUESTING PAGE: GET /contact with {} and HTTP headers {"HTTP_REFERER"=>"/help"}
+REQUESTING PAGE: GET /home with {} and HTTP headers {"HTTP_REFERER"=>"/contact"}
+REQUESTING PAGE: GET /signup with {} and HTTP headers {"HTTP_REFERER"=>"/home"}
+REQUESTING PAGE: GET /home with {} and HTTP headers {}
+REQUESTING PAGE: GET /about with {} and HTTP headers {"HTTP_REFERER"=>"/home"}
+REQUESTING PAGE: GET /help with {} and HTTP headers {"HTTP_REFERER"=>"/about"}
+REQUESTING PAGE: GET /contact with {} and HTTP headers {"HTTP_REFERER"=>"/help"}
+REQUESTING PAGE: GET /home with {} and HTTP headers {"HTTP_REFERER"=>"/contact"}
+REQUESTING PAGE: GET /signup with {} and HTTP headers {"HTTP_REFERER"=>"/home"}

0 comments on commit 4fbcfe4

Please sign in to comment.