- <%= link_to "sample app", '#', id: "logo" %>
+ <%= link_to "sample app", root_url, id: "logo" %>
diff --git a/config/routes.rb b/config/routes.rb
index c44de3a..8cd3f39 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -4,6 +4,10 @@ Rails.application.routes.draw do
get "static_pages/about"
get "static_pages/contact"
+ get '/help', to: 'static_pages#help'
+ get '/about', to: 'static_pages#about'
+ get '/contact', to: 'static_pages#contact'
+
root "static_pages#home"
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
diff --git a/test/controllers/static_pages_controller_test.rb b/test/controllers/static_pages_controller_test.rb
index 3718937..4562acd 100644
--- a/test/controllers/static_pages_controller_test.rb
+++ b/test/controllers/static_pages_controller_test.rb
@@ -7,31 +7,25 @@ class StaticPagesControllerTest < ActionDispatch::IntegrationTest
end
test "should get root" do
- get root_url
- assert_response :success
- assert_select "title", "Home | #{@base_title}"
- end
-
- test "should get home" do
- get static_pages_home_url
+ get root_path
assert_response :success
assert_select "title", "Home | #{@base_title}"
end
test "should get help" do
- get static_pages_help_url
+ get help_path
assert_response :success
assert_select "title", "Help | #{@base_title}"
end
test "Should get about" do
- get static_pages_about_url
+ get about_path
assert_response :success
assert_select "title", "About | #{@base_title}"
end
test "Should get contact" do
- get static_pages_contact_url
+ get contact_path
assert_response :success
assert_select "title", "Contact | #{@base_title}"
end
diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb
new file mode 100644
index 0000000..0b718a2
--- /dev/null
+++ b/test/helpers/application_helper_test.rb
@@ -0,0 +1,8 @@
+require 'test_helper'
+
+class ApplicationHelperTest < ActionView::TestCase
+ test "full title helper" do
+ assert_equal full_title, "Ruby on Rails Tutorial Sample App"
+ assert_equal full_title("Contact"), "Contact | Ruby on Rails Tutorial Sample App"
+ end
+end
\ No newline at end of file
diff --git a/test/integration/site_layout_test.rb b/test/integration/site_layout_test.rb
new file mode 100644
index 0000000..b416fb0
--- /dev/null
+++ b/test/integration/site_layout_test.rb
@@ -0,0 +1,15 @@
+require "test_helper"
+
+class SiteLayoutTest < ActionDispatch::IntegrationTest
+ # test "the truth" do
+ # assert true
+ # end
+ test "layout links" do
+ get root_path
+ assert_template 'static_pages/home'
+ assert_select "a[href=?]", root_url, count: 2
+ assert_select "a[href=?]", about_url
+ assert_select "a[href=?]", help_url
+ assert_select "a[href=?]", contact_url
+ end
+end