Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a bookmark search per page limit, a total bookmark creation limit, and a rate limit per day for bookmark creation.
- Loading branch information
1 parent
7374eeb
commit be145cc
Showing
6 changed files
with
99 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe UserBookmarkList do | ||
let(:params) { {} } | ||
fab!(:user) { Fabricate(:user) } | ||
let(:list) { UserBookmarkList.new(user: user, guardian: Guardian.new(user), params: params) } | ||
|
||
before do | ||
22.times do | ||
Fabricate(:bookmark, user: user) | ||
end | ||
end | ||
|
||
it "defaults to 20 per page" do | ||
expect(list.per_page).to eq(20) | ||
end | ||
|
||
context "when the per_page param is too high" do | ||
let(:params) { { per_page: 1000 } } | ||
|
||
it "does not allow more than X bookmarks to be requested per page" do | ||
expect(list.load.count).to eq(20) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters