summaryrefslogtreecommitdiff
path: root/spec/models/personal_snippet_spec.rb
blob: fb96d6e8bc32c5e69327b37546dba8e49fd7f1ea (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
# frozen_string_literal: true

require 'spec_helper'

describe PersonalSnippet do
  describe '#embeddable?' do
    [
      { snippet: :public,   embeddable: true },
      { snippet: :internal, embeddable: false },
      { snippet: :private,  embeddable: false }
    ].each do |combination|
      it 'returns true when snippet is public' do
        snippet = build(:personal_snippet, combination[:snippet])

        expect(snippet.embeddable?).to eq(combination[:embeddable])
      end
    end
  end

  it_behaves_like 'model with repository' do
    let_it_be(:container) { create(:personal_snippet, :repository) }
    let(:stubbed_container) { build_stubbed(:personal_snippet) }
    let(:expected_full_path) { "@snippets/#{container.id}" }
    let(:expected_web_url_path) { "snippets/#{container.id}" }
    let(:expected_repo_url_path) { expected_web_url_path }
  end
end