sample_rails_tailwind/test/controllers/static_pages_controller_test.rb

41 lines
928 B
Ruby
Raw Normal View History

2024-12-29 17:22:48 +08:00
require "test_helper"
class StaticPagesControllerTest < ActionDispatch::IntegrationTest
2024-12-30 00:09:54 +08:00
def setup
@base_title = "Ruby on Rails Tutorial Sample App"
end
test "should get root" do
get root_url
assert_response :success
assert_select "title", "Home | #{@base_title}"
end
2024-12-29 17:22:48 +08:00
test "should get home" do
get static_pages_home_url
assert_response :success
2024-12-30 00:09:54 +08:00
assert_select "title", "Home | #{@base_title}"
assert_select "h1", "Sample App"
2024-12-29 17:22:48 +08:00
end
test "should get help" do
get static_pages_help_url
assert_response :success
2024-12-30 00:09:54 +08:00
assert_select "title", "Help | #{@base_title}"
2024-12-29 17:22:48 +08:00
end
test "Should get about" do
get static_pages_about_url
assert_response :success
2024-12-30 00:09:54 +08:00
assert_select "title", "About | #{@base_title}"
end
test "Should get contact" do
get static_pages_contact_url
assert_response :success
assert_select "title", "Contact | #{@base_title}"
2024-12-29 17:22:48 +08:00
end
end