diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-04-16 13:56:16 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-04-16 13:56:16 +0300 |
commit | cee3df6c249ffbdd3b5f81367d8d69deafa646d7 (patch) | |
tree | 1a2e5362897d0433753bd54ca321d913dd2f5f8a /spec/features | |
parent | 4ed152e4ba7efede082a9c8884fd94f0a113e398 (diff) | |
parent | 99f278f6fdf6e0577312afc3913a6bb376dfdd2b (diff) |
Merge branch '8088_embedded_snippets_support' into 'master'
Embedded Snippets Support
Closes #8088
See merge request gitlab-org/gitlab-ce!15695
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/snippets/embedded_snippet_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/features/snippets/embedded_snippet_spec.rb b/spec/features/snippets/embedded_snippet_spec.rb new file mode 100644 index 00000000000..ab661f6fc69 --- /dev/null +++ b/spec/features/snippets/embedded_snippet_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +describe 'Embedded Snippets' do + let(:snippet) { create(:personal_snippet, :public, file_name: 'random_dir.rb', content: content) } + let(:content) { "require 'fileutils'\nFileUtils.mkdir_p 'some/random_dir'\n" } + + it 'loads snippet', :js do + script_url = "http://#{Capybara.current_session.server.host}:#{Capybara.current_session.server.port}/#{snippet_path(snippet, format: 'js')}" + embed_body = "<html><body><script src=\"#{script_url}\"></script></body></html>" + + rack_app = proc do + ['200', { 'Content-Type' => 'text/html' }, [embed_body]] + end + + server = Capybara::Server.new(rack_app) + server.boot + + visit("http://#{server.host}:#{server.port}/embedded_snippet.html") + + expect(page).to have_content("random_dir.rb") + expect(page).to have_content("require 'fileutils'") + expect(page).to have_link('Open raw') + expect(page).to have_link('Download') + end +end |