a761d809ae
Limit free storage to 1GB on the SaaS version. When exceeded, card publishing, comment creation, and JSON card creation are blocked, and the card footer shows a "self-host Fizzy for unlimited storage" notice instead of the create buttons. A nearing-limit warning appears when usage exceeds 500MB. Uses the same SaaS engine patterns as the removed billing system: model concern on Account, controller concerns included via config.to_prepare, view partials in saas/ with Fizzy.saas? guards in the main app.
24 lines
709 B
Ruby
24 lines
709 B
Ruby
require "test_helper"
|
|
|
|
class Card::StorageLimited::PublishingTest < ActionDispatch::IntegrationTest
|
|
test "cannot publish cards when storage limit exceeded" do
|
|
sign_in_as :mike
|
|
|
|
Account.any_instance.stubs(:bytes_used).returns(1.gigabyte + 1)
|
|
|
|
post card_publish_path(cards(:unfinished_thoughts), script_name: accounts(:initech).slug)
|
|
|
|
assert_response :forbidden
|
|
assert cards(:unfinished_thoughts).reload.drafted?
|
|
end
|
|
|
|
test "can publish cards when under storage limit" do
|
|
sign_in_as :mike
|
|
|
|
post card_publish_path(cards(:unfinished_thoughts), script_name: accounts(:initech).slug)
|
|
|
|
assert_response :redirect
|
|
assert cards(:unfinished_thoughts).reload.published?
|
|
end
|
|
end
|