summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgitlabhq <m@gitlabhq.com>2011-10-09 22:55:06 +0300
committergitlabhq <m@gitlabhq.com>2011-10-09 22:55:06 +0300
commitd7ea9052f1ecc5add24ad8b9d0cb06082f28c86f (patch)
tree30e9575415e2f80a3e97af7d89917ab297530ae3
parent035196e7a8c839ce14e280d0c7230b3ce34076fe (diff)
downloadgitlab-ce-d7ea9052f1ecc5add24ad8b9d0cb06082f28c86f.tar.gz
tests seed
-rw-r--r--db/fixtures/test/001_repo.rb13
-rw-r--r--spec/models/project_spec.rb2
-rw-r--r--spec/monkeypatch.rb2
3 files changed, 10 insertions, 7 deletions
diff --git a/db/fixtures/test/001_repo.rb b/db/fixtures/test/001_repo.rb
index 034596f1cbf..3eb4c299b4a 100644
--- a/db/fixtures/test/001_repo.rb
+++ b/db/fixtures/test/001_repo.rb
@@ -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
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 14727d1de7e..6ed8653d761 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -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
diff --git a/spec/monkeypatch.rb b/spec/monkeypatch.rb
index e630cc10d31..ea42337f931 100644
--- a/spec/monkeypatch.rb
+++ b/spec/monkeypatch.rb
@@ -10,7 +10,7 @@ class Project
end
def path_to_repo
- "/tmp/" + path
+ File.join(Rails.root, "tmp", "tests", path)
end
end