Sha256: 415b97d621c7d2c6f3c4c6a884bf9bb8d83aa6446edb9e1880f8735b3957be5c

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

require "helper"

class TestOptions < Test::Unit::TestCase
  def setup_options(*arguments)
    @options = RawQ::Generator::Options.new(["application_name"] + arguments)
  end

  context "default options" do
    setup do
      setup_options
    end

    should "have application name" do
      assert_equal "application_name", @options[:application_name]
    end

    should "not have invalid_option" do
      assert !@options[:invalid_option]
    end
  end

  context "-h" do
    should "show help" do
      setup_options "-h"
      assert @options[:show_help]
    end
  end

  context "--help" do
    should "show help" do
      setup_options "--help"
      assert @options[:show_help]
    end
  end

  context "--music-dir" do
    should "set music_dir" do
      setup_options "--music-dir", "/home/craig/Music"
      assert_equal "/home/craig/Music", @options[:music_dir]
    end
  end

  context "--username" do
    should "set username" do
      setup_options "--username", "username"
      assert_equal "username", @options[:username]
    end
  end

  context "--not-option" do
    should "store invalid_option if incorrect argument" do
      setup_options "--not-option"
      assert @options[:invalid_option]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rawq-0.1.0 test/rawq/generator/test_options.rb