diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-05-20 14:34:42 +0000 |
commit | 9f46488805e86b1bc341ea1620b866016c2ce5ed (patch) | |
tree | f9748c7e287041e37d6da49e0a29c9511dc34768 /spec/channels/issues_channel_spec.rb | |
parent | dfc92d081ea0332d69c8aca2f0e745cb48ae5e6d (diff) | |
download | gitlab-ce-9f46488805e86b1bc341ea1620b866016c2ce5ed.tar.gz |
Add latest changes from gitlab-org/gitlab@13-0-stable-ee
Diffstat (limited to 'spec/channels/issues_channel_spec.rb')
-rw-r--r-- | spec/channels/issues_channel_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/channels/issues_channel_spec.rb b/spec/channels/issues_channel_spec.rb new file mode 100644 index 00000000000..1c88cc73456 --- /dev/null +++ b/spec/channels/issues_channel_spec.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe IssuesChannel do + let_it_be(:issue) { create(:issue) } + + it 'rejects when project path is invalid' do + subscribe(project_path: 'invalid_project_path', iid: issue.iid) + + expect(subscription).to be_rejected + end + + it 'rejects when iid is invalid' do + subscribe(project_path: issue.project.full_path, iid: non_existing_record_iid) + + expect(subscription).to be_rejected + end + + it 'rejects when the user does not have access' do + stub_connection current_user: nil + + subscribe(project_path: issue.project.full_path, iid: issue.iid) + + expect(subscription).to be_rejected + end + + it 'subscribes to a stream when the user has access' do + stub_connection current_user: issue.author + + subscribe(project_path: issue.project.full_path, iid: issue.iid) + + expect(subscription).to be_confirmed + expect(subscription).to have_stream_for(issue) + end +end |