-
-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lowered pagination threshold in dev and staging using kaminari #4865
Merged
dorner
merged 4 commits into
rubyforgood:main
from
k8port:4859-lower-pagination-threshold-for-staging-and-dev
Dec 19, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
70604c8
lowered pagination threshold in dev and staging using kaminari
k8port 42b258a
Trigger Build
k8port bffefb9
Merge branch 'main' into 4859-lower-pagination-threshold-for-staging-…
k8port 8ca438e
Merge branch '4859-lower-pagination-threshold-for-staging-and-dev' of…
k8port File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe "Kaminari configuration" do | ||
describe "default_per_page setting" do | ||
after(:each) do | ||
# Reset Kaminari configuration after each test | ||
Kaminari.configure do |config| | ||
config.default_per_page = 50 | ||
end | ||
end | ||
|
||
context "in development environment" do | ||
before do | ||
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("development")) | ||
# Reload the configuration file | ||
load Rails.root.join("config/initializers/kaminari_config.rb") | ||
end | ||
|
||
it "sets default_per_page to 5" do | ||
expect(Kaminari.config.default_per_page).to eq(5) | ||
end | ||
end | ||
|
||
context "in staging environment" do | ||
before do | ||
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("staging")) | ||
# Reload the configuration file | ||
load Rails.root.join("config/initializers/kaminari_config.rb") | ||
end | ||
|
||
it "sets default_per_page to 5" do | ||
expect(Kaminari.config.default_per_page).to eq(5) | ||
end | ||
end | ||
|
||
context "in production environment" do | ||
before do | ||
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new("production")) | ||
# Reload the configuration file | ||
load Rails.root.join("config/initializers/kaminari_config.rb") | ||
end | ||
|
||
it "sets default_per_page to 50" do | ||
expect(Kaminari.config.default_per_page).to eq(50) | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also think of making this configurable from env config? Does this makes sense here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true - we could move this to
development.rb
andstaging.rb
which is a bit neater. But I wouldn't block the PR for that.