Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: rblumenthal/sample_app
base: a73b41b847
...
head fork: rblumenthal/sample_app
compare: master
  • 4 commits
  • 14 files changed
  • 0 commit comments
  • 1 contributor
1  .rspec
View
@@ -0,0 +1 @@
+--colour
1  README.md
View
@@ -0,0 +1 @@
+[*Sample App*](http://railstutorial.org)
3  app/assets/javascripts/static_pages.js.coffee
View
@@ -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/
3  app/assets/stylesheets/static_pages.css.scss
View
@@ -0,0 +1,3 @@
+// Place all the styles related to the StaticPages controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
13 app/controllers/static_pages_controller.rb
View
@@ -0,0 +1,13 @@
+class StaticPagesController < ApplicationController
+ def home
+ end
+
+ def help
+ end
+
+ def about
+ end
+
+ def contact
+ end
+end
2  app/helpers/static_pages_helper.rb
View
@@ -0,0 +1,2 @@
+module StaticPagesHelper
+end
3  app/views/layouts/application.html.erb
View
@@ -1,7 +1,6 @@
<!DOCTYPE html>
<html>
-<head>
- <title>SampleApp</title>
+<head><title>Ruby on Rails Tutorial | <%= yield(:title) %></title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
6 app/views/static_pages/about.html.erb
View
@@ -0,0 +1,6 @@
+<% provide(:title, 'About') %>
+ <h1>About us</h1>
+ <p>
+ All about me!
+ </p>
+
5 app/views/static_pages/contact.html.erb
View
@@ -0,0 +1,5 @@
+<% provide(:title,'Contact') %>
+<h1>Contact</h1>
+<p>
+ Contact us!
+</p>
5 app/views/static_pages/help.html.erb
View
@@ -0,0 +1,5 @@
+<% provide(:title, 'Help') %>
+ <h1>Help</h1>
+ <p>
+ Get help!
+ </p>
6 app/views/static_pages/home.html.erb
View
@@ -0,0 +1,6 @@
+<% provide(:title, 'Home') %>
+ <h1>Sample App</h1>
+ <p>
+ This is the home page for the sample Ruby on Rails tutorial!
+ </p>
+
7 config/routes.rb
View
@@ -1,4 +1,11 @@
SampleApp::Application.routes.draw do
+ get "static_pages/home"
+
+ get "static_pages/help"
+
+ get "static_pages/about"
+
+ get "static_pages/contact"
# The priority is based upon order of creation:
# first created -> highest priority.
45 spec/requests/static_pages_spec.rb
View
@@ -0,0 +1,45 @@
+require 'spec_helper'
+
+describe "Static Pages" do
+ let(:base_title){ "Ruby on Rails Tutorial" }
+ describe "Home page" do
+ it "should have content 'Sample App'" do
+ visit '/static_pages/home'
+ page.should have_selector('h1', :text => 'Sample App')
+ end
+ it "should have the right title" do
+ visit '/static_pages/home'
+ page.should have_selector('title', :text => "#{base_title} | Home")
+ end
+ end
+ describe "Help Page" do
+ it "should have content 'Help'" do
+ visit '/static_pages/help'
+ page.should have_selector('h1', :text => 'Help')
+ end
+ it "should have the right title" do
+ visit '/static_pages/help'
+ page.should have_selector('title', :text => "#{base_title} | Help")
+ end
+ end
+ describe "About Page" do
+ it "should have content 'About us" do
+ visit '/static_pages/about'
+ page.should have_selector('h1', :text => 'About us')
+ end
+ it "should have the right title" do
+ visit '/static_pages/about'
+ page.should have_selector('title', :text => "#{base_title} | About")
+ end
+ end
+ describe "Contact Page" do
+ it "should have content 'Contact'" do
+ visit '/static_pages/contact'
+ page.should have_selector('h1', :text => 'Contact')
+ end
+ it "should have the right title" do
+ visit '/static_pages/contact'
+ page.should have_selector('title', :text => "#{base_title} | Contact")
+ end
+ end
+end
32 spec/spec_helper.rb
View
@@ -0,0 +1,32 @@
+# 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'
+require 'rspec/autorun'
+
+# 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
+
+ # 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
+
+ # If true, the base class of anonymous controllers will be inferred
+ # automatically. This will be the default behavior in future versions of
+ # rspec-rails.
+ config.infer_base_class_for_anonymous_controllers = false
+end

No commit comments for this range

Something went wrong with that request. Please try again.