Commit 7085850c authored by James Lopez's avatar James Lopez

fix specs

parent c2b33d3b
...@@ -12,8 +12,7 @@ require 'file_size_validator' ...@@ -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
......
...@@ -14,4 +14,4 @@ module Gitlab ...@@ -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
...@@ -12,7 +12,7 @@ describe Gitlab::GithubImport::ProjectCreator, lib: true do ...@@ -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 } }
...@@ -27,7 +27,7 @@ describe Gitlab::GithubImport::ProjectCreator, lib: true do ...@@ -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
...@@ -3,10 +3,15 @@ require 'spec_helper' ...@@ -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
......
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