Browse files

Added a stub User show page

  • Loading branch information...
1 parent 093b559 commit 11d1f77c91cffaf62ac53f59f74a3b9ff486ef0c @Boo-urns committed Apr 7, 2011
View
8 Gemfile
@@ -5,9 +5,11 @@ gem 'rails', '3.0.5'
gem 'sqlite3'
group :development do
- gem 'rspec-rails', '2.0.0.beta.18'
+ gem 'rspec-rails'
+ gem 'webrat', '0.7.1'
end
group :test do
- gem 'rspec-rails', '2.0.0.beta.18'
-end
+ gem 'rspec-rails'
+ gem 'webrat', '0.7.1'
+ end
View
5 Gemfile.lock
@@ -77,7 +77,7 @@ GEM
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.25)
- webrat (0.7.3)
+ webrat (0.7.1)
nokogiri (>= 1.2.0)
rack (>= 1.0)
rack-test (>= 0.5.3)
@@ -87,5 +87,6 @@ PLATFORMS
DEPENDENCIES
rails (= 3.0.5)
- rspec-rails (= 2.0.0.beta.18)
+ rspec-rails
sqlite3
+ webrat (= 0.7.1)
View
3 app/controllers/users_controller.rb
@@ -3,4 +3,7 @@ def new
@title = "Sign up"
end
+ def show
+ @user = User.find(params[:id])
+ end
end
View
1 app/views/layouts/application.html.erb
@@ -14,6 +14,7 @@
</section>
<%= render 'layouts/footer' %>
+ <%= debug(params) if Rails.env.development? %>
</div>
View
1 app/views/users/show.html.erb
@@ -0,0 +1 @@
+<%= @user.name %>, <%= @user.email %>
View
2 config/routes.rb
@@ -1,5 +1,5 @@
Railstut::Application.routes.draw do
- get "users/new"
+ resources :users
root :to => "pages#home"
View
9 db/migrate/20110407181946_add_email_uniqueness_index.rb
@@ -0,0 +1,9 @@
+class AddEmailUniquenessIndex < ActiveRecord::Migration
+ def self.up
+ add_index :users, :email, :unique => true
+ end
+
+ def self.down
+ remove_index :users, :email
+ end
+end
View
4 db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20110404222038) do
+ActiveRecord::Schema.define(:version => 20110407181946) do
create_table "users", :force => true do |t|
t.string "name"
@@ -19,4 +19,6 @@
t.datetime "updated_at"
end
+ add_index "users", ["email"], :name => "index_users_on_email", :unique => true
+
end
View
86 spec/requests/layout_links_spec.rb
@@ -1,43 +1,43 @@
-# 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 an 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" domain
-# visit root_path
-# response.should have_selector('title', :content => "Home")
-# click_link "About"
-# response.should have_selector('title', :content => "About")
-# 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")
-# response.should have_selector('a[href="/"]>img')
-# end
-# end
+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 an 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 root_path
+ response.should have_selector('title', :content => "Home")
+ click_link "About"
+ response.should have_selector('title', :content => "About")
+ 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")
+ response.should have_selector('a[href="/"]>img')
+ end
+end
View
6 webrat.log
@@ -0,0 +1,6 @@
+# Logfile created on Thu Apr 07 08:50:37 -0500 2011 by logger.rb/22285
+REQUESTING PAGE: GET / with {} and HTTP headers {}
+REQUESTING PAGE: GET /about with {} and HTTP headers {"HTTP_REFERER"=>"/"}
+REQUESTING PAGE: GET /contact with {} and HTTP headers {"HTTP_REFERER"=>"/about"}
+REQUESTING PAGE: GET / with {} and HTTP headers {"HTTP_REFERER"=>"/contact"}
+REQUESTING PAGE: GET /signup with {} and HTTP headers {"HTTP_REFERER"=>"/"}

0 comments on commit 11d1f77

Please sign in to comment.