tests/spec/gem_manager.rb in ruby-station-0.1.3 vs tests/spec/gem_manager.rb in ruby-station-0.1.4.rc1
- old
+ new
@@ -1,27 +1,39 @@
-require "#{File.dirname(__FILE__)}/../test_helper.rb"
+require 'ramaze'
+require __DIR__("../test_helper.rb")
+require TESTS_DIR/"../config.rb"
require TESTS_DIR/"../util/gem_manager.rb"
-# helpers
+def data_dir_of(name, version)
+ File.expand_path("#{name}-#{version}", TESTS_DIR/"tmp/data/")
+end
describe GemManager do
it "should install a gem via file" do
- path = TESTS_DIR/"data/hello/pkg/hello-0.2.0.gem"
- result, name, version = GemManager.install_file(path)
+ result, name, version = GemManager.install_file(hello_gem_path("0.3.2"))
result.should be_instance_of(String)
- name.should == "hello"
- version.should == "0.2.0"
+ name.should == "hello-ruby-station"
+ version.should == "0.3.2"
- GemManager.installed?("hello", "0.2.0").should be_true
+ GemManager.installed?("hello-ruby-station", "0.3.2").should be_true
+ File.exist?(data_dir_of("hello-ruby-station", "0.3.2")).should be_true
end
it "should install a gem via network" do
- pending
+ result, name, version = GemManager.install_gem("hello-ruby-station")
+
+ result.should be_instance_of(String)
+ name.should == "hello-ruby-station"
+ version.should == "0.3.0"
+
+ GemManager.installed?("hello-ruby-station", "0.3.0").should be_true
+ File.exist?(data_dir_of("hello-ruby-station", "0.3.2")).should be_true
end
it "should uninstall a gem" do
- GemManager.uninstall("hello", "0.2.0")
+ GemManager.uninstall("hello-ruby-station", "0.3.2")
- GemManager.installed?("hello", "0.2.0").should be_false
+ GemManager.installed?("hello-ruby-station", "0.3.2").should be_false
+ File.exist?(data_dir_of("hello-ruby-station", "0.3.2")).should be_false
end
end