Skip to content
Snippets Groups Projects
Commit 7085850c authored by James Lopez's avatar James Lopez
Browse files

fix specs

parent c2b33d3b
No related branches found
No related tags found
1 merge request!3066Fix for import_url fields on projects containing third-party credentials
Pipeline #
Loading
@@ -12,8 +12,7 @@ require 'file_size_validator'
Loading
@@ -12,8 +12,7 @@ require 'file_size_validator'
   
class ProjectImportData < ActiveRecord::Base class ProjectImportData < ActiveRecord::Base
belongs_to :project belongs_to :project
attr_encrypted :credentials, key: Gitlab::Application.secrets.db_key_base attr_encrypted :credentials, key: Gitlab::Application.secrets.db_key_base, marshal: true
serialize :credentials, JSON
   
serialize :data, JSON serialize :data, JSON
   
Loading
Loading
Loading
@@ -14,4 +14,4 @@ module Gitlab
Loading
@@ -14,4 +14,4 @@ module Gitlab
credentials.values.join(":") credentials.values.join(":")
end end
end end
end end
\ No newline at end of file
FactoryGirl.define do
factory :project_import_data, class: ProjectImportData do
data "test"
end
end
\ No newline at end of file
Loading
@@ -12,7 +12,7 @@ describe Gitlab::GithubImport::ProjectCreator, lib: true do
Loading
@@ -12,7 +12,7 @@ describe Gitlab::GithubImport::ProjectCreator, lib: true do
owner: OpenStruct.new(login: "john") owner: OpenStruct.new(login: "john")
) )
end end
let(:namespace){ create(:group, owner: user) } let(:namespace) { create(:group, owner: user) }
let(:token) { "asdffg" } let(:token) { "asdffg" }
let(:access_params) { { github_access_token: token } } let(:access_params) { { github_access_token: token } }
   
Loading
@@ -27,7 +27,7 @@ describe Gitlab::GithubImport::ProjectCreator, lib: true do
Loading
@@ -27,7 +27,7 @@ describe Gitlab::GithubImport::ProjectCreator, lib: true do
project = project_creator.execute project = project_creator.execute
   
expect(project.import_url).to eq("https://gitlab.com/asd/vim.git") expect(project.import_url).to eq("https://gitlab.com/asd/vim.git")
expect(project.import_data.credentials).to eq("asdffg") expect(project.import_data.credentials).to eq(:github_access_token => "asdffg")
expect(project.visibility_level).to eq(Gitlab::VisibilityLevel::PRIVATE) expect(project.visibility_level).to eq(Gitlab::VisibilityLevel::PRIVATE)
end end
end end
Loading
@@ -3,10 +3,15 @@ require 'spec_helper'
Loading
@@ -3,10 +3,15 @@ require 'spec_helper'
describe Gitlab::GithubImport::WikiFormatter, lib: true do describe Gitlab::GithubImport::WikiFormatter, lib: true do
let(:project) do let(:project) do
create(:project, namespace: create(:namespace, path: 'gitlabhq'), create(:project, namespace: create(:namespace, path: 'gitlabhq'),
import_url: 'https://xxx@github.com/gitlabhq/sample.gitlabhq.git') import_url: 'https://github.com/gitlabhq/sample.gitlabhq.git')
end end
   
subject(:wiki) { described_class.new(project)} let!(:project_import_data) do
create(:project_import_data, credentials: { github_access_token: 'xxx' },
project: project)
end
subject(:wiki) { described_class.new(project) }
   
describe '#path_with_namespace' do describe '#path_with_namespace' do
it 'appends .wiki to project path' do it 'appends .wiki to project path' do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment