Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 2 commits
  • 11 files changed
  • 0 commit comments
  • 1 contributor
Commits on May 09, 2014
Hanif, Hakimuddin Added simple static pages 80ac80a
Hanif, Hakimuddin Finished static pages 5e82253
View
3 app/assets/javascripts/static_pages.js.coffee
@@ -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://coffeescript.org/
View
3 app/assets/stylesheets/static_pages.css.scss
@@ -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/
View
10 app/controllers/static_pages_controller.rb
@@ -0,0 +1,10 @@
+class StaticPagesController < ApplicationController
+ def home
+ end
+
+ def help
+ end
+
+ def aboutus
+ end
+end
View
2 app/helpers/static_pages_helper.rb
@@ -0,0 +1,2 @@
+module StaticPagesHelper
+end
View
2 app/views/layouts/application.html.erb
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
- <title>SampleApp</title>
+ <title>Ruby on Rails Tutorial Sample App | <%= yield(:title) %></title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
View
8 app/views/static_pages/aboutus.html.erb
@@ -0,0 +1,8 @@
+<% provide(:title, 'About Us') %>
+<h1>About Us</h1>
+<p>
+ The <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>
View
8 app/views/static_pages/help.html.erb
@@ -0,0 +1,8 @@
+<% provide(:title, 'Help') %>
+<h1>Help</h1>
+<p>
+ Get help on the Ruby on Rails Tutorial at the
+ <a href="http://railstutorial.org/help">Rails Tutorial help page</a>.
+ To get help on this sample app, see the
+ <a href="http://railstutorial.org/book">Rails Tutorial book</a>.
+</p>
View
7 app/views/static_pages/home.html.erb
@@ -0,0 +1,7 @@
+<% provide(:title, 'Home') %>
+<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
3 config/routes.rb
@@ -1,4 +1,7 @@
SampleApp::Application.routes.draw do
+ get "static_pages/home"
+ get "static_pages/help"
+ get "static_pages/aboutus"
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
View
33 spec/requests/static_pages_spec.rb
@@ -0,0 +1,33 @@
+require 'spec_helper'
+
+describe "Static pages" do
+
+ describe "Home page" do
+
+ it "should have content 'Sample app'" do
+ # Run the generator again with the --webrat flag if you want to use webrat methods/matchers
+ visit '/static_pages/home'
+
+ expect(page).to have_content('Sample App')
+ end
+ end
+
+ describe "Help page" do
+
+ it "should have content Help" do
+ visit '/static_pages/help'
+ expect(page).to have_content('Help')
+ end
+
+ end
+
+ describe "About page" do
+
+ it "should have content 'About Us'" do
+ visit '/static_pages/aboutus'
+ expect(page).to have_content('About Us')
+ end
+
+ end
+
+end
View
2 spec/spec_helper.rb
@@ -39,4 +39,6 @@
# the seed, which is printed after each run.
# --seed 1234
config.order = "random"
+
+ config.include Capybara::DSL
end

No commit comments for this range

Something went wrong with that request. Please try again.