diff options
author | Brett Walker <bwalker@gitlab.com> | 2017-10-13 20:11:11 +0300 |
---|---|---|
committer | Brett Walker <bwalker@gitlab.com> | 2017-10-13 20:11:11 +0300 |
commit | cbdf372eb8e6d38c4f47a1c2f6bff76b4b2c659f (patch) | |
tree | 1b3ca36c65831ba4662374b289751bbeb24c460d /spec/views/projects | |
parent | 528f9cde0588b0a6e70b1fa971a99eca439d0aa6 (diff) |
implemented using an ivar, and added specs
Diffstat (limited to 'spec/views/projects')
-rw-r--r-- | spec/views/projects/commit/branches.html.haml_spec.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/views/projects/commit/branches.html.haml_spec.rb b/spec/views/projects/commit/branches.html.haml_spec.rb new file mode 100644 index 00000000000..4199d2fd962 --- /dev/null +++ b/spec/views/projects/commit/branches.html.haml_spec.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +describe 'projects/commit/branches.html.haml' do + let(:project) { create(:project, :repository) } + + before do + assign(:project, project) + end + + context 'branches and tags' do + before do + assign(:branches, ['master', 'test-branch']) + assign(:branches_limit_exceeded, false) + assign(:tags, ['tag1']) + assign(:tags_limit_exceeded, false) + + render + end + + it 'shows branch and tag links' do + expect(rendered).to have_selector('.js-details-expand') + expect(rendered).to have_link('master') + expect(rendered).to have_link('test-branch') + expect(rendered).to have_link('tag1') + end + end + + context 'throttled branches and tags' do + before do + assign(:branches, []) + assign(:branches_limit_exceeded, true) + assign(:tags, []) + assign(:tags_limit_exceeded, true) + + render + end + + it 'shows too many to search' do + expect(rendered).to have_selector('.js-details-expand') + expect(rendered).to have_link('Too many branches to search', href: '#') + expect(rendered).to have_link('Too many tags to search', href: '#') + end + end +end |