Files
fizzy/test/controllers/admin/prompt_sandboxes_controller_test.rb
T
2025-07-23 11:02:34 +02:00

37 lines
1003 B
Ruby

require "test_helper"
class Admin::PromptSandboxesControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in_as :kevin
end
test "show renders the form with default prompt" do
get admin_prompt_sandbox_path
assert_response :success
end
test "create processes prompt and renders show with summary" do
post admin_prompt_sandbox_path, params: { prompt: "Test prompt for summarization" }
assert_response :redirect
assert_redirected_to admin_prompt_sandbox_path(day: assigns(:day_timeline).day, llm_model: Event::Summarizer::LLM_MODEL)
end
test "non-staff user gets forbidden on show" do
users(:kevin).update! email_address: "kevin@hey.com"
get admin_prompt_sandbox_path
assert_response :forbidden
end
test "non-staff user gets forbidden on create" do
users(:kevin).update! email_address: "kevin@hey.com"
post admin_prompt_sandbox_path, params: { prompt: "Test prompt for summarization" }
assert_response :forbidden
end
end