Files
fizzy/test/controllers/bubbles/pins_controller_test.rb
T
David Heinemeier Hansson e69c1bd0a1 Break pins out of the double nesting
Its cumbersome and needless
2025-04-05 15:45:16 +02:00

32 lines
881 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 bubble_pin_path(bubbles(:layout))
end
end
end
assert_redirected_to bubble_pin_path(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 bubble_pin_path(bubbles(:shipping))
end
end
end
assert_redirected_to bubble_pin_path(bubbles(:shipping))
end
end