Commit a7734bba845e1079f7859f95f10be2c5b65cfded

Authored by gitlabhq
1 parent af08ed6b

fix tests after refactor

spec/requests/projects_security_spec.rb
@@ -36,13 +36,13 @@ describe "Projects" do @@ -36,13 +36,13 @@ describe "Projects" do
36 it { project_path(@project).should be_denied_for :visitor } 36 it { project_path(@project).should be_denied_for :visitor }
37 end 37 end
38 38
39 - describe "GET /project_code/tree" do  
40 - it { tree_project_path(@project).should be_allowed_for @u1 }  
41 - it { tree_project_path(@project).should be_allowed_for @u3 }  
42 - it { tree_project_path(@project).should be_denied_for :admin }  
43 - it { tree_project_path(@project).should be_denied_for @u2 }  
44 - it { tree_project_path(@project).should be_denied_for :user }  
45 - it { tree_project_path(@project).should be_denied_for :visitor } 39 + describe "GET /project_code/master/tree" do
  40 + it { tree_project_ref_path(@project, @project.root_ref).should be_allowed_for @u1 }
  41 + it { tree_project_ref_path(@project, @project.root_ref).should be_allowed_for @u3 }
  42 + it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for :admin }
  43 + it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for @u2 }
  44 + it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for :user }
  45 + it { tree_project_ref_path(@project, @project.root_ref).should be_denied_for :visitor }
46 end 46 end
47 47
48 describe "GET /project_code/commits" do 48 describe "GET /project_code/commits" do
@@ -85,7 +85,7 @@ describe "Projects" do @@ -85,7 +85,7 @@ describe "Projects" do
85 before do 85 before do
86 @commit = @project.commit 86 @commit = @project.commit
87 @path = @commit.tree.contents.select { |i| i.is_a?(Grit::Blob)}.first.name 87 @path = @commit.tree.contents.select { |i| i.is_a?(Grit::Blob)}.first.name
88 - @blob_path = blob_project_path(@project, :commit_id => @commit.id, :path => @path) 88 + @blob_path = blob_project_ref_path(@project, @commit.id, :path => @path)
89 end 89 end
90 90
91 it { @blob_path.should be_allowed_for @u1 } 91 it { @blob_path.should be_allowed_for @u1 }
spec/requests/projects_tree_perfomance_spec.rb
@@ -14,7 +14,7 @@ describe "Projects" do @@ -14,7 +14,7 @@ describe "Projects" do
14 14
15 it "should be fast" do 15 it "should be fast" do
16 time = Benchmark.realtime do 16 time = Benchmark.realtime do
17 - visit tree_project_path(@project) 17 + visit tree_project_ref_path(@project, @project.root_ref)
18 end 18 end
19 (time < 1.0).should be_true 19 (time < 1.0).should be_true
20 end 20 end
@@ -28,7 +28,7 @@ describe &quot;Projects&quot; do @@ -28,7 +28,7 @@ describe &quot;Projects&quot; do
28 28
29 it "should be fast" do 29 it "should be fast" do
30 time = Benchmark.realtime do 30 time = Benchmark.realtime do
31 - visit tree_project_path(@project, :commit_id => ValidCommit::ID) 31 + visit tree_project_ref_path(@project, ValidCommit::ID)
32 end 32 end
33 (time < 1.0).should be_true 33 (time < 1.0).should be_true
34 end 34 end
spec/requests/projects_tree_spec.rb
@@ -9,11 +9,11 @@ describe &quot;Projects&quot; do @@ -9,11 +9,11 @@ describe &quot;Projects&quot; do
9 @project = Factory :project 9 @project = Factory :project
10 @project.add_access(@user, :read) 10 @project.add_access(@user, :read)
11 11
12 - visit tree_project_path(@project) 12 + visit tree_project_ref_path(@project, @project.root_ref)
13 end 13 end
14 14
15 it "should be correct path" do 15 it "should be correct path" do
16 - current_path.should == tree_project_path(@project) 16 + current_path.should == tree_project_ref_path(@project, @project.root_ref)
17 end 17 end
18 18
19 it_behaves_like :tree_view 19 it_behaves_like :tree_view
@@ -24,11 +24,11 @@ describe &quot;Projects&quot; do @@ -24,11 +24,11 @@ describe &quot;Projects&quot; do
24 @project = Factory :project 24 @project = Factory :project
25 @project.add_access(@user, :read) 25 @project.add_access(@user, :read)
26 26
27 - visit tree_project_path(@project, :commit_id => ValidCommit::ID) 27 + visit tree_project_ref_path(@project, ValidCommit::ID)
28 end 28 end
29 29
30 it "should be correct path" do 30 it "should be correct path" do
31 - current_path.should == tree_project_path(@project) 31 + current_path.should == tree_project_ref_path(@project, ValidCommit::ID)
32 end 32 end
33 33
34 it_behaves_like :tree_view 34 it_behaves_like :tree_view
@@ -40,11 +40,11 @@ describe &quot;Projects&quot; do @@ -40,11 +40,11 @@ describe &quot;Projects&quot; do
40 @project = Factory :project 40 @project = Factory :project
41 @project.add_access(@user, :read) 41 @project.add_access(@user, :read)
42 42
43 - visit tree_project_path(@project, :branch => "master") 43 + visit tree_project_ref_path(@project, @project.root_ref)
44 end 44 end
45 45
46 it "should be correct path" do 46 it "should be correct path" do
47 - current_path.should == tree_project_path(@project) 47 + current_path.should == tree_project_ref_path(@project, @project.root_ref)
48 end 48 end
49 49
50 it_behaves_like :tree_view 50 it_behaves_like :tree_view
@@ -57,11 +57,11 @@ describe &quot;Projects&quot; do @@ -57,11 +57,11 @@ describe &quot;Projects&quot; do
57 @project = Factory :project 57 @project = Factory :project
58 @project.add_access(@user, :read) 58 @project.add_access(@user, :read)
59 59
60 - visit tree_project_path(@project, :path => ".rvmrc") 60 + visit tree_project_ref_path(@project, @project.root_ref, :path => ".rvmrc")
61 end 61 end
62 62
63 it "should be correct path" do 63 it "should be correct path" do
64 - current_path.should == tree_project_path(@project) 64 + current_path.should == tree_project_ref_path(@project, @project.root_ref)
65 end 65 end
66 66
67 it "should contain file view" do 67 it "should contain file view" do
@@ -76,13 +76,11 @@ describe &quot;Projects&quot; do @@ -76,13 +76,11 @@ describe &quot;Projects&quot; do
76 @project = Factory :project 76 @project = Factory :project
77 @project.add_access(@user, :read) 77 @project.add_access(@user, :read)
78 78
79 - visit blob_project_path(@project,  
80 - :path => ValidCommit::BLOB_FILE_PATH,  
81 - :commit_id => ValidCommit::ID) 79 + visit blob_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH)
82 end 80 end
83 81
84 it "should be correct path" do 82 it "should be correct path" do
85 - current_path.should == blob_project_path(@project) 83 + current_path.should == blob_project_ref_path(@project, ValidCommit::ID)
86 end 84 end
87 85
88 it "raw file response" do 86 it "raw file response" do