From 45a984b80baab4b5330fcad22a2139d547116bd9 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Thu, 1 Sep 2016 15:35:39 +0300 Subject: [PATCH] Add more tests for merge request versions feature Signed-off-by: Dmitriy Zaporozhets --- .../merge_request_versions_spec.rb | 20 ++++++++++++++++--- spec/helpers/git_helper_spec.rb | 9 +++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 spec/helpers/git_helper_spec.rb diff --git a/spec/features/merge_requests/merge_request_versions_spec.rb b/spec/features/merge_requests/merge_request_versions_spec.rb index df66dd23448..7ccf4e8e8f2 100644 --- a/spec/features/merge_requests/merge_request_versions_spec.rb +++ b/spec/features/merge_requests/merge_request_versions_spec.rb @@ -12,7 +12,7 @@ feature 'Merge Request versions', js: true, feature: true do it 'show the latest version of the diff' do page.within '.mr-version-dropdown' do - expect(page).to have_content 'Version: latest' + expect(page).to have_content 'Latest: 5937ac0a' end expect(page).to have_content '8 changed files' @@ -33,6 +33,10 @@ feature 'Merge Request versions', js: true, feature: true do expect(page).to have_content '5 changed files' end + + it 'show the message about disabled comments' do + expect(page).to have_content 'Comments are disabled' + end end describe 'compare with older version' do @@ -43,12 +47,22 @@ feature 'Merge Request versions', js: true, feature: true do end end - it 'should show older version' do + it 'should has correct value in the compare dropdown' do page.within '.mr-version-compare-dropdown' do expect(page).to have_content '6f6d7e7e' end + end - expect(page).to have_content '5 changed files' + it 'show the message about disabled comments' do + expect(page).to have_content 'Comments are disabled' + end + + it 'show diff between new and old version' do + expect(page).to have_content '4 changed files with 15 additions and 6 deletions' + end + + it 'show diff between new and old version' do + expect(page).to have_content '4 changed files with 15 additions and 6 deletions' end end end diff --git a/spec/helpers/git_helper_spec.rb b/spec/helpers/git_helper_spec.rb new file mode 100644 index 00000000000..9b1ef1e05a2 --- /dev/null +++ b/spec/helpers/git_helper_spec.rb @@ -0,0 +1,9 @@ +require 'spec_helper' + +describe GitHelper do + describe '#short_sha' do + let(:short_sha) { helper.short_sha('d4e043f6c20749a3ab3f4b8e23f2a8979f4b9100') } + + it { expect(short_sha).to eq('d4e043f6') } + end +end