diff options
author | haseeb <haseebeqx@yahoo.com> | 2018-03-17 17:47:43 +0530 |
---|---|---|
committer | haseeb <haseebeqx@yahoo.com> | 2018-03-17 17:47:43 +0530 |
commit | 520c93717a40e887b57afd86376c82db77e33e72 (patch) | |
tree | 04ab32500de28010c1031ddc735cd31e1099f9ef /spec/features | |
parent | d23337fd96058d38d6615e210b61830a3d334d46 (diff) | |
download | gitlab-ce-520c93717a40e887b57afd86376c82db77e33e72.tar.gz |
integration test added
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/snippets/embedded_snippet_spec.rb | 30 |
1 files changed, 30 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..d67f47279c5 --- /dev/null +++ b/spec/features/snippets/embedded_snippet_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' + +describe 'Embedded Snippets' do + include RSpec::Rails::RequestExampleGroup + + let(:project) { create(:project, :repository) } + let(:snippet) { create(:personal_snippet, :public, file_name: 'popen.rb', content: content) } + let(:content) { project.repository.blob_at('master', 'files/ruby/popen.rb').data } + + after do + FileUtils.rm_f([File.join(File.dirname(__FILE__), 'embedded_snippet.html'), File.join(File.dirname(__FILE__), 'snippet.js')]) + end + + it 'loads snippet', :js do + get "#{snippet_path(snippet)}.js" + + File.write(File.join(File.dirname(__FILE__), 'snippet.js'), response.body) + + script_tag = "<html><body><script src=\"snippet.js\"></script></body></html>" + File.write(File.join(File.dirname(__FILE__), 'embedded_snippet.html'), script_tag) + + Capybara.app = Rack::File.new File.dirname __FILE__ + + visit('embedded_snippet.html') + + expect(page).to have_content("popen.rb") + + expect(page).to have_content("require 'fileutils'") + end +end |