Welcome to mirror list, hosted at ThFree Co, Russian Federation.

issues_channel_spec.rb « channels « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1c88cc734564a34471eac70fafa8a6dee40a74d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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