snippet.rb 1.03 KB
Newer Older
1
2
# frozen_string_literal: true

Douwe Maan's avatar
Douwe Maan committed
3
4
require 'spec_helper'

5
describe SnippetsController, '(JavaScript fixtures)', type: :controller do
Douwe Maan's avatar
Douwe Maan committed
6
7
8
9
10
  include JavaScriptFixturesHelpers

  let(:admin) { create(:admin) }
  let(:namespace) { create(:namespace, name: 'frontend-fixtures' )}
  let(:project) { create(:project, :repository, namespace: namespace, path: 'branches-project') }
11
  let(:snippet) { create(:personal_snippet, title: 'snippet.md', content: '# snippet', file_name: 'snippet.md', author: admin) }
Douwe Maan's avatar
Douwe Maan committed
12
13
14
15

  render_views

  before(:all) do
16
    clean_frontend_fixtures('snippets/')
Douwe Maan's avatar
Douwe Maan committed
17
18
  end

19
  before do
20
    stub_feature_flags(snippets_vue: false)
Douwe Maan's avatar
Douwe Maan committed
21
    sign_in(admin)
22
    allow(Discussion).to receive(:build_discussion_id).and_return(['discussionid:ceterumcenseo'])
Douwe Maan's avatar
Douwe Maan committed
23
24
  end

25
26
27
28
  after do
    remove_repository(project)
  end

29
  it 'snippets/show.html' do
30
31
    create(:discussion_note_on_snippet, noteable: snippet, project: project, author: admin, note: '- [ ] Task List Item')

32
    get(:show, params: { id: snippet.to_param })
Douwe Maan's avatar
Douwe Maan committed
33

34
    expect(response).to be_successful
Douwe Maan's avatar
Douwe Maan committed
35
36
  end
end