diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-07-25 12:07:29 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-07-25 12:07:29 +0000 |
commit | 8ce5b4f1a30c0ab904f67c544a6b7de1bb49e664 (patch) | |
tree | fc9625d19726506d7d459327ec972071e6a3175a /spec/features/projects | |
parent | 83180110348af1b244d56e9cdf5f29c5d6f84db0 (diff) | |
parent | 850813d29867aac5935e1128880784f97071a6d8 (diff) | |
download | gitlab-ce-8ce5b4f1a30c0ab904f67c544a6b7de1bb49e664.tar.gz |
Merge branch 'filter-branch-by-name' into 'master'
Users can filter branches by name on project branches page
This MR aims to solve #18674 by adding the possibility to filter project branches by name
![Screen_Shot_2016-07-07_at_17.21.25](/uploads/b674765d2b1cb8a121c2101715a4568b/Screen_Shot_2016-07-07_at_17.21.25.png)
See merge request !5144
Diffstat (limited to 'spec/features/projects')
-rw-r--r-- | spec/features/projects/branches_spec.rb | 32 | ||||
-rw-r--r-- | spec/features/projects/branches_spec.rb~HEAD | 32 |
2 files changed, 64 insertions, 0 deletions
diff --git a/spec/features/projects/branches_spec.rb b/spec/features/projects/branches_spec.rb new file mode 100644 index 00000000000..79abba21854 --- /dev/null +++ b/spec/features/projects/branches_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +describe 'Branches', feature: true do + let(:project) { create(:project) } + let(:repository) { project.repository } + + before do + login_as :user + project.team << [@user, :developer] + end + + describe 'Initial branches page' do + it 'shows all the branches' do + visit namespace_project_branches_path(project.namespace, project) + + repository.branches { |branch| expect(page).to have_content("#{branch.name}") } + expect(page).to have_content("Protected branches can be managed in project settings") + end + end + + describe 'Find branches' do + it 'shows filtered branches', js: true do + visit namespace_project_branches_path(project.namespace, project, project.id) + + fill_in 'branch-search', with: 'fix' + find('#branch-search').native.send_keys(:enter) + + expect(page).to have_content('fix') + expect(find('.all-branches')).to have_selector('li', count: 1) + end + end +end diff --git a/spec/features/projects/branches_spec.rb~HEAD b/spec/features/projects/branches_spec.rb~HEAD new file mode 100644 index 00000000000..79abba21854 --- /dev/null +++ b/spec/features/projects/branches_spec.rb~HEAD @@ -0,0 +1,32 @@ +require 'spec_helper' + +describe 'Branches', feature: true do + let(:project) { create(:project) } + let(:repository) { project.repository } + + before do + login_as :user + project.team << [@user, :developer] + end + + describe 'Initial branches page' do + it 'shows all the branches' do + visit namespace_project_branches_path(project.namespace, project) + + repository.branches { |branch| expect(page).to have_content("#{branch.name}") } + expect(page).to have_content("Protected branches can be managed in project settings") + end + end + + describe 'Find branches' do + it 'shows filtered branches', js: true do + visit namespace_project_branches_path(project.namespace, project, project.id) + + fill_in 'branch-search', with: 'fix' + find('#branch-search').native.send_keys(:enter) + + expect(page).to have_content('fix') + expect(find('.all-branches')).to have_selector('li', count: 1) + end + end +end |