summaryrefslogtreecommitdiff
path: root/spec/views/projects/commit/branches.html.haml_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/views/projects/commit/branches.html.haml_spec.rb')
-rw-r--r--spec/views/projects/commit/branches.html.haml_spec.rb73
1 files changed, 70 insertions, 3 deletions
diff --git a/spec/views/projects/commit/branches.html.haml_spec.rb b/spec/views/projects/commit/branches.html.haml_spec.rb
index c9112ede334..044b73ce419 100644
--- a/spec/views/projects/commit/branches.html.haml_spec.rb
+++ b/spec/views/projects/commit/branches.html.haml_spec.rb
@@ -7,7 +7,7 @@ describe 'projects/commit/branches.html.haml' do
assign(:project, project)
end
- context 'branches and tags' do
+ context 'when branches and tags are available' do
before do
assign(:branches, ['master', 'test-branch'])
assign(:branches_limit_exceeded, false)
@@ -17,16 +17,75 @@ describe 'projects/commit/branches.html.haml' do
render
end
+ it 'shows default branch' do
+ expect(rendered).to have_link('master')
+ end
+
+ it 'shows js expand link' do
+ expect(rendered).to have_selector('.js-details-expand')
+ end
+
it 'shows branch and tag links' do
+ expect(rendered).to have_link('test-branch')
+ expect(rendered).to have_link('tag1')
+ end
+ end
+
+ context 'when branches are available but no tags' do
+ before do
+ assign(:branches, ['master', 'test-branch'])
+ assign(:branches_limit_exceeded, false)
+ assign(:tags, [])
+ assign(:tags_limit_exceeded, true)
+
+ render
+ end
+
+ it 'shows branches' do
expect(rendered).to have_link('master')
expect(rendered).to have_link('test-branch')
+ end
+
+ it 'shows js expand link' do
+ expect(rendered).to have_selector('.js-details-expand')
+ end
+
+ it 'shows limit exceeded message for tags' do
+ expect(rendered).to have_text('Tags unavailable')
+ end
+ end
+
+ context 'when tags are available but no branches (just default)' do
+ before do
+ assign(:branches, ['master'])
+ assign(:branches_limit_exceeded, true)
+ assign(:tags, ['tag1', 'tag2'])
+ assign(:tags_limit_exceeded, false)
+
+ render
+ end
+
+ it 'shows default branch' do
+ expect(rendered).to have_text('master')
+ end
+
+ it 'shows js expand link' do
+ expect(rendered).to have_selector('.js-details-expand')
+ end
+
+ it 'shows tags' do
expect(rendered).to have_link('tag1')
+ expect(rendered).to have_link('tag2')
+ end
+
+ it 'shows limit exceeded for branches' do
+ expect(rendered).to have_text('Branches unavailable')
end
end
- context 'throttled branches and tags' do
+ context 'when branches and tags are not available' do
before do
- assign(:branches, [])
+ assign(:branches, ['master'])
assign(:branches_limit_exceeded, true)
assign(:tags, [])
assign(:tags_limit_exceeded, true)
@@ -34,6 +93,14 @@ describe 'projects/commit/branches.html.haml' do
render
end
+ it 'shows default branch' do
+ expect(rendered).to have_text('master')
+ end
+
+ it 'shows js expand link' do
+ expect(rendered).to have_selector('.js-details-expand')
+ end
+
it 'shows too many to search' do
expect(rendered).to have_text('Branches unavailable')
expect(rendered).to have_text('Tags unavailable')