OSDN Git Service

Clear state in test satellite dir.
authorMarin Jankovski <marin@gitlab.com>
Tue, 12 Nov 2013 14:11:46 +0000 (15:11 +0100)
committerMarin Jankovski <marin@gitlab.com>
Tue, 12 Nov 2013 14:11:46 +0000 (15:11 +0100)
spec/factories.rb
spec/support/test_env.rb

index 624cb0f..3b0e305 100644 (file)
@@ -66,6 +66,7 @@ FactoryGirl.define do
 
     after :create do |project|
       TestEnv.clear_repo_dir(project.namespace, project.path)
+      TestEnv.reset_satellite_dir
       TestEnv.create_repo(project.namespace, project.path)
     end
   end
index 5dbdffe..87dffe1 100644 (file)
@@ -97,6 +97,15 @@ module TestEnv
     FileUtils.rm_rf File.join(testing_path(), "#{name}.wiki.git")
   end
 
+  def reset_satellite_dir
+    setup_stubs
+    FileUtils.cd(seed_satellite_path) do
+      `git reset --hard --quiet`
+      `git clean -fx`
+      `git checkout --quiet origin/master`
+    end
+  end
+
   # Create a repo and it's satellite
   def create_repo(namespace, name)
     setup_stubs