summaryrefslogtreecommitdiff
path: root/spec/features/projects/compare_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/projects/compare_spec.rb')
-rw-r--r--spec/features/projects/compare_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/features/projects/compare_spec.rb b/spec/features/projects/compare_spec.rb
index 64e9968061c..bc3ef2af9b0 100644
--- a/spec/features/projects/compare_spec.rb
+++ b/spec/features/projects/compare_spec.rb
@@ -118,6 +118,34 @@ RSpec.describe "Compare", :js do
end
end
end
+
+ context "pagination" do
+ before do
+ stub_const("Projects::CompareController::COMMIT_DIFFS_PER_PAGE", 1)
+ end
+
+ it "shows an adjusted count for changed files on this page" do
+ visit project_compare_index_path(project, from: "feature", to: "master")
+
+ click_button('Compare')
+
+ expect(page).to have_content("Showing 1 changed file")
+ end
+
+ it "shows commits list only on the first page" do
+ visit project_compare_index_path(project, from: "feature", to: "master")
+ click_button('Compare')
+
+ expect(page).to have_content 'Commits (29)'
+
+ # go to the second page
+ within(".files .gl-pagination") do
+ click_on("2")
+ end
+
+ expect(page).not_to have_content 'Commits (29)'
+ end
+ end
end
describe "tags" do