Commit d7ea9052f1ecc5add24ad8b9d0cb06082f28c86f

Authored by gitlabhq
1 parent 035196e7

tests seed

db/fixtures/test/001_repo.rb
1 -# Clone repo  
2 -`cp spec/seed_project.tar.gz /tmp/`  
3 -Dir.chdir("/tmp") 1 +# Create dir for test repo
  2 +repo_dir = File.join(Rails.root, "tmp", "tests")
  3 +Dir.mkdir(repo_dir) unless File.exists?(repo_dir)
  4 +
  5 +`cp spec/seed_project.tar.gz tmp/tests/`
  6 +Dir.chdir(repo_dir)
4 `tar -xf seed_project.tar.gz` 7 `tar -xf seed_project.tar.gz`
5 3.times do |i| 8 3.times do |i|
6 -`cp -r /tmp/legit/ /tmp/legit_#{i}/`  
7 -puts "Unpacked seed repo - /tmp/legit_#{i}" 9 +`cp -r legit/ legit_#{i}/`
  10 +puts "Unpacked seed repo - tmp/tests/legit_#{i}"
8 end 11 end
spec/models/project_spec.rb
@@ -38,7 +38,7 @@ describe Project do @@ -38,7 +38,7 @@ describe Project do
38 38
39 it "should return path to repo" do 39 it "should return path to repo" do
40 project = Project.new(:path => "somewhere") 40 project = Project.new(:path => "somewhere")
41 - project.path_to_repo.should == "/tmp/somewhere" 41 + project.path_to_repo.should == File.join(Rails.root, "tmp", "tests", "somewhere")
42 end 42 end
43 43
44 describe :valid_repo? do 44 describe :valid_repo? do
spec/monkeypatch.rb
@@ -10,7 +10,7 @@ class Project @@ -10,7 +10,7 @@ class Project
10 end 10 end
11 11
12 def path_to_repo 12 def path_to_repo
13 - "/tmp/" + path 13 + File.join(Rails.root, "tmp", "tests", path)
14 end 14 end
15 end 15 end
16 16