Files
fizzy/saas/test/controllers/card/storage_limited_test.rb
T
Jorge Manrubia cf10dbd91e Add 1GB storage cap with staff bypass (#2729)
Re-applies the storage limit from #2713 (reverted in #2715) with an
exception for staff identities so our own account isn't blocked.
2026-03-19 12:38:39 +01:00

40 lines
1.3 KiB
Ruby

require "test_helper"
class Card::StorageLimitedTest < ActionDispatch::IntegrationTest
test "draft card shows storage limit notice instead of create buttons when limit exceeded" do
sign_in_as :mike
Account.any_instance.stubs(:bytes_used).returns(1.gigabyte + 1)
get card_draft_path(cards(:unfinished_thoughts), script_name: accounts(:initech).slug)
assert_response :success
assert_select ".card-perma__notch" do
assert_select "strong", text: /used all/
assert_select "a[href='https://github.com/basecamp/fizzy']", text: "Self-host Fizzy"
end
assert_select ".card-perma__notch-new-card-buttons", count: 0
end
test "draft card shows create buttons when under storage limit" do
sign_in_as :mike
get card_draft_path(cards(:unfinished_thoughts), script_name: accounts(:initech).slug)
assert_response :success
assert_select ".card-perma__notch-new-card-buttons"
end
test "staff sees create buttons even when storage limit exceeded" do
sign_in_as :mike
Account.any_instance.stubs(:bytes_used).returns(1.gigabyte + 1)
Identity.any_instance.stubs(:staff?).returns(true)
get card_draft_path(cards(:unfinished_thoughts), script_name: accounts(:initech).slug)
assert_response :success
assert_select ".card-perma__notch-new-card-buttons"
end
end