spec/support/suspenders.rb in welaika-suspenders-2.25.0 vs spec/support/suspenders.rb in welaika-suspenders-2.26.0
- old
+ new
@@ -15,10 +15,16 @@
Bundler.with_clean_env do
add_fakes_to_path
`
#{suspenders_bin} #{APP_NAME} #{arguments}
`
+ Dir.chdir(APP_NAME) do
+ with_env("HOME", tmp_path) do
+ `git add .`
+ `git commit -m 'Initial commit'`
+ end
+ end
end
end
end
def suspenders_help_command
@@ -77,7 +83,17 @@
File.join(root_path, "spec", "fakes", "bin")
end
def root_path
File.expand_path('../../../', __FILE__)
+ end
+
+ def with_env(name, new_value)
+ prior = ENV[name]
+ ENV[name] = new_value.to_s
+
+ yield
+
+ ensure
+ ENV[name] = prior
end
end