Files
fizzy/test/controllers/bubbles/pins_controller_test.rb
T
David Heinemeier Hansson 866a80e133 Fix up the tests
2025-04-05 15:26:49 +02:00

32 lines
993 B
Ruby

require "test_helper"
class Bubbles::PinsControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in_as :kevin
end
test "create" do
assert_changes -> { bubbles(:layout).pinned_by?(users(:kevin)) }, from: false, to: true do
perform_enqueued_jobs do
assert_turbo_stream_broadcasts([ users(:kevin), :pins ], count: 1) do
post bucket_bubble_pin_path(buckets(:writebook), bubbles(:layout))
end
end
end
assert_redirected_to bucket_bubble_pin_path(buckets(:writebook), bubbles(:layout))
end
test "destroy" do
assert_changes -> { bubbles(:shipping).pinned_by?(users(:kevin)) }, from: true, to: false do
perform_enqueued_jobs do
assert_turbo_stream_broadcasts([ users(:kevin), :pins ], count: 1) do
delete bucket_bubble_pin_path(buckets(:writebook), bubbles(:shipping))
end
end
end
assert_redirected_to bucket_bubble_pin_path(buckets(:writebook), bubbles(:shipping))
end
end