Commit 9a88e4d184e5959cb3b7212d027ae4bbe1c97302

Authored by Dmitriy Zaporozhets
1 parent e16cebac

Fix some tests. Use travis-ci 1.9.2

@@ -8,7 +8,7 @@ branches: @@ -8,7 +8,7 @@ branches:
8 only: 8 only:
9 - 'master' 9 - 'master'
10 rvm: 10 rvm:
11 - - 1.9.3 11 + - 1.9.2
12 services: 12 services:
13 - mysql 13 - mysql
14 - postgresql 14 - postgresql
spec/models/gitlab_ci_service_spec.rb
@@ -35,10 +35,6 @@ describe GitlabCiService do @@ -35,10 +35,6 @@ describe GitlabCiService do
35 ) 35 )
36 end 36 end
37 37
38 - describe :commit_badge_path do  
39 - it { @service.commit_badge_path("2ab7834c").should == "http://ci.gitlab.org/projects/2/status?sha=2ab7834c"}  
40 - end  
41 -  
42 describe :commit_status_path do 38 describe :commit_status_path do
43 it { @service.commit_status_path("2ab7834c").should == "http://ci.gitlab.org/projects/2/builds/2ab7834c/status.json?token=verySecret"} 39 it { @service.commit_status_path("2ab7834c").should == "http://ci.gitlab.org/projects/2/builds/2ab7834c/status.json?token=verySecret"}
44 end 40 end
spec/models/note_spec.rb
@@ -77,7 +77,7 @@ describe Note do @@ -77,7 +77,7 @@ describe Note do
77 end 77 end
78 78
79 let(:project) { create(:project) } 79 let(:project) { create(:project) }
80 - let(:commit) { project.commit } 80 + let(:commit) { project.repository.commit }
81 81
82 describe "Commit notes" do 82 describe "Commit notes" do
83 before do 83 before do
spec/models/project_spec.rb
@@ -97,11 +97,6 @@ describe Project do @@ -97,11 +97,6 @@ describe Project do
97 project.url_to_repo.should == Gitlab.config.gitolite.ssh_path_prefix + "somewhere.git" 97 project.url_to_repo.should == Gitlab.config.gitolite.ssh_path_prefix + "somewhere.git"
98 end 98 end
99 99
100 - it "should return path to repo" do  
101 - project = Project.new(path: "somewhere")  
102 - project.path_to_repo.should == Rails.root.join("tmp", "repositories", "somewhere")  
103 - end  
104 -  
105 it "returns the full web URL for this repo" do 100 it "returns the full web URL for this repo" do
106 project = Project.new(path: "somewhere") 101 project = Project.new(path: "somewhere")
107 project.web_url.should == "#{Gitlab.config.gitlab.url}/somewhere" 102 project.web_url.should == "#{Gitlab.config.gitlab.url}/somewhere"
@@ -229,32 +224,15 @@ describe Project do @@ -229,32 +224,15 @@ describe Project do
229 end 224 end
230 end 225 end
231 226
232 - describe "#empty_repo?" do 227 + describe :repository do
233 let(:project) { create(:project) } 228 let(:project) { create(:project) }
234 229
235 - it "should return true if the repo doesn't exist" do  
236 - project.stub(repo_exists?: false, has_commits?: true)  
237 - project.should be_empty_repo  
238 - end  
239 -  
240 - it "should return true if the repo has commits" do  
241 - project.stub(repo_exists?: true, has_commits?: false)  
242 - project.should be_empty_repo  
243 - end  
244 -  
245 - it "should return false if the repo exists and has commits" do  
246 - project.stub(repo_exists?: true, has_commits?: true)  
247 - project.should_not be_empty_repo  
248 - end  
249 - end  
250 -  
251 - describe :repository do  
252 it "should return valid repo" do 230 it "should return valid repo" do
253 project.repository.should be_kind_of(Repository) 231 project.repository.should be_kind_of(Repository)
254 end 232 end
255 233
256 it "should return nil" do 234 it "should return nil" do
257 - Project.new(path: "invalid").repository.should be_nil 235 + Project.new(path: "empty").repository.should be_nil
258 end 236 end
259 end 237 end
260 end 238 end
spec/models/protected_branch_spec.rb
@@ -44,7 +44,7 @@ describe ProtectedBranch do @@ -44,7 +44,7 @@ describe ProtectedBranch do
44 let(:branch) { create(:protected_branch) } 44 let(:branch) { create(:protected_branch) }
45 45
46 it 'commits itself to its project' do 46 it 'commits itself to its project' do
47 - branch.project.should_receive(:commit).with(branch.name) 47 + branch.project.repository.should_receive(:commit).with(branch.name)
48 branch.commit 48 branch.commit
49 end 49 end
50 end 50 end
spec/models/repository_spec.rb
@@ -30,7 +30,7 @@ describe Repository do @@ -30,7 +30,7 @@ describe Repository do
30 end 30 end
31 31
32 it "returns non-master when master exists but default branch is set to something else" do 32 it "returns non-master when master exists but default branch is set to something else" do
33 - repository.default_branch = 'stable' 33 + repository.root_ref = 'stable'
34 repository.should_receive(:branch_names).at_least(:once).and_return([stable, master]) 34 repository.should_receive(:branch_names).at_least(:once).and_return([stable, master])
35 repository.discover_default_branch.should == 'stable' 35 repository.discover_default_branch.should == 'stable'
36 end 36 end
spec/requests/security/project_access_spec.rb
@@ -22,10 +22,10 @@ describe "Application access" do @@ -22,10 +22,10 @@ describe "Application access" do
22 22
23 before do 23 before do
24 # full access 24 # full access
25 - project.users_projects.create(user: master, project_access: UsersProject::MASTER) 25 + project.team << [master, :master]
26 26
27 # readonly 27 # readonly
28 - project.users_projects.create(user: reporter, project_access: UsersProject::REPORTER) 28 + project.team << [reporter, :reporter]
29 end 29 end
30 30
31 describe "GET /project_code" do 31 describe "GET /project_code" do
@@ -62,7 +62,7 @@ describe &quot;Application access&quot; do @@ -62,7 +62,7 @@ describe &quot;Application access&quot; do
62 end 62 end
63 63
64 describe "GET /project_code/commit/:sha" do 64 describe "GET /project_code/commit/:sha" do
65 - subject { project_commit_path(project, project.commit) } 65 + subject { project_commit_path(project, project.repository.commit) }
66 66
67 it { should be_allowed_for master } 67 it { should be_allowed_for master }
68 it { should be_allowed_for reporter } 68 it { should be_allowed_for reporter }
@@ -107,7 +107,7 @@ describe &quot;Application access&quot; do @@ -107,7 +107,7 @@ describe &quot;Application access&quot; do
107 107
108 describe "GET /project_code/blob" do 108 describe "GET /project_code/blob" do
109 before do 109 before do
110 - commit = project.commit 110 + commit = project.repository.commit
111 path = commit.tree.contents.select { |i| i.is_a?(Grit::Blob)}.first.name 111 path = commit.tree.contents.select { |i| i.is_a?(Grit::Blob)}.first.name
112 @blob_path = project_blob_path(project, File.join(commit.id, path)) 112 @blob_path = project_blob_path(project, File.join(commit.id, path))
113 end 113 end