Skip to content
Snippets Groups Projects
Commit 8f210aeb authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 996f7009
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -2,11 +2,8 @@
 
module GitHelpers
def rugged_repo(repository)
rugged_repo_at_path(repository.disk_path + '.git')
end
path = File.join(TestEnv.repos_path, repository.disk_path + '.git')
 
def rugged_repo_at_path(relative_path)
path = File.join(TestEnv.repos_path, relative_path)
Rugged::Repository.new(path)
end
end
Loading
Loading
@@ -12,10 +12,4 @@ module WikiHelpers
::Wikis::CreateAttachmentService.new(project, user, opts)
.execute[:result][:file_path]
end
# Generate the form field name for a given attribute of an object.
# This is rather general, but is currently only used in the wiki featur tests.
def form_field_name(obj, attr_name)
"#{ActiveModel::Naming.param_key(obj)}[#{attr_name}]"
end
end
Loading
Loading
@@ -2,8 +2,7 @@
 
RSpec::Matchers.define :have_header_with_correct_id_and_link do |level, text, id, parent = ".md"|
match do |actual|
# anchors may be invisible
node = find("#{parent} h#{level} a#user-content-#{id}", visible: false)
node = find("#{parent} h#{level} a#user-content-#{id}")
 
expect(node[:href]).to end_with("##{id}")
 
Loading
Loading
Loading
Loading
@@ -117,6 +117,29 @@ shared_examples 'discussions API' do |parent_type, noteable_type, id_name, can_r
expect(response).to have_gitlab_http_status(401)
end
 
it 'tracks a Notes::CreateService event' do
expect(Gitlab::Tracking).to receive(:event) do |category, action, data|
expect(category).to eq('Notes::CreateService')
expect(action).to eq('execute')
expect(data[:label]).to eq('note')
expect(data[:value]).to be_an(Integer)
end
post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/discussions", user), params: { body: 'hi!' }
end
context 'with notes_create_service_tracking feature flag disabled' do
before do
stub_feature_flags(notes_create_service_tracking: false)
end
it 'does not track any events' do
expect(Gitlab::Tracking).not_to receive(:event)
post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/discussions"), params: { body: 'hi!' }
end
end
context 'when an admin or owner makes the request' do
it 'accepts the creation date to be set' do
creation_time = 2.weeks.ago
Loading
Loading
Loading
Loading
@@ -42,7 +42,7 @@ shared_examples 'wiki file attachments' do
end
end
 
context 'uploading is complete' do
context 'uploading is complete', :quarantine do
it 'shows "Attach a file" button on uploading complete' do
attach_with_dropzone
wait_for_requests
Loading
Loading
@@ -52,11 +52,11 @@ shared_examples 'wiki file attachments' do
end
 
it 'the markdown link is added to the page' do
fill_in(:wiki_page_content, with: '')
fill_in(:wiki_content, with: '')
attach_with_dropzone(true)
wait_for_requests
 
expect(page.find('#wiki_page_content').value)
expect(page.find('#wiki_content').value)
.to match(%r{\!\[dk\]\(uploads/\h{32}/dk\.png\)$})
end
 
Loading
Loading
@@ -70,7 +70,7 @@ shared_examples 'wiki file attachments' do
img_link = page.find('a.no-attachment-icon img')['src']
 
expect(link).to eq img_link
expect(URI.parse(link).path).to eq File.join(wiki.wiki_page_path, file_path)
expect(URI.parse(link).path).to eq File.join(wiki.wiki_base_path, file_path)
end
 
it 'the file has been added to the wiki repository' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment