mirror of
https://github.com/discourse/discourse.git
synced 2024-12-12 00:43:43 +08:00
c9dab6fd08
It's very easy to forget to add `require 'rails_helper'` at the top of every core/plugin spec file, and omissions can cause some very confusing/sporadic errors. By setting this flag in `.rspec`, we can remove the need for `require 'rails_helper'` entirely.
27 lines
678 B
Ruby
27 lines
678 B
Ruby
# frozen_string_literal: true
|
|
|
|
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
|
|
bookmark = Fabricate(:bookmark, user: user)
|
|
Fabricate(:topic_user, topic: bookmark.topic, 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
|