add static pages
This commit is contained in:
parent
5bd0c44c91
commit
7ee9afebe0
@ -1,4 +1,8 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
|
||||
allow_browser versions: :modern
|
||||
|
||||
def hello
|
||||
render html: "Hello World!"
|
||||
end
|
||||
end
|
||||
|
10
app/controllers/static_pages_controller.rb
Normal file
10
app/controllers/static_pages_controller.rb
Normal file
@ -0,0 +1,10 @@
|
||||
class StaticPagesController < ApplicationController
|
||||
def home
|
||||
end
|
||||
|
||||
def help
|
||||
end
|
||||
|
||||
def about
|
||||
end
|
||||
end
|
2
app/helpers/static_pages_helper.rb
Normal file
2
app/helpers/static_pages_helper.rb
Normal file
@ -0,0 +1,2 @@
|
||||
module StaticPagesHelper
|
||||
end
|
2
app/views/static_pages/about.html.erb
Normal file
2
app/views/static_pages/about.html.erb
Normal file
@ -0,0 +1,2 @@
|
||||
<h1>StaticPages#about</h1>
|
||||
<p>Find me in app/views/static_pages/about.html.erb</p>
|
2
app/views/static_pages/help.html.erb
Normal file
2
app/views/static_pages/help.html.erb
Normal file
@ -0,0 +1,2 @@
|
||||
<h1>StaticPages#help</h1>
|
||||
<p>Find me in app/views/static_pages/help.html.erb</p>
|
2
app/views/static_pages/home.html.erb
Normal file
2
app/views/static_pages/home.html.erb
Normal file
@ -0,0 +1,2 @@
|
||||
<h1>StaticPages#home</h1>
|
||||
<p>Find me in app/views/static_pages/home.html.erb</p>
|
@ -1,4 +1,9 @@
|
||||
Rails.application.routes.draw do
|
||||
get "static_pages/home"
|
||||
get "static_pages/help"
|
||||
get "static_pages/about"
|
||||
|
||||
root "application#hello"
|
||||
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
|
||||
|
||||
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
|
||||
|
19
test/controllers/static_pages_controller_test.rb
Normal file
19
test/controllers/static_pages_controller_test.rb
Normal file
@ -0,0 +1,19 @@
|
||||
require "test_helper"
|
||||
|
||||
class StaticPagesControllerTest < ActionDispatch::IntegrationTest
|
||||
test "should get home" do
|
||||
get static_pages_home_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should get help" do
|
||||
get static_pages_help_url
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "Should get about" do
|
||||
get static_pages_about_url
|
||||
assert_response :success
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user