2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'Projects > Snippets > Project snippet', :js do
|
2020-10-24 23:57:45 +05:30
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
let_it_be(:project) do
|
|
|
|
create(:project, creator: user).tap do |p|
|
|
|
|
p.add_maintainer(user)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
let_it_be(:snippet) { create(:project_snippet, :repository, project: project, author: user) }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
before do
|
2020-01-01 13:55:28 +05:30
|
|
|
stub_feature_flags(snippets_vue: false)
|
2020-10-24 23:57:45 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
it_behaves_like 'show and render proper snippet blob' do
|
|
|
|
let(:anchor) { nil }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
subject do
|
|
|
|
visit project_snippet_path(project, snippet, anchor: anchor)
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
wait_for_requests
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
it_behaves_like 'showing user status' do
|
|
|
|
let(:file_path) { 'files/ruby/popen.rb' }
|
|
|
|
let(:user_with_status) { snippet.author }
|
2017-08-17 22:00:37 +05:30
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
subject { visit project_snippet_path(project, snippet) }
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
it_behaves_like 'does not show New Snippet button' do
|
|
|
|
let(:file_path) { 'files/ruby/popen.rb' }
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
subject { visit project_snippet_path(project, snippet) }
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|