Compare commits

...

2 commits

Author SHA1 Message Date
James fb5f1f63a0 Add usage comments to systemd unit file. 2025-07-02 04:12:16 -05:00
James d442d083ed More tests and better routes 2025-07-02 03:59:57 -05:00
3 changed files with 32 additions and 3 deletions

9
app.rb
View file

@ -1,10 +1,15 @@
# frozen_string_literal: true
require "roda"
class App < Roda
route do |r|
r.on do
"Hello World!"
r.root do
"My Homepage"
end
r.get 'about' do
"About This Site"
end
end

View file

@ -8,10 +8,15 @@ Group=myapp
WorkingDirectory=/opt/myapp
Environment=RACK_ENV=production
ExecStart=/usr/bin/puma
ExecStart=/opt/myapp/bin/puma
TimeoutStopSec=300
KillMode=mixed
Restart=on-failure
[Install]
WantedBy=multi-user.target
# Can copy this unit file into /etc/systemd/system/
# then edit for your installation details (user, group, directory, exec, app name)
# run "sudo systemctl daemon-reload",
# then "sudo systemctl enable --now -q myapp.service"

View file

@ -19,8 +19,27 @@ class AppTest < Minitest::Test
assert true
end
# Make sure not just responding to every path
def test_random_page_does_not__exist
visit '/skdjflksjdflkzxbjslkdjqweooiumnbvjslkdjflk'
refute_equal 200, page.status_code
end
def test_home_page_exists
visit '/'
assert_equal 200, page.status_code
end
# Can change the checked content as your site evolves:
def test_home_page_has_content
visit '/'
assert_content "My Homepage"
end
def test_about_page_exists_and_has_content
visit '/about'
assert_equal 200, page.status_code
assert_content "About This Site"
end
end