32 lines
931 B
Ruby
32 lines
931 B
Ruby
require "test_helper"
|
|
|
|
class MotorlotFlowTest < ActionDispatch::IntegrationTest
|
|
test "advert page renders puzzle listing" do
|
|
get root_path
|
|
|
|
assert_response :success
|
|
assert_includes response.body, "2021 Porsche 718 Cayman S"
|
|
assert_includes response.body, "JHDU"
|
|
assert_includes response.body, "VFVSQk8="
|
|
assert_includes response.body, "PDI-24-16"
|
|
end
|
|
|
|
test "admin unlock succeeds with the full password" do
|
|
post admin_path, params: { password: "GEAR-AXLE-TURBO-PARK" }
|
|
|
|
assert_redirected_to admin_path
|
|
follow_redirect!
|
|
|
|
assert_response :success
|
|
assert_includes response.body, "Admin Panel Unlocked"
|
|
assert_includes response.body, "Delete adverts"
|
|
end
|
|
|
|
test "admin unlock rejects invalid passwords" do
|
|
post admin_path, params: { password: "wrong-answer" }
|
|
|
|
assert_response :unprocessable_entity
|
|
assert_includes response.body, "did not unlock anything"
|
|
end
|
|
end
|