Sha256: 9cffa4c3ca5b7d02486a06c788bd63e2a869108e14cbd248bf87de0ccd7899c3

Contents?: true

Size: 1.86 KB

Versions: 3

Compression:

Stored size: 1.86 KB

Contents

require 'test_helper'

class TestOptions < Test::Unit::TestCase

  def self.should_have_testing_framework(testing_framework)
    should "use #{testing_framework} for testing" do
      assert_equal testing_framework.to_sym, @options[:testing_framework]
    end
  end

  def setup_options(*arguments)
    @options = Jeweler::Generator::Options.new(arguments)
  end

  def self.for_options(*options)
    context options.join(' ') do
      setup { setup_options *options }
      yield
    end
  end

  context "default options" do
    setup { setup_options }
    should_have_testing_framework :shoulda
    should 'not create repository' do
      assert ! @options[:create_repo]
    end
  end

  for_options '--shoulda' do
    should_have_testing_framework :shoulda
  end

  for_options "--bacon" do
    should_have_testing_framework :bacon
  end

  for_options "--testunit" do
    should_have_testing_framework :testunit
  end

  for_options '--minitest' do
    should_have_testing_framework :minitest
  end

  for_options '--rspec' do
    should_have_testing_framework :rspec
  end

  for_options '--micronaut' do
    should_have_testing_framework :micronaut
  end

  for_options '--cucumber' do
    should 'enable cucumber' do
      assert_equal true, @options[:use_cucumber]
    end
  end

  for_options '--create-repo' do
    should 'create repository' do
      assert @options[:create_repo]
    end
  end

  for_options '--summary', 'zomg so awesome' do
    should 'have summary zomg so awesome' do
      assert_equal 'zomg so awesome', @options[:summary]
    end
  end

  for_options '--directory', 'foo' do
    should 'have directory foo' do
      assert_equal 'foo', @options[:directory]
    end
  end

  for_options '--help' do
    should 'show help' do
      assert @options[:show_help]
    end
  end

  for_options '-h' do
    should 'show help' do
      assert @options[:show_help]
    end
  end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
dima-jeweler-0.9.2 test/test_options.rb
technicalpickles-jeweler-0.9.0 test/test_options.rb
technicalpickles-jeweler-0.9.1 test/test_options.rb