Add a Static Pages controller

parent a8ce1463
Pipeline #1219 canceled with stages
in 0 seconds
...@@ -38,3 +38,6 @@ ...@@ -38,3 +38,6 @@
/yarn-error.log /yarn-error.log
yarn-debug.log* yarn-debug.log*
.yarn-integrity .yarn-integrity
# Ignore db test files.
db/test.*
\ No newline at end of file
source 'https://rubygems.org' source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" } git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem 'rexml', '~> 3.2', '>= 3.2.5'
gem 'rails', '6.1.3.2' gem 'rails', '6.1.3.2'
gem 'image_processing', '1.9.3' gem 'image_processing', '1.9.3'
gem 'mini_magick', '4.9.5' gem 'mini_magick', '4.9.5'
......
...@@ -212,6 +212,7 @@ GEM ...@@ -212,6 +212,7 @@ GEM
rb-inotify (0.10.1) rb-inotify (0.10.1)
ffi (~> 1.0) ffi (~> 1.0)
regexp_parser (2.1.1) regexp_parser (2.1.1)
rexml (3.2.5)
ruby-progressbar (1.11.0) ruby-progressbar (1.11.0)
ruby-vips (2.1.2) ruby-vips (2.1.2)
ffi (~> 1.12) ffi (~> 1.12)
...@@ -295,6 +296,7 @@ DEPENDENCIES ...@@ -295,6 +296,7 @@ DEPENDENCIES
rack-mini-profiler (= 2.3.1) rack-mini-profiler (= 2.3.1)
rails (= 6.1.3.2) rails (= 6.1.3.2)
rails-controller-testing (= 1.0.5) rails-controller-testing (= 1.0.5)
rexml (~> 3.2, >= 3.2.5)
sass-rails (= 6.0.0) sass-rails (= 6.0.0)
selenium-webdriver (= 3.142.7) selenium-webdriver (= 3.142.7)
spring (= 2.1.1) spring (= 2.1.1)
......
class StaticPagesController < ApplicationController class StaticPagesController < ApplicationController
def home def home
end end
def help def help
end end
def about
end
end end
<h1>About</h1>
<p>
The <a href="https://www.railstutorial.org/"><em>Ruby on Rails
Tutorial</em></a>, part of the
<a href="https://www.learnenough.com/">Learn Enough</a> family of
tutorials, is a
<a href="https://www.railstutorial.org/book">book</a> and
<a href="https://screencasts.railstutorial.org/">screencast series</a>
to teach web development with
<a href="https://rubyonrails.org/">Ruby on Rails</a>.
This is the sample app for the tutorial.
</p>
\ No newline at end of file
Rails.application.routes.draw do Rails.application.routes.draw do
get 'static_pages/home' get '/home', to: 'static_pages#home'
get 'static_pages/help' get '/help', to: 'static_pages#help'
get '/about', to: 'static_pages#about'
#get 'static_pages/home'
#get 'static_pages/help'
#get 'static_pages/about'
root 'application#hello' root 'application#hello'
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end end
...@@ -10,4 +10,9 @@ class StaticPagesControllerTest < ActionDispatch::IntegrationTest ...@@ -10,4 +10,9 @@ class StaticPagesControllerTest < ActionDispatch::IntegrationTest
get static_pages_help_url get static_pages_help_url
assert_response :success assert_response :success
end end
test "should get about" do
get static_pages_about_url
assert_response :success
end
end end
ENV['RAILS_ENV'] ||= 'test' ENV['RAILS_ENV'] ||= 'test'
require_relative "../config/environment" require_relative "../config/environment"
require "rails/test_help" require "rails/test_help"
require "minitest/reporters"
Minitest::Reporters.use!
class ActiveSupport::TestCase class ActiveSupport::TestCase
# Run tests in parallel with specified workers # Run tests in parallel with specified workers
......
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