From 8d5c9935ffb8fa41f831742ac287fd010a006b42 Mon Sep 17 00:00:00 2001
From: Kamil Trzcinski <ayufan@ayufan.eu>
Date: Tue, 15 Sep 2015 22:00:17 +0200
Subject: [PATCH] Fix: models/ci/project_spec.rb

---
 spec/models/ci/project_spec.rb            | 18 +++++-------
 spec/support/gitlab_stubs/raw_project.yml | 36 -----------------------
 2 files changed, 7 insertions(+), 47 deletions(-)
 delete mode 100644 spec/support/gitlab_stubs/raw_project.yml

diff --git a/spec/models/ci/project_spec.rb b/spec/models/ci/project_spec.rb
index 48f76e11ce9..7c0fbbd60bb 100644
--- a/spec/models/ci/project_spec.rb
+++ b/spec/models/ci/project_spec.rb
@@ -124,19 +124,15 @@ describe Ci::Project do
   end
 
   describe 'Project.parse' do
-    let(:project_dump) { YAML.load File.read(Rails.root.join('spec/support/gitlab_stubs/raw_project.yml')) }
-    let(:parsed_project) { Ci::Project.parse(project_dump) }
+    let(:project) { FactoryGirl.create :project }
 
+    subject { Ci::Project.parse(project) }
 
-    it { expect(parsed_project).to be_valid }
-    it { expect(parsed_project).to be_kind_of(Ci::Project) }
-    it { expect(parsed_project.name).to eq("GitLab / api.gitlab.org") }
-    it { expect(parsed_project.gitlab_id).to eq(189) }
-    it { expect(parsed_project.gitlab_url).to eq("http://demo.gitlab.com/gitlab/api-gitlab-org") }
-
-    it "parses plain hash" do
-      expect(Ci::Project.parse(project_dump).name).to eq("GitLab / api.gitlab.org")
-    end
+    it { is_expected.to be_valid }
+    it { is_expected.to be_kind_of(Ci::Project) }
+    it { expect(subject.name).to eq(project.name_with_namespace) }
+    it { expect(subject.gitlab_id).to eq(4) }
+    it { expect(subject.gitlab_url).to eq("http://localhost/namespace5/gitlabhq") }
   end
 
   describe :repo_url_with_auth do
diff --git a/spec/support/gitlab_stubs/raw_project.yml b/spec/support/gitlab_stubs/raw_project.yml
deleted file mode 100644
index df2ce223d1f..00000000000
--- a/spec/support/gitlab_stubs/raw_project.yml
+++ /dev/null
@@ -1,36 +0,0 @@
---- !ruby/object:OpenStruct
-table:
-  :id: 189
-  :description: Website at http://api.gitlab.org/
-  :default_branch: master
-  :public: false
-  :visibility_level: 0
-  :ssh_url_to_repo: dzaporozhets@localhost:gitlab/api-gitlab-org.git
-  :http_url_to_repo: http://localhost:3000/gitlab/api-gitlab-org.git
-  :web_url: http://localhost:3000/gitlab/api-gitlab-org
-  :owner:
-    id: 1
-    name: GitLab
-    created_at: '2012-10-03T09:59:57.000Z'
-  :name: api.gitlab.org
-  :name_with_namespace: GitLab / api.gitlab.org
-  :path: api-gitlab-org
-  :path_with_namespace: gitlab/api-gitlab-org
-  :issues_enabled: true
-  :merge_requests_enabled: true
-  :wall_enabled: false
-  :wiki_enabled: false
-  :snippets_enabled: false
-  :created_at: '2013-06-06T12:29:39.000Z'
-  :last_activity_at: '2013-12-06T20:29:42.000Z'
-  :namespace:
-    id: 1
-    name: GitLab
-    path: gitlab
-    owner_id: 1
-    created_at: '2012-10-03T09:59:57.000Z'
-    updated_at: '2014-01-28T08:49:53.000Z'
-    description: Self hosted Git management software
-    avatar:
-      url: /uploads/group/avatar/1/0-vader-profile.jpg
-
-- 
GitLab