Compare commits
No commits in common. "fb5f1f63a0b80a1e2550043b67edb08be63e36fd" and "514108bfc9741c7be54e30674dabaca143d1d45c" have entirely different histories.
fb5f1f63a0
...
514108bfc9
9
app.rb
9
app.rb
|
|
@ -1,15 +1,10 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
require "roda"
|
require "roda"
|
||||||
|
|
||||||
class App < Roda
|
class App < Roda
|
||||||
route do |r|
|
route do |r|
|
||||||
|
|
||||||
r.root do
|
r.on do
|
||||||
"My Homepage"
|
"Hello World!"
|
||||||
end
|
|
||||||
|
|
||||||
r.get 'about' do
|
|
||||||
"About This Site"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -8,15 +8,10 @@ Group=myapp
|
||||||
WorkingDirectory=/opt/myapp
|
WorkingDirectory=/opt/myapp
|
||||||
Environment=RACK_ENV=production
|
Environment=RACK_ENV=production
|
||||||
|
|
||||||
ExecStart=/opt/myapp/bin/puma
|
ExecStart=/usr/bin/puma
|
||||||
TimeoutStopSec=300
|
TimeoutStopSec=300
|
||||||
KillMode=mixed
|
KillMode=mixed
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
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"
|
|
||||||
|
|
|
||||||
19
test_app.rb
19
test_app.rb
|
|
@ -19,27 +19,8 @@ class AppTest < Minitest::Test
|
||||||
assert true
|
assert true
|
||||||
end
|
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
|
def test_home_page_exists
|
||||||
visit '/'
|
visit '/'
|
||||||
assert_equal 200, page.status_code
|
assert_equal 200, page.status_code
|
||||||
end
|
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
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue