diff options
| -rw-r--r-- | Rakefile | 6 | ||||
| -rw-r--r-- | leap_cli.gemspec | 1 | ||||
| -rw-r--r-- | lib/leap_cli/version.rb | 2 | ||||
| -rw-r--r-- | test/test_helper.rb | 20 | ||||
| -rw-r--r-- | test/unit/config_object_list_test.rb | 20 | ||||
| -rw-r--r-- | test/unit/config_object_test.rb | 10 | ||||
| -rw-r--r-- | test/unit/test_helper.rb | 1 | 
7 files changed, 53 insertions, 7 deletions
| @@ -2,6 +2,7 @@ require "rubygems"  require "highline/import"  require "pty"  require "fileutils" +require 'rake/testtask'  ##  ## HELPER @@ -62,7 +63,10 @@ end  ## TESTING  ## -# task :default => [:test,:features] +Rake::TestTask.new do |t| +  t.pattern = "test/unit/*_test.rb" +end +task :default => :test  ##  ## DOCUMENTATION diff --git a/leap_cli.gemspec b/leap_cli.gemspec index 20e50a8..f51636a 100644 --- a/leap_cli.gemspec +++ b/leap_cli.gemspec @@ -40,6 +40,7 @@ spec = Gem::Specification.new do |s|    ## DEPENDENCIES    ##    s.add_development_dependency('rake') +  s.add_development_dependency('minitest')    #s.add_development_dependency('rdoc')    #s.add_development_dependency('aruba') diff --git a/lib/leap_cli/version.rb b/lib/leap_cli/version.rb index 437d861..0f69f04 100644 --- a/lib/leap_cli/version.rb +++ b/lib/leap_cli/version.rb @@ -1,6 +1,6 @@  module LeapCli    unless defined?(LeapCli::VERSION) -    VERSION = '0.1.0' +    VERSION = '0.1.1'      SUMMARY = 'Command line interface to the LEAP platform'      DESCRIPTION = 'The command "leap" can be used to manage a bevy of servers running the LEAP platform from the comfort of your own home.'    end diff --git a/test/test_helper.rb b/test/test_helper.rb index 2e33705..e761086 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,9 +1,19 @@ -require 'test/unit' +$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib') +require 'rubygems' +require 'minitest/autorun' +require 'leap_cli' -# Add test libraries you want to use here, e.g. mocha - -class Test::Unit::TestCase +class MiniTest::Unit::TestCase    # Add global extensions to the test case class here -   + +  def manager +    @manager ||= begin +      LeapCli::Path.set_root(File.dirname(__FILE__)) +      manager = LeapCli::Config::Manager.new +      manager.load +      manager +    end +  end +  end diff --git a/test/unit/config_object_list_test.rb b/test/unit/config_object_list_test.rb new file mode 100644 index 0000000..a0ca9d5 --- /dev/null +++ b/test/unit/config_object_list_test.rb @@ -0,0 +1,20 @@ +require File.dirname(__FILE__) + '/test_helper' + +class TestMeme < MiniTest::Unit::TestCase + +  def test_node_search +    nodes = manager.nodes['name' => 'vpn1'] +    assert_equal 1, nodes.size +    assert_equal 'vpn1', nodes.values.first.name +  end + +  def test_complex_node_search +    nodes = manager.nodes['dns.public' => true] +    expected = [{"domain_full"=>"ns1.rewire.co"}, {"domain_full"=>"ns2.rewire.co"}, {"domain_full"=>"vpn1.rewire.co"}, {"domain_full"=>"web1.rewire.co"}] +    assert_equal expected.size, nodes.size +    assert_equal expected, nodes.fields('domain.full') +  end + + + +end diff --git a/test/unit/config_object_test.rb b/test/unit/config_object_test.rb new file mode 100644 index 0000000..2cd6dff --- /dev/null +++ b/test/unit/config_object_test.rb @@ -0,0 +1,10 @@ +require File.expand_path('test_helper', File.dirname(__FILE__)) + +class TestMeme < MiniTest::Unit::TestCase + +  def test_bracket_lookup +    vpn1 = manager.nodes['vpn1'] +    assert_equal 'vpn1.rewire.co', vpn1['domain.full'] +  end + +end diff --git a/test/unit/test_helper.rb b/test/unit/test_helper.rb new file mode 100644 index 0000000..ade21a0 --- /dev/null +++ b/test/unit/test_helper.rb @@ -0,0 +1 @@ +require File.dirname(File.dirname(__FILE__)) + '/test_helper'
\ No newline at end of file | 
