aboutsummaryrefslogtreecommitdiff
path: root/test/test_helper.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2012-12-05 01:02:39 -0800
committerelijah <elijah@riseup.net>2012-12-05 01:02:39 -0800
commit5a5879c51afc128ea723443de26458ebdc645c6a (patch)
tree7e18cd0880526bd550a5e8945ecb683e7fdf1a00 /test/test_helper.rb
parentcc2459bf72db3990d15b83d6a07c184794215777 (diff)
downloadleap_cli-5a5879c51afc128ea723443de26458ebdc645c6a.tar.gz
leap_cli-5a5879c51afc128ea723443de26458ebdc645c6a.tar.bz2
fixed problems with ruby 1.8 and GLI, and added some tests.
Diffstat (limited to 'test/test_helper.rb')
-rw-r--r--test/test_helper.rb32
1 files changed, 31 insertions, 1 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb
index e761086..94bb2b4 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -4,16 +4,46 @@ require 'minitest/autorun'
require 'leap_cli'
class MiniTest::Unit::TestCase
+ attr_accessor :ruby_path
# Add global extensions to the test case class here
+ def setup
+ LeapCli::Path.set_platform_path(test_platform_path)
+ LeapCli::Path.set_provider_path(test_provider_path)
+ end
+
def manager
@manager ||= begin
- LeapCli::Path.set_root(File.dirname(__FILE__))
manager = LeapCli::Config::Manager.new
manager.load
manager
end
end
+ def base_path
+ File.expand_path '../..', __FILE__
+ end
+
+ def leap_bin(*args)
+ `#{ruby_path} #{base_path}/bin/leap #{args.join ' '}`
+ end
+
+ def test_platform_path
+ "#{base_path}/test/leap_platform"
+ end
+
+ def test_provider_path
+ "#{base_path}/test/provider"
+ end
+
+ def with_multiple_rubies(&block)
+ ['ruby1.8', 'ruby1.9.1'].each do |ruby|
+ self.ruby_path = `which #{ruby}`.strip
+ next unless ruby_path.chars.any?
+ yield
+ end
+ self.ruby_path = ""
+ end
+
end