Files
project-work/worker-toolkit-stocks-in-the-future/repo/test/controllers/announcements_controller_test.rb
Eric Bell 2854619bc9 chore: init commit
in worker.../repo/GITFOLDER.zip is the .git folder.
2026-08-11 14:44:09 -04:00

35 lines
778 B
Ruby

# frozen_string_literal: true
require "test_helper"
class AnnouncementsControllerTest < ActionDispatch::IntegrationTest
setup do
@user = create(:student)
sign_in @user
@announcement = Announcement.create!(
title: "Test Announcement",
content: "Test content"
)
end
test "should show announcement" do
get announcement_url(@announcement)
assert_response :success
end
test "students can view announcements" do
get announcement_url(@announcement)
assert_response :success
assert_match @announcement.title, response.body
end
test "teachers can view announcements" do
sign_out @user
teacher = create(:teacher)
sign_in teacher
get announcement_url(@announcement)
assert_response :success
end
end