diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-21 18:09:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-21 18:09:05 +0300 |
commit | cf6a3e7ed4cb10a3e9fcbda810601387afc8b8d6 (patch) | |
tree | bda3707e95a53cb225793fded61d5073950b0b68 /spec | |
parent | 2a040e2655fe0a99df61ad0a7bd0c27e68af0c38 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/boards/list_spec.js | 17 | ||||
-rw-r--r-- | spec/models/project_services/chat_message/push_message_spec.rb | 34 | ||||
-rw-r--r-- | spec/requests/sessions_spec.rb | 17 |
3 files changed, 35 insertions, 33 deletions
diff --git a/spec/javascripts/boards/list_spec.js b/spec/javascripts/boards/list_spec.js index c340b62730c..7385bfb0e5f 100644 --- a/spec/javascripts/boards/list_spec.js +++ b/spec/javascripts/boards/list_spec.js @@ -4,7 +4,6 @@ /* global ListLabel */ import MockAdapter from 'axios-mock-adapter'; -import _ from 'underscore'; import axios from '~/lib/utils/axios_utils'; import '~/boards/models/label'; import '~/boards/models/assignee'; @@ -40,7 +39,7 @@ describe('List model', () => { list = new List({ title: 'test', label: { - id: _.random(10000), + id: 1, title: 'test', color: 'red', text_color: 'white', @@ -96,8 +95,8 @@ describe('List model', () => { const listDup = new List(listObjDuplicate); const issue = new ListIssue({ title: 'Testing', - id: _.random(10000), - iid: _.random(10000), + id: 1, + iid: 1, confidential: false, labels: [list.label, listDup.label], assignees: [], @@ -129,8 +128,8 @@ describe('List model', () => { list.issues.push( new ListIssue({ title: 'Testing', - id: _.random(10000) + i, - iid: _.random(10000) + i, + id: i, + iid: i, confidential: false, labels: [list.label], assignees: [], @@ -151,7 +150,7 @@ describe('List model', () => { list.issues.push( new ListIssue({ title: 'Testing', - id: _.random(10000), + id: 1, confidential: false, labels: [list.label], assignees: [], @@ -192,7 +191,7 @@ describe('List model', () => { list.issues.push( new ListIssue({ title: 'Testing', - id: _.random(10000), + id: 1, confidential: false, labels: [new ListLabel(list.label)], assignees: [], @@ -200,7 +199,7 @@ describe('List model', () => { ); const dummyIssue = new ListIssue({ title: 'new issue', - id: _.random(10000), + id: 2, confidential: false, labels: [new ListLabel(list.label)], assignees: [user], diff --git a/spec/models/project_services/chat_message/push_message_spec.rb b/spec/models/project_services/chat_message/push_message_spec.rb index fe0b2fe3440..9d990508ab2 100644 --- a/spec/models/project_services/chat_message/push_message_spec.rb +++ b/spec/models/project_services/chat_message/push_message_spec.rb @@ -22,8 +22,14 @@ describe ChatMessage::PushMessage do context 'push' do before do args[:commits] = [ - { message: 'message1', url: 'http://url1.com', id: 'abcdefghijkl', author: { name: 'author1' } }, - { message: "message2\nsecondline", url: 'http://url2.com', id: '123456789012', author: { name: 'author2' } } + { message: 'message1', title: 'message1', url: 'http://url1.com', id: 'abcdefghijkl', author: { name: 'author1' } }, + { + message: 'message2' + ' w' * 100 + "\nsecondline", + title: 'message2 w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w ...', + url: 'http://url2.com', + id: '123456789012', + author: { name: 'author2' } + } ] end @@ -34,7 +40,7 @@ describe ChatMessage::PushMessage do '<http://url.com|project_name> (<http://url.com/compare/before...after|Compare changes>)') expect(subject.attachments).to eq([{ text: "<http://url1.com|abcdefgh>: message1 - author1\n\n"\ - "<http://url2.com|12345678>: message2\nsecondline - author2", + "<http://url2.com|12345678>: message2 w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w ... - author2", color: color }]) end @@ -49,27 +55,7 @@ describe ChatMessage::PushMessage do expect(subject.pretext).to eq( 'test.user pushed to branch [master](http://url.com/commits/master) of [project_name](http://url.com) ([Compare changes](http://url.com/compare/before...after))') expect(subject.attachments).to eq( - "[abcdefgh](http://url1.com): message1 - author1\n\n[12345678](http://url2.com): message2\nsecondline - author2") - expect(subject.activity).to eq( - title: 'test.user pushed to branch [master](http://url.com/commits/master)', - subtitle: 'in [project_name](http://url.com)', - text: '[Compare changes](http://url.com/compare/before...after)', - image: 'http://someavatar.com' - ) - end - end - - context 'with markdown and commit message html' do - before do - args[:commit_message_html] = true - args[:markdown] = true - end - - it 'returns a message regarding pushes' do - expect(subject.pretext).to eq( - 'test.user pushed to branch [master](http://url.com/commits/master) of [project_name](http://url.com) ([Compare changes](http://url.com/compare/before...after))') - expect(subject.attachments).to eq( - "[abcdefgh](http://url1.com): message1 - author1<br/>\n<br/>\n[12345678](http://url2.com): message2<br/>\nsecondline - author2") + "[abcdefgh](http://url1.com): message1 - author1\n\n[12345678](http://url2.com): message2 w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w w ... - author2") expect(subject.activity).to eq( title: 'test.user pushed to branch [master](http://url.com/commits/master)', subtitle: 'in [project_name](http://url.com)', diff --git a/spec/requests/sessions_spec.rb b/spec/requests/sessions_spec.rb new file mode 100644 index 00000000000..6697700c37d --- /dev/null +++ b/spec/requests/sessions_spec.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'Sessions' do + context 'authentication', :allow_forgery_protection do + let(:user) { create(:user) } + + it 'logout does not require a csrf token' do + login_as(user) + + post(destroy_user_session_path, headers: { 'X-CSRF-Token' => 'invalid' }) + + expect(response).to redirect_to(new_user_session_path) + end + end +end |