2019-12-26 22:10:19 +05:30
|
|
|
# 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
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
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}" }
|
2020-05-24 23:13:21 +05:30
|
|
|
let(:expected_repo_url_path) { expected_web_url_path }
|
2020-03-13 15:44:24 +05:30
|
|
|
end
|
2019-12-26 22:10:19 +05:30
|
|
|
end
|