summaryrefslogtreecommitdiff
path: root/spec/features/snippets_spec.rb
blob: 35eb5c2e1934d33003030c687b95dc93aad75a18 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Snippets' do
  context 'when the project has snippets' do
    let(:project) { create(:project, :public) }
    let!(:snippets) { create_list(:project_snippet, 2, :public, author: project.first_owner, project: project) }

    before do
      allow(Snippet).to receive(:default_per_page).and_return(1)

      visit project_snippets_path(project)
    end

    it_behaves_like 'paginated snippets'
  end

  describe 'rendering engine' do
    let_it_be(:snippet) { create(:personal_snippet, :public) }

    before do
      visit snippet_path(snippet)
    end

    it 'renders Vue application' do
      expect(page).to have_selector('#js-snippet-view')
      expect(page).not_to have_selector('.personal-snippets')
    end
  end
end