Commit ae7c52a0 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Fix more tests

parent 41a5adca
...@@ -858,6 +858,8 @@ describe Projects::IssuesController do ...@@ -858,6 +858,8 @@ describe Projects::IssuesController do
before do before do
project.add_developer(user) project.add_developer(user)
sign_in(user) sign_in(user)
allow_any_instance_of(MergeRequest).to receive(:write_ref)
end end
it 'creates a new merge request' do it 'creates a new merge request' do
......
...@@ -12,7 +12,7 @@ describe 'Filter merge requests' do ...@@ -12,7 +12,7 @@ describe 'Filter merge requests' do
let!(:wontfix) { create(:label, project: project, title: "Won't fix") } let!(:wontfix) { create(:label, project: project, title: "Won't fix") }
before do before do
project.team << [user, :master] project.add_master(user)
group.add_developer(user) group.add_developer(user)
sign_in(user) sign_in(user)
create(:merge_request, source_project: project, target_project: project) create(:merge_request, source_project: project, target_project: project)
...@@ -170,7 +170,7 @@ describe 'Filter merge requests' do ...@@ -170,7 +170,7 @@ describe 'Filter merge requests' do
describe 'filter merge requests by text' do describe 'filter merge requests by text' do
before do before do
create(:merge_request, title: "Bug", source_project: project, target_project: project, source_branch: "bug") create(:merge_request, title: "Bug", source_project: project, target_project: project, source_branch: "wip")
bug_label = create(:label, project: project, title: 'bug') bug_label = create(:label, project: project, title: 'bug')
milestone = create(:milestone, title: "8", project: project) milestone = create(:milestone, title: "8", project: project)
...@@ -179,7 +179,7 @@ describe 'Filter merge requests' do ...@@ -179,7 +179,7 @@ describe 'Filter merge requests' do
title: "Bug 2", title: "Bug 2",
source_project: project, source_project: project,
target_project: project, target_project: project,
source_branch: "bug2", source_branch: "fix",
milestone: milestone, milestone: milestone,
author: user, author: user,
assignee: user) assignee: user)
...@@ -259,12 +259,12 @@ describe 'Filter merge requests' do ...@@ -259,12 +259,12 @@ describe 'Filter merge requests' do
end end
end end
describe 'filter merge requests and sort', js: true do describe 'filter merge requests and sort', :js do
before do before do
bug_label = create(:label, project: project, title: 'bug') bug_label = create(:label, project: project, title: 'bug')
mr1 = create(:merge_request, title: "Frontend", source_project: project, target_project: project, source_branch: "Frontend") mr1 = create(:merge_request, title: "Frontend", source_project: project, target_project: project, source_branch: "wip")
mr2 = create(:merge_request, title: "Bug 2", source_project: project, target_project: project, source_branch: "bug2") mr2 = create(:merge_request, title: "Bug 2", source_project: project, target_project: project, source_branch: "fix")
mr1.labels << bug_label mr1.labels << bug_label
mr2.labels << bug_label mr2.labels << bug_label
......
require 'rails_helper' require 'rails_helper'
feature 'Merge requests filter clear button', js: true do feature 'Merge requests filter clear button', :js do
include FilteredSearchHelpers include FilteredSearchHelpers
include MergeRequestHelpers include MergeRequestHelpers
include IssueHelpers include IssueHelpers
...@@ -9,8 +9,8 @@ feature 'Merge requests filter clear button', js: true do ...@@ -9,8 +9,8 @@ feature 'Merge requests filter clear button', js: true do
let!(:user) { create(:user) } let!(:user) { create(:user) }
let!(:milestone) { create(:milestone, project: project) } let!(:milestone) { create(:milestone, project: project) }
let!(:bug) { create(:label, project: project, name: 'bug')} let!(:bug) { create(:label, project: project, name: 'bug')}
let!(:mr1) { create(:merge_request, title: "Feature", source_project: project, target_project: project, source_branch: "Feature", milestone: milestone, author: user, assignee: user) } let!(:mr1) { create(:merge_request, title: "Feature", source_project: project, target_project: project, source_branch: "improve/awesome", milestone: milestone, author: user, assignee: user) }
let!(:mr2) { create(:merge_request, title: "Bugfix1", source_project: project, target_project: project, source_branch: "Bugfix1") } let!(:mr2) { create(:merge_request, title: "Bugfix1", source_project: project, target_project: project, source_branch: "fix") }
let(:merge_request_css) { '.merge-request' } let(:merge_request_css) { '.merge-request' }
let(:clear_search_css) { '.filtered-search-box .clear-search' } let(:clear_search_css) { '.filtered-search-box .clear-search' }
......
...@@ -245,6 +245,10 @@ feature 'Task Lists' do ...@@ -245,6 +245,10 @@ feature 'Task Lists' do
visit project_merge_request_path(project, merge) visit project_merge_request_path(project, merge)
end end
before do
allow_any_instance_of(Repository).to receive(:write_ref)
end
describe 'multiple tasks' do describe 'multiple tasks' do
let!(:merge) { create(:merge_request, :simple, description: markdown, author: user, source_project: project) } let!(:merge) { create(:merge_request, :simple, description: markdown, author: user, source_project: project) }
......
This diff is collapsed.
...@@ -20,6 +20,10 @@ describe CreateDeploymentService do ...@@ -20,6 +20,10 @@ describe CreateDeploymentService do
let(:service) { described_class.new(job) } let(:service) { described_class.new(job) }
before do
allow_any_instance_of(Deployment).to receive(:create_ref)
end
describe '#execute' do describe '#execute' do
subject { service.execute } subject { service.execute }
......
...@@ -3,7 +3,7 @@ require "spec_helper" ...@@ -3,7 +3,7 @@ require "spec_helper"
describe MergeRequests::GetUrlsService do describe MergeRequests::GetUrlsService do
let(:project) { create(:project, :public, :repository) } let(:project) { create(:project, :public, :repository) }
let(:service) { described_class.new(project) } let(:service) { described_class.new(project) }
let(:source_branch) { "my_branch" } let(:source_branch) { "merge-test" }
let(:new_merge_request_url) { "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/new?merge_request%5Bsource_branch%5D=#{source_branch}" } let(:new_merge_request_url) { "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/new?merge_request%5Bsource_branch%5D=#{source_branch}" }
let(:show_merge_request_url) { "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/#{merge_request.iid}" } let(:show_merge_request_url) { "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/#{merge_request.iid}" }
let(:new_branch_changes) { "#{Gitlab::Git::BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/#{source_branch}" } let(:new_branch_changes) { "#{Gitlab::Git::BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/#{source_branch}" }
...@@ -111,9 +111,9 @@ describe MergeRequests::GetUrlsService do ...@@ -111,9 +111,9 @@ describe MergeRequests::GetUrlsService do
end end
context 'pushing new branch and existing branch (with merge request created) at once' do context 'pushing new branch and existing branch (with merge request created) at once' do
let!(:merge_request) { create(:merge_request, source_project: project, source_branch: "existing_branch") } let!(:merge_request) { create(:merge_request, source_project: project, source_branch: "markdown") }
let(:new_branch_changes) { "#{Gitlab::Git::BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/new_branch" } let(:new_branch_changes) { "#{Gitlab::Git::BLANK_SHA} 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/new_branch" }
let(:existing_branch_changes) { "d14d6c0abdd253381df51a723d58691b2ee1ab08 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/existing_branch" } let(:existing_branch_changes) { "d14d6c0abdd253381df51a723d58691b2ee1ab08 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/markdown" }
let(:changes) { "#{new_branch_changes}\n#{existing_branch_changes}" } let(:changes) { "#{new_branch_changes}\n#{existing_branch_changes}" }
let(:new_merge_request_url) { "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/new?merge_request%5Bsource_branch%5D=new_branch" } let(:new_merge_request_url) { "http://#{Gitlab.config.gitlab.host}/#{project.namespace.name}/#{project.path}/merge_requests/new?merge_request%5Bsource_branch%5D=new_branch" }
...@@ -124,7 +124,7 @@ describe MergeRequests::GetUrlsService do ...@@ -124,7 +124,7 @@ describe MergeRequests::GetUrlsService do
url: new_merge_request_url, url: new_merge_request_url,
new_merge_request: true new_merge_request: true
}, { }, {
branch_name: "existing_branch", branch_name: "markdown",
url: show_merge_request_url, url: show_merge_request_url,
new_merge_request: false new_merge_request: false
}]) }])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment