Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJames Lopez <james@gitlab.com>2019-02-22 11:27:38 +0300
committerJames Lopez <james@gitlab.com>2019-02-22 11:27:38 +0300
commit9c2bcca2e5ee378fecf623444e2f5177b9d92142 (patch)
tree492325e55c047631f53985a47e0f55381d219f6a /spec
parentd93d799bde3ee8082c1fd04387bd9bf0979a212d (diff)
parent65be48af9e68dedcade8a4d47af7f2a6f0639866 (diff)
Merge branch '9841-geo-unable-to-compare-branches-on-secondary' into 'master'
Allow users to compare branches on a read-only instance See merge request gitlab-org/gitlab-ce!25414
Diffstat (limited to 'spec')
-rw-r--r--spec/features/projects/branches_spec.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb
index 97757e8da92..ee71c843b80 100644
--- a/spec/features/projects/branches_spec.rb
+++ b/spec/features/projects/branches_spec.rb
@@ -229,6 +229,38 @@ describe 'Branches' do
end
end
+ describe 'comparing branches' do
+ before do
+ sign_in(user)
+ project.add_developer(user)
+ end
+
+ shared_examples 'compares branches' do
+ it 'compares branches' do
+ visit project_branches_path(project)
+
+ page.within first('.all-branches li') do
+ click_link 'Compare'
+ end
+
+ expect(page).to have_content 'Commits'
+ expect(page).to have_link 'Create merge request'
+ end
+ end
+
+ context 'on a read-only instance' do
+ before do
+ allow(Gitlab::Database).to receive(:read_only?).and_return(true)
+ end
+
+ it_behaves_like 'compares branches'
+ end
+
+ context 'on a read-write instance' do
+ it_behaves_like 'compares branches'
+ end
+ end
+
def sorted_branches(repository, count:, sort_by:, state: nil)
branches = repository.branches_sorted_by(sort_by)
branches = branches.select { |b| state == 'active' ? b.active? : b.stale? } if state