aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-06-19 17:51:24 -0700
committerelijah <elijah@riseup.net>2013-06-19 17:51:24 -0700
commit23aa42d957294b025a367c543cd99f137c48e289 (patch)
treedba6247f616c72cf9b737d7a47b837498449b685 /test
parent5675bd54cf7dc11a234bb305c64c801c4eeaea62 (diff)
downloadleap_cli-23aa42d957294b025a367c543cd99f137c48e289.tar.gz
leap_cli-23aa42d957294b025a367c543cd99f137c48e289.tar.bz2
fixed utf8 bug when locale not set, and improved testing for ruby 1.8.
Diffstat (limited to 'test')
-rw-r--r--test/test_helper.rb13
-rw-r--r--test/unit/command_line_test.rb12
2 files changed, 19 insertions, 6 deletions
diff --git a/test/test_helper.rb b/test/test_helper.rb
index c813ead..45deec9 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -31,7 +31,7 @@ class MiniTest::Unit::TestCase
end
def leap_bin(*args)
- `#{ruby_path} #{base_path}/bin/leap #{args.join ' '}`
+ `cd #{test_provider_path} && #{ruby_path} #{base_path}/bin/leap #{args.join ' '}`
end
#def test_platform_path
@@ -43,9 +43,14 @@ class MiniTest::Unit::TestCase
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?
+ if ENV["RUBY"]
+ ENV["RUBY"].split(',').each do |ruby|
+ self.ruby_path = `which #{ruby}`.strip
+ next unless ruby_path.chars.any?
+ yield
+ end
+ else
+ self.ruby_path = `which ruby`.strip
yield
end
self.ruby_path = ""
diff --git a/test/unit/command_line_test.rb b/test/unit/command_line_test.rb
index 3493600..4f8333a 100644
--- a/test/unit/command_line_test.rb
+++ b/test/unit/command_line_test.rb
@@ -3,10 +3,18 @@ require File.expand_path('../test_helper', __FILE__)
class CommandLineTest < MiniTest::Unit::TestCase
def test_help
- #with_multiple_rubies do
+ with_multiple_rubies do
output = leap_bin('help')
assert_equal 0, $?, "help should exit 0 -- #{output}"
- #end
+ end
+ end
+
+ def test_list
+ with_multiple_rubies do
+ output = leap_bin('list')
+ assert_equal 0, $?, "list should exit 0"
+ assert output =~ /ns1 dns/m
+ end
end
end