diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-11 18:07:38 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-11 18:07:38 +0300 |
commit | 4eea104c69e59f6fa53c7bc15b986c69f29b60c8 (patch) | |
tree | 2eff1ce7ac4a58de15b1f5980acfdb22c7b92ac0 /spec/helpers | |
parent | b86f474bf51e20d2db4cf0895d0a8e0894e31c08 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/snippets_helper_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/helpers/snippets_helper_spec.rb b/spec/helpers/snippets_helper_spec.rb index 428fe97f172..6fdf4f5cfb4 100644 --- a/spec/helpers/snippets_helper_spec.rb +++ b/spec/helpers/snippets_helper_spec.rb @@ -127,4 +127,28 @@ describe SnippetsHelper do end end end + + describe '#snippet_embed_input' do + subject { snippet_embed_input(snippet) } + + context 'with PersonalSnippet' do + let(:snippet) { public_personal_snippet } + + it 'returns the input component' do + expect(subject).to eq embed_input(snippet_url(snippet)) + end + end + + context 'with ProjectSnippet' do + let(:snippet) { public_project_snippet } + + it 'returns the input component' do + expect(subject).to eq embed_input(project_snippet_url(snippet.project, snippet)) + end + end + + def embed_input(url) + "<input type=\"text\" readonly=\"readonly\" class=\"js-snippet-url-area snippet-embed-input form-control\" data-url=\"#{url}\" value=\"<script src="#{url}.js"></script>\" autocomplete=\"off\"></input>" + end + end end |