diff options
author | James Lopez <james@jameslopez.es> | 2016-03-04 20:37:00 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-03-04 20:37:00 +0300 |
commit | 7085850c50a6dd7072bd2c80f092b0c20f74d1dc (patch) | |
tree | 11fbad852ad2f413c48d1e2a0681f7ea69d89de7 | |
parent | c2b33d3b71215858892debeb45d93a69d530fd8e (diff) |
fix specs
-rw-r--r-- | app/models/project_import_data.rb | 3 | ||||
-rw-r--r-- | lib/gitlab/import_url_exposer.rb | 2 | ||||
-rw-r--r-- | spec/factories/project_import_data.rb | 5 | ||||
-rw-r--r-- | spec/lib/gitlab/github_import/project_creator_spec.rb | 4 | ||||
-rw-r--r-- | spec/lib/gitlab/github_import/wiki_formatter_spec.rb | 9 |
5 files changed, 16 insertions, 7 deletions
diff --git a/app/models/project_import_data.rb b/app/models/project_import_data.rb index 493c82a94fa..23f4e97b8aa 100644 --- a/app/models/project_import_data.rb +++ b/app/models/project_import_data.rb @@ -12,8 +12,7 @@ require 'file_size_validator' class ProjectImportData < ActiveRecord::Base belongs_to :project - attr_encrypted :credentials, key: Gitlab::Application.secrets.db_key_base - serialize :credentials, JSON + attr_encrypted :credentials, key: Gitlab::Application.secrets.db_key_base, marshal: true serialize :data, JSON diff --git a/lib/gitlab/import_url_exposer.rb b/lib/gitlab/import_url_exposer.rb index 6b4af0bf265..f1919dffa8a 100644 --- a/lib/gitlab/import_url_exposer.rb +++ b/lib/gitlab/import_url_exposer.rb @@ -14,4 +14,4 @@ module Gitlab credentials.values.join(":") end end -end
\ No newline at end of file +end diff --git a/spec/factories/project_import_data.rb b/spec/factories/project_import_data.rb new file mode 100644 index 00000000000..18393cdda98 --- /dev/null +++ b/spec/factories/project_import_data.rb @@ -0,0 +1,5 @@ +FactoryGirl.define do + factory :project_import_data, class: ProjectImportData do + data "test" + end +end
\ No newline at end of file diff --git a/spec/lib/gitlab/github_import/project_creator_spec.rb b/spec/lib/gitlab/github_import/project_creator_spec.rb index 36abe87f527..290c855642a 100644 --- a/spec/lib/gitlab/github_import/project_creator_spec.rb +++ b/spec/lib/gitlab/github_import/project_creator_spec.rb @@ -12,7 +12,7 @@ describe Gitlab::GithubImport::ProjectCreator, lib: true do owner: OpenStruct.new(login: "john") ) end - let(:namespace){ create(:group, owner: user) } + let(:namespace) { create(:group, owner: user) } let(:token) { "asdffg" } let(:access_params) { { github_access_token: token } } @@ -27,7 +27,7 @@ describe Gitlab::GithubImport::ProjectCreator, lib: true do project = project_creator.execute 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) end end diff --git a/spec/lib/gitlab/github_import/wiki_formatter_spec.rb b/spec/lib/gitlab/github_import/wiki_formatter_spec.rb index aed2aa39e3a..46d5c2f3296 100644 --- a/spec/lib/gitlab/github_import/wiki_formatter_spec.rb +++ b/spec/lib/gitlab/github_import/wiki_formatter_spec.rb @@ -3,10 +3,15 @@ require 'spec_helper' describe Gitlab::GithubImport::WikiFormatter, lib: true do let(:project) do 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 - 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 it 'appends .wiki to project path' do |