2019-07-25 05:24:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-04-13 16:47:28 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-03 18:08:28 +00:00
|
|
|
RSpec.describe 'Snippet', :js do
|
2020-07-31 12:10:02 +00:00
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
let_it_be(:snippet) { create(:personal_snippet, :public, :repository, author: user) }
|
2017-04-13 16:47:28 +00:00
|
|
|
|
2019-12-06 03:08:02 +00:00
|
|
|
before do
|
|
|
|
stub_feature_flags(snippets_vue: false)
|
|
|
|
end
|
|
|
|
|
2020-07-31 12:10:02 +00:00
|
|
|
it_behaves_like 'show and render proper snippet blob' do
|
|
|
|
let(:anchor) { nil }
|
2017-04-13 16:47:28 +00:00
|
|
|
|
2020-07-31 12:10:02 +00:00
|
|
|
subject do
|
|
|
|
visit snippet_path(snippet, anchor: anchor)
|
2017-04-13 16:47:28 +00:00
|
|
|
|
2017-05-17 18:25:13 +00:00
|
|
|
wait_for_requests
|
2017-04-13 16:47:28 +00:00
|
|
|
end
|
|
|
|
end
|
2018-07-16 16:18:52 +00:00
|
|
|
|
|
|
|
it_behaves_like 'showing user status' do
|
2020-07-31 12:10:02 +00:00
|
|
|
let(:file_path) { 'files/ruby/popen.rb' }
|
2018-07-16 16:18:52 +00:00
|
|
|
let(:user_with_status) { snippet.author }
|
|
|
|
|
|
|
|
subject { visit snippet_path(snippet) }
|
|
|
|
end
|
2019-11-29 21:06:13 +00:00
|
|
|
|
2020-07-31 12:10:02 +00:00
|
|
|
it_behaves_like 'does not show New Snippet button' do
|
|
|
|
let(:file_path) { 'files/ruby/popen.rb' }
|
2019-11-29 21:06:13 +00:00
|
|
|
|
2020-07-31 12:10:02 +00:00
|
|
|
subject { visit snippet_path(snippet) }
|
2019-11-29 21:06:13 +00:00
|
|
|
end
|
2017-04-13 16:47:28 +00:00
|
|
|
end
|