Sha256: c347a23d247651763e9c99a9a2b4ea59cbcebe40a94e01b8150c3541cda0c911

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

require File.dirname(__FILE__) + '/../../test_helper'
require 'stringio'

module Spec
  module Runner
    class OptionParserTest < Test::Unit::TestCase

      def test_verbose_should_be_true_by_default
        options = OptionParser.parse([])
        assert(!options.verbose)
      end

      def test_out_should_be_stdout_by_default
        options = OptionParser.parse([])
        assert_equal(STDOUT, options.out)
      end
      
      def test_verbose_should_be_settable_with_v
        options = OptionParser.parse(["-v"])
        assert(options.verbose)
      end
      
      def test_verbose_should_be_settable_with_verbose
        options = OptionParser.parse(["--verbose"])
        assert(options.verbose)
      end
      
      def test_doc_should_be_false_by_default
        options = OptionParser.parse([])
        assert(!options.doc)
      end
      
      def test_doc_should_be_settable_with_d
        options = OptionParser.parse(["-d"])
        assert(options.doc)
      end
      
      def test_out_should_be_settable_with_o
        options = OptionParser.parse(["-o","test.txt"])
        assert_equal("test.txt", options.out)
      end
      
      def test_out_should_be_settable_with_of
        options = OptionParser.parse(["--of","test.txt"])
        assert_equal("test.txt", options.out)
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-0.5.0 test/spec/runner/option_parser_test.rb