diff options
author | Boyan Tabakov <boyan.tabakov@futurice.com> | 2013-09-04 11:33:09 +0400 |
---|---|---|
committer | Boyan Tabakov <boyan.tabakov@futurice.com> | 2013-09-07 15:44:03 +0400 |
commit | 01ff084a4df76ba0856a513aca9bdf8f1d550365 (patch) | |
tree | d90ef89169f4e53dc702172b3f3b01a030619549 /features | |
parent | 71d31a38fc73252a76076820c63d054a8047d667 (diff) |
Improved large commit handling.
Previously, only number of changed files mattered. Now, number of lines to render in the diff are also taken into account.
A hard limit is set, above which diffs are not rendered and users are not allowed to override that. This prevents high server
resource usage with huge commits.
Related to #1745, #2259
In addition, handle large commits for MergeRequests and Compare controllers.
Also fixes a bug where diffs are loaded twice, if user goes directly to merge_requests/:id/diffs URL.
Diffstat (limited to 'features')
-rw-r--r-- | features/project/commits/commits.feature | 8 | ||||
-rw-r--r-- | features/steps/project/project_browse_commits.rb | 20 | ||||
-rw-r--r-- | features/support/env.rb | 2 |
3 files changed, 29 insertions, 1 deletions
diff --git a/features/project/commits/commits.feature b/features/project/commits/commits.feature index 56069cdc977..d962471ebdb 100644 --- a/features/project/commits/commits.feature +++ b/features/project/commits/commits.feature @@ -27,3 +27,11 @@ Feature: Project Browse commits Scenario: I browse commits stats Given I visit my project's commits stats page Then I see commits stats + + Scenario: I browse big commit + Given I visit big commit page + Then I see big commit warning + + Scenario: I browse huge commit + Given I visit huge commit page + Then I see huge commit message diff --git a/features/steps/project/project_browse_commits.rb b/features/steps/project/project_browse_commits.rb index 71f4bd79f7e..4b122b853e6 100644 --- a/features/steps/project/project_browse_commits.rb +++ b/features/steps/project/project_browse_commits.rb @@ -58,4 +58,24 @@ class ProjectBrowseCommits < Spinach::FeatureSteps page.should have_content 'Total commits' page.should have_content 'Authors' end + + Given 'I visit big commit page' do + visit project_commit_path(@project, BigCommits::BIG_COMMIT_ID) + end + + Then 'I see big commit warning' do + page.should have_content BigCommits::BIG_COMMIT_MESSAGE + page.should have_content "Warning! This is a large diff" + page.should have_content "If you still want to see the diff" + end + + Given 'I visit huge commit page' do + visit project_commit_path(@project, BigCommits::HUGE_COMMIT_ID) + end + + Then 'I see huge commit message' do + page.should have_content BigCommits::HUGE_COMMIT_MESSAGE + page.should have_content "Warning! This is a large diff" + page.should_not have_content "If you still want to see the diff" + end end diff --git a/features/support/env.rb b/features/support/env.rb index 0cc7d8d2fe9..61f8dc29670 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -14,7 +14,7 @@ require 'spinach/capybara' require 'sidekiq/testing/inline' -%w(valid_commit select2_helper chosen_helper test_env).each do |f| +%w(valid_commit big_commits select2_helper chosen_helper test_env).each do |f| require Rails.root.join('spec', 'support', f) end |