Sha256: 9d1e5b727bce3e5d0bd425fc1853375ef4dcec45c8061bd8c61ed4e52c520006
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
require File.dirname(__FILE__) + '/../helper.rb' class TestOptions < Test::Unit::TestCase def setup @defaults = { :database => :sqlite, :template => :stable, :profile => :complete, } @databases = [ :postgresql, :mysql, :sqlite ] @templates = [ :stable, :edge ] @profiles = [ :complete, :minimal ] end def test_should_set_the_default_options opts = Options.new(%w[ appname ]) @defaults.each { |k,v| assert_equal v, opts[k] } end def test_should_be_able_to_set_options opts = Options.new(%w[ --mysql --edge --minimal myapp ]) assert_equal :mysql, opts[:database] assert_equal :edge, opts[:template] assert_equal :minimal, opts[:profile] assert_equal "myapp", opts[:app_name] end def test_should_merge_options opts = Options.new(%w[ --mysql myapp ]) env_opts = Options.new(%w[ --edge ]) options = opts.merge(env_opts) assert_equal :mysql, options[:database] assert_equal :edge, options[:template] assert_equal :complete, options[:profile] assert_equal "myapp", options[:app_name] end def test_should_detect_invalid_arguments opts = Options.new(%w[ --wrong ]) assert_equal "invalid option: --wrong", opts[:invalid_argument] end def test_should_have_a_version opts = Options.new(%w[ --version myapp]) version_file = File.dirname(__FILE__) + "/../../VERSION" version = File.read(version_file).strip assert_equal version, opts[:version] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ubiquo-0.1.4 | test/ubiquo/options_test.rb |
ubiquo-0.1.3 | test/ubiquo/options_test.rb |