OSDN Git Service

tests seed
authorgitlabhq <m@gitlabhq.com>
Sun, 9 Oct 2011 19:55:06 +0000 (22:55 +0300)
committergitlabhq <m@gitlabhq.com>
Sun, 9 Oct 2011 19:55:06 +0000 (22:55 +0300)
db/fixtures/test/001_repo.rb
spec/models/project_spec.rb
spec/monkeypatch.rb

index 034596f..3eb4c29 100644 (file)
@@ -1,8 +1,11 @@
-# Clone  repo
-`cp spec/seed_project.tar.gz /tmp/`
-Dir.chdir("/tmp")
+# Create dir for test repo
+repo_dir = File.join(Rails.root, "tmp", "tests")
+Dir.mkdir(repo_dir) unless File.exists?(repo_dir)
+
+`cp spec/seed_project.tar.gz tmp/tests/`
+Dir.chdir(repo_dir)
 `tar -xf seed_project.tar.gz`
 3.times do |i|
-`cp -r /tmp/legit/ /tmp/legit_#{i}/`
-puts "Unpacked seed repo - /tmp/legit_#{i}"
+`cp -r legit/ legit_#{i}/`
+puts "Unpacked seed repo - tmp/tests/legit_#{i}"
 end
index 14727d1..6ed8653 100644 (file)
@@ -38,7 +38,7 @@ describe Project do
 
   it "should return path to repo" do 
     project = Project.new(:path => "somewhere")
-    project.path_to_repo.should == "/tmp/somewhere"
+    project.path_to_repo.should == File.join(Rails.root, "tmp", "tests", "somewhere")
   end
 
   describe :valid_repo? do 
index e630cc1..ea42337 100644 (file)
@@ -10,7 +10,7 @@ class Project
   end
 
   def path_to_repo 
-      "/tmp/" + path
+    File.join(Rails.root, "tmp", "tests", path)
   end
 end