-
-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lowered pagination threshold in dev and staging using kaminari (#4865)
* lowered pagination threshold in dev and staging using kaminari * Trigger Build
- Loading branch information
Showing
2 changed files
with
53 additions
and
1 deletion.
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 |