Skip to content

Commit

Permalink
[ci] Fix failing tests due to login issues
Browse files Browse the repository at this point in the history
There is a race condition in the branch_remote_repositories test.
If `User.current` got set by another test, the branching tests fail
because of permission errors in `Project#check_write_access!`.
  • Loading branch information
Ana06 committed Apr 20, 2017
1 parent c0a3eda commit bb5ff35
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/api/spec/models/project_spec.rb
Expand Up @@ -103,6 +103,11 @@
describe '#branch_remote_repositories' do
let(:branch_remote_repositories) { project.branch_remote_repositories("#{remote_project}:#{project}") }

before do
logout
allow(ProjectMetaFile).to receive(:new).and_return(remote_meta_xml)
end

context "normal project" do
let!(:repository) { create(:repository, name: 'xUbuntu_14.04', project: project) }
let(:remote_meta_xml) {
Expand Down Expand Up @@ -140,7 +145,6 @@
let(:expected_xml) { Nokogiri::XML(local_xml_meta) }

before do
allow(ProjectMetaFile).to receive(:new).and_return(remote_meta_xml)
branch_remote_repositories
project.reload
end
Expand Down Expand Up @@ -204,7 +208,6 @@
let(:expected_xml) { Nokogiri::XML(local_xml_meta) }

before do
allow(ProjectMetaFile).to receive(:new).and_return(remote_meta_xml)
branch_remote_repositories
project.reload
end
Expand Down

0 comments on commit bb5ff35

Please sign in to comment.