Finish static pages

parent 3fdebb09
Pipeline #1228 failed with stages
in 0 seconds
class ApplicationController < ActionController::Base
def hello
render html: "hello, world!"
end
end
<!DOCTYPE html>
<html>
<head>
<title>SampleApp</title>
<title><%= yield(:title) %> | Ruby on Rails Tutorial Sample App</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
......
<% provide(:title, "About") %>
<h1>About</h1>
<p>
The <a href="https://www.railstutorial.org/"><em>Ruby on Rails
......
<h1>StaticPages#help</h1>
<p>Find me in app/views/static_pages/help.html.erb</p>
<% provide(:title, "Help") %>
<h1>Help</h1>
<p>
Get help on the Ruby on Rails Tutorial at the
<a href="https://www.railstutorial.org/help">Rails Tutorial help
section</a>.
To get help on this sample app, see the
<a href="https://www.railstutorial.org/book"><em>Ruby on Rails
Tutorial</em> book</a>.
</p>
<!DOCTYPE html>
<html>
<head>
<title>Home | Ruby on Rails Tutorial Sample App</title>
</head>
<body>
<% provide(:title, "Home") %>
<h1>Sample App</h1>
<p>
This is the home page for the
<a href="https://www.railstutorial.org/">Ruby on Rails Tutorial</a>
sample application.
</p>
</body>
</html>
\ No newline at end of file
<h1>StaticPages</h1>
<p>Find me in app/views/static_pages/home.html.erb</p>
\ No newline at end of file
<% provide(:title, "Page Title") %>
<!DOCTYPE html>
<html>
<head>
<title><%= yield(:title) %> | Ruby on Rails Tutorial Sample App</title>
</head>
<body>
Contents
</body>
</html>
\ No newline at end of file
......@@ -7,7 +7,7 @@ Rails.application.routes.draw do
#get 'static_pages/home'
#get 'static_pages/help'
#get 'static_pages/about'
root 'application#hello'
root 'static_pages#home'
get 'static_pages', to: 'static_pages#index'
end
require "test_helper"
class StaticPagesControllerTest < ActionDispatch::IntegrationTest
def setup
@base_title = "Ruby on Rails Tutorial Sample App"
end
test "should get home" do
get static_pages_home_url
assert_response :success
assert_select "title", "Home | Ruby on Rails Tutorial Sample App"
assert_select "title", "Home | #{@base_title}"
end
test "should get help" do
get static_pages_help_url
assert_response :success
assert_select "title", "Help | Ruby on Rails Tutorial Sample App"
assert_select "title", "Help | #{@base_title}"
end
test "should get about" do
get static_pages_about_url
assert_response :success
assert_select "title", "About | Ruby on Rails Tutorial Sample App"
assert_select "title", "About | #{@base_title}"
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment