eceb6c9b43
* Add self-service account deletion * Disable access to cancelled accounts & implement Stripe interactions * Add tests * Fix failing tests * Remove cancelled accounts from lists * Fix incorrect redirect * Use _path instead of _url for consistency * Don't track how far the inicieration job got We still want the step tracking so that the job can be interrupted. But, since the scope is idempotent, we don't need to track how far it got. * Specify the exact time when the data will be deleted * Fix crash due to unadvancable cursor * Rename up_for_incineration to due_for_incineration * Regenrate the schema * Fix incorrect path check * Migrate the SQLite schema * Only show the cancel button on cancellable accounts * Check that a subscirption method exists before calling it * Ignore job failures due to missing records when an account gets deleted * Skip sending notifications on cancelled accounts * Use collbacks to integrate * Add a blank line between queue_as and discard_on * Break checks into methods * Inline methods * Rename Account::IncinerateJob * Run migrations * Migrate SQLite
98 lines
2.6 KiB
Ruby
98 lines
2.6 KiB
Ruby
require "test_helper"
|
|
|
|
class My::MenusControllerTest < ActionDispatch::IntegrationTest
|
|
setup do
|
|
sign_in_as :kevin
|
|
@user = users(:kevin)
|
|
@account = accounts("37s")
|
|
end
|
|
|
|
test "show" do
|
|
get my_menu_path
|
|
assert_response :success
|
|
end
|
|
|
|
test "etag invalidates when filters change" do
|
|
get my_menu_path
|
|
assert_response :success
|
|
etag = response.headers["ETag"]
|
|
|
|
@user.filters.create!(
|
|
params_digest: Filter.digest_params({ indexed_by: :all, sorted_by: :newest }),
|
|
fields: { indexed_by: :all, sorted_by: :newest }
|
|
)
|
|
|
|
get my_menu_path, headers: { "If-None-Match" => etag }
|
|
assert_response :success
|
|
end
|
|
|
|
test "etag invalidates when boards change" do
|
|
get my_menu_path
|
|
assert_response :success
|
|
etag = response.headers["ETag"]
|
|
|
|
@account.boards.create!(name: "New Board", all_access: true, creator: @user)
|
|
|
|
get my_menu_path, headers: { "If-None-Match" => etag }
|
|
assert_response :success
|
|
end
|
|
|
|
test "etag invalidates when tags change" do
|
|
get my_menu_path
|
|
assert_response :success
|
|
etag = response.headers["ETag"]
|
|
|
|
@account.tags.create!(title: "new-tag")
|
|
|
|
get my_menu_path, headers: { "If-None-Match" => etag }
|
|
assert_response :success
|
|
end
|
|
|
|
test "etag invalidates when users change" do
|
|
get my_menu_path
|
|
assert_response :success
|
|
etag = response.headers["ETag"]
|
|
|
|
@user.touch
|
|
|
|
get my_menu_path, headers: { "If-None-Match" => etag }
|
|
assert_response :success
|
|
end
|
|
|
|
test "etag invalidates when account changes" do
|
|
get my_menu_path
|
|
assert_response :success
|
|
etag = response.headers["ETag"]
|
|
|
|
@account.update!(name: "Renamed Account")
|
|
|
|
get my_menu_path, headers: { "If-None-Match" => etag }
|
|
assert_response :success
|
|
end
|
|
|
|
test "etag returns not modified when nothing changes" do
|
|
get my_menu_path
|
|
assert_response :success
|
|
etag = response.headers["ETag"]
|
|
|
|
get my_menu_path, headers: { "If-None-Match" => etag }
|
|
assert_response :not_modified
|
|
end
|
|
|
|
test "show excludes cancelled accounts" do
|
|
# Create another account for the same identity
|
|
another_account = Account.create!(external_account_id: 9999996, name: "Cancelled Account")
|
|
another_user = @user.identity.users.create!(account: another_account, name: "Kevin", role: "owner")
|
|
|
|
# Cancel the other account
|
|
another_account.cancel(initiated_by: another_user)
|
|
|
|
get my_menu_path
|
|
assert_response :success
|
|
|
|
# The response should include active account but not cancelled one
|
|
assert_select "a[href*='#{@account.slug}']"
|
|
assert_select "a[href*='#{another_account.slug}']", count: 0
|
|
end
|
|
end
|