Permalink
Browse files

Done with static pages

  • Loading branch information...
junlai committed Oct 31, 2011
1 parent 4e26e63 commit b83805c822f9eb16c73d1e889d197a0633039245
View
1 .rspec
@@ -0,0 +1 @@
+--colour
View
@@ -27,3 +27,12 @@ gem 'jquery-rails'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
+group :development do
+ gem 'rspec-rails'
+end
+
+group :test do
+ gem 'rspec-rails'
+ gem 'webrat'
+end
+
View
@@ -40,6 +40,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.1.2)
+ diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.2.9)
multi_json (~> 1.0)
@@ -55,6 +56,7 @@ GEM
treetop (~> 1.4.8)
mime-types (1.16)
multi_json (1.0.3)
+ nokogiri (1.5.0)
polyglot (0.3.2)
rack (1.3.4)
rack-cache (1.0.3)
@@ -83,6 +85,19 @@ GEM
rake (0.9.2)
rdoc (3.10)
json (~> 1.4)
+ rspec (2.6.0)
+ rspec-core (~> 2.6.0)
+ rspec-expectations (~> 2.6.0)
+ rspec-mocks (~> 2.6.0)
+ rspec-core (2.6.4)
+ rspec-expectations (2.6.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.6.0)
+ rspec-rails (2.6.1)
+ actionpack (~> 3.0)
+ activesupport (~> 3.0)
+ railties (~> 3.0)
+ rspec (~> 2.6.0)
sass (3.1.10)
sass-rails (3.1.4)
actionpack (~> 3.1.0)
@@ -104,6 +119,10 @@ GEM
uglifier (1.0.3)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
+ webrat (0.7.3)
+ nokogiri (>= 1.2.0)
+ rack (>= 1.0)
+ rack-test (>= 0.5.3)
PLATFORMS
ruby
@@ -112,6 +131,8 @@ DEPENDENCIES
coffee-rails (~> 3.1.0)
jquery-rails
rails (= 3.1.0)
+ rspec-rails
sass-rails (~> 3.1.0)
sqlite3
uglifier
+ webrat
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,3 @@
+// Place all the styles related to the Pages controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,14 @@
+class PagesController < ApplicationController
+ def home
+ @title = "Home"
+ end
+
+ def contact
+ @title = "contact"
+ end
+
+ def about
+ @title = "About"
+ end
+
+end
@@ -0,0 +1,2 @@
+module PagesHelper
+end
@@ -1,14 +1,10 @@
<!DOCTYPE html>
<html>
-<head>
- <title>SampleApp</title>
- <%= stylesheet_link_tag "application" %>
- <%= javascript_include_tag "application" %>
- <%= csrf_meta_tags %>
-</head>
-<body>
-
-<%= yield %>
-
-</body>
+ <head>
+ <title>Ruby on Rails Tutorial Sample App | <%= @title %></title>
+ <%= csrf_meta_tag %>
+ </head>
+ <body>
+ <%= yield %>
+ </body>
</html>
@@ -0,0 +1,8 @@
+<h1>About Us</h1>
+<p>
+ <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
+ is a project to make a book and screencasts to teach web development
+ with <a href="http://rubyonrails.org/">Ruby on Rails</a>. This
+ is the sample application for the tutorial.
+</p>
+
@@ -0,0 +1,6 @@
+<h1>Contact</h1>
+<p>
+ Contact Ruby on Rails Tutorial about the sample app at the
+ <a href="http://railstutorial.org/feedback">feedback page</a>.
+</p>
+
@@ -0,0 +1,7 @@
+<h1>Sample App</h1>
+<p>
+ This is the home page for the
+ <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
+ sample application.
+</p>
+
View
@@ -1,4 +1,8 @@
SampleApp::Application.routes.draw do
+ get "pages/home"
+ get "pages/contact"
+ get "pages/about"
+
# The priority is based upon order of creation:
# first created -> highest priority.
@@ -0,0 +1,45 @@
+require 'spec_helper'
+
+describe PagesController do
+
+ render_views
+ describe "GET 'home'" do
+ it "should be successful" do
+ get 'home'
+ response.should be_success
+ end
+
+ it "should be successful" do
+ get 'home'
+ response.should have_selector("title",
+ :content => "Ruby on Rails Tutorial Sample App | Home")
+ end
+ end
+
+ describe "GET 'contact'" do
+ it "should be successful" do
+ get 'contact'
+ response.should be_success
+ end
+
+ it "should be successful" do
+ get 'contact'
+ response.should have_selector("title",
+ :content => "Ruby on Rails Tutorial Sample App | Contact")
+ end
+ end
+
+ describe "GET 'about'" do
+ it "should be successful" do
+ get 'about'
+ response.should be_success
+ end
+
+ it "should be successful" do
+ get 'about'
+ response.should have_selector("title",
+ :content => "Ruby on Rails Tutorial Sample App | About")
+ end
+ end
+
+end
@@ -0,0 +1,15 @@
+require 'spec_helper'
+
+# Specs in this file have access to a helper object that includes
+# the PagesHelper. For example:
+#
+# describe PagesHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# helper.concat_strings("this","that").should == "this that"
+# end
+# end
+# end
+describe PagesHelper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
View
@@ -0,0 +1,27 @@
+# This file is copied to spec/ when you run 'rails generate rspec:install'
+ENV["RAILS_ENV"] ||= 'test'
+require File.expand_path("../../config/environment", __FILE__)
+require 'rspec/rails'
+
+# Requires supporting ruby files with custom matchers and macros, etc,
+# in spec/support/ and its subdirectories.
+Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
+
+RSpec.configure do |config|
+ # == Mock Framework
+ #
+ # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
+ #
+ # config.mock_with :mocha
+ # config.mock_with :flexmock
+ # config.mock_with :rr
+ config.mock_with :rspec
+
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
+ config.fixture_path = "#{::Rails.root}/spec/fixtures"
+
+ # If you're not using ActiveRecord, or you'd prefer not to run each of your
+ # examples within a transaction, remove the following line or assign false
+ # instead of true.
+ config.use_transactional_fixtures = true
+end
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe "pages/contact.html.erb" do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe "pages/home.html.erb" do
+ pending "add some examples to (or delete) #{__FILE__}"
+end

0 comments on commit b83805c

Please sign in to comment.