summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Carey-Smith <tim@spork.in>2009-07-23 22:07:58 +1200
committerCarl Lerche <carllerche@mac.com>2009-07-23 16:39:07 -0700
commit95535f3d57fa8c4ff5f468e9f0e04b970cfae4e1 (patch)
treeb191f85d66fb42bd4e657d1525b4ba84f846a935
parent365f05cffd34eb36577fc4d7398176a5b064184e (diff)
downloadbundler-95535f3d57fa8c4ff5f468e9f0e04b970cfae4e1.tar.gz
Remove the tmp_dir before each spec run to avoid inconsistent runs
-rw-r--r--spec/bundler/cli_spec.rb12
-rw-r--r--spec/bundler/dsl_spec.rb13
-rw-r--r--spec/bundler/finder_spec.rb2
-rw-r--r--spec/bundler/installer_spec.rb7
-rw-r--r--spec/bundler/manifest_file_spec.rb3
-rw-r--r--spec/bundler/manifest_spec.rb10
-rw-r--r--spec/spec_helper.rb11
7 files changed, 17 insertions, 41 deletions
diff --git a/spec/bundler/cli_spec.rb b/spec/bundler/cli_spec.rb
index 8829a9f405..963042605e 100644
--- a/spec/bundler/cli_spec.rb
+++ b/spec/bundler/cli_spec.rb
@@ -2,9 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "Bundler::CLI" do
describe "it working" do
- before(:all) do
- reset!
-
+ before(:each) do
build_manifest <<-Gemfile
sources.clear
source "file://#{gem_repo1}"
@@ -64,9 +62,7 @@ describe "Bundler::CLI" do
end
describe "it working without rubygems" do
- before(:all) do
- reset!
-
+ before(:each) do
build_manifest <<-Gemfile
sources.clear
source "file://#{gem_repo1}"
@@ -102,9 +98,7 @@ describe "Bundler::CLI" do
end
describe "it working with requiring rubygems automatically" do
- before(:all) do
- reset!
-
+ before(:each) do
build_manifest <<-Gemfile
sources.clear
source "file://#{gem_repo1}"
diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb
index cc9989e8df..fe9fa847b7 100644
--- a/spec/bundler/dsl_spec.rb
+++ b/spec/bundler/dsl_spec.rb
@@ -2,10 +2,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "Bundling DSL" do
- before(:all) do
- reset!
- end
-
it "allows specifying the path to bundle gems to" do
build_manifest.gem_path.should == tmp_file("vendor", "gems")
end
@@ -60,13 +56,10 @@ describe "Bundling DSL" do
end
it "loads the manifest from a file" do
- File.open(tmp_file("manifest.rb"), 'w') do |file|
- file.puts <<-DSL
- gem "rails"
- DSL
- end
+ manifest = build_manifest(tmp_file("manifest.rb"), <<-DSL)
+ gem "rails"
+ DSL
- manifest = Bundler::ManifestFile.load(tmp_file("manifest.rb"))
manifest.dependencies.first.name.should == "rails"
end
diff --git a/spec/bundler/finder_spec.rb b/spec/bundler/finder_spec.rb
index f8e94dff45..d95e8d1ebe 100644
--- a/spec/bundler/finder_spec.rb
+++ b/spec/bundler/finder_spec.rb
@@ -1,7 +1,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "Finder" do
- before(:all) do
+ before(:each) do
index = build_index do
add_spec "activemerchant", "1.4.1" do
runtime "activesupport", ">= 1.4.1"
diff --git a/spec/bundler/installer_spec.rb b/spec/bundler/installer_spec.rb
index b3b6a57f25..ab51a28516 100644
--- a/spec/bundler/installer_spec.rb
+++ b/spec/bundler/installer_spec.rb
@@ -2,13 +2,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "Bundler::Installer" do
- before(:all) do
+ before(:each) do
@finder = Bundler::Finder.new("file://#{gem_repo1}", "file://#{gem_repo2}")
end
describe "without native gems" do
- before(:all) do
- FileUtils.rm_rf(tmp_dir)
+ before(:each) do
@bundle = @finder.resolve(build_dep('rails', '>= 0'))
@bundle.download(tmp_dir)
end
@@ -65,7 +64,7 @@ describe "Bundler::Installer" do
describe "after installing gems" do
- before(:all) do
+ before(:each) do
@environment = Bundler::Installer.install(tmp_dir)
end
diff --git a/spec/bundler/manifest_file_spec.rb b/spec/bundler/manifest_file_spec.rb
index e7257d99cf..0c3c3c953f 100644
--- a/spec/bundler/manifest_file_spec.rb
+++ b/spec/bundler/manifest_file_spec.rb
@@ -1,9 +1,6 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "Bundler::Manifest" do
- before(:each) do
- reset!
- end
it "finds the default manifest file" do
build_manifest_file
diff --git a/spec/bundler/manifest_spec.rb b/spec/bundler/manifest_spec.rb
index edf479cbf5..141b11e59d 100644
--- a/spec/bundler/manifest_spec.rb
+++ b/spec/bundler/manifest_spec.rb
@@ -6,7 +6,7 @@ describe "Bundler::Manifest" do
Bundler::Dependency.new(name, {:version => version}.merge(options))
end
- before(:all) do
+ before(:each) do
@sources = %W(file://#{gem_repo1} file://#{gem_repo2})
@deps = []
@deps << dep("rails", "2.3.2")
@@ -16,7 +16,6 @@ describe "Bundler::Manifest" do
describe "Manifest with dependencies" do
before(:each) do
- reset!
@manifest = build_manifest <<-Gemfile
sources.clear
source "file://#{gem_repo1}"
@@ -141,10 +140,6 @@ describe "Bundler::Manifest" do
end
describe "runtime" do
- before(:each) do
- FileUtils.rm_rf(tmp_dir)
- FileUtils.mkdir_p(tmp_dir)
- end
it "makes gems available via Manifest#activate" do
m = build_manifest <<-Gemfile
@@ -182,8 +177,7 @@ describe "Bundler::Manifest" do
end
describe "environments" do
- before(:all) do
- reset!
+ before(:each) do
@manifest = build_manifest <<-Gemfile
sources.clear
source "file://#{gem_repo1}"
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 79cfd9b61c..547d4cc14c 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -68,13 +68,13 @@ module Spec
FileUtils.mkdir_p(path.dirname)
Dir.chdir(path.dirname) do
build_manifest_file(path, str)
- Bundler::ManifestFile.load
+ Bundler::ManifestFile.load(path)
end
end
def reset!
- FileUtils.rm_rf(tmp_dir)
- FileUtils.mkdir_p(tmp_dir)
+ tmp_dir.rmtree if tmp_dir.exist?
+ tmp_dir.mkdir
end
end
end
@@ -86,14 +86,13 @@ Spec::Runner.configure do |config|
original_wd = Dir.pwd
- config.before(:all) do
+ config.before(:each) do
@log_output = StringIO.new
Bundler.logger.instance_variable_set("@logdev", Logger::LogDevice.new(@log_output))
+ reset!
end
config.after(:each) do
- @log_output.rewind
- @log_output.string.replace ""
Dir.chdir(original_wd)
end
end