Sha256: f6d1e9c6564d6c46b267b04fabf3dc94e66d7a4591ac6cf333bbcaa472d8067a

Contents?: true

Size: 1.84 KB

Versions: 2

Compression:

Stored size: 1.84 KB

Contents

require 'spec_helper'

module InfinityTest
  describe Options do
    
    context "when parsing" do
      
      it "should parse --rspec and return rspec" do
        parse_options('--rspec')
        @options[:test_framework].should equal :rspec
      end
      
      it "should not return rspec as test framework when not parse rspec" do
        parse_options('--test-unit')
        @options[:test_framework].should_not equal :rspec
      end
      
      it "should parse --test-unit and return test_unit" do
        parse_options('--test-unit')
        @options[:test_framework].should equal :test_unit
      end
      
      it "should not parse --test-unit" do
        parse_options('--rspec')
        @options[:test_framework].should_not equal :test_unit
      end
      
      it "should parse --rvm-versions and return an array" do
        parse_options('--rubies=1.8.6,1.8.7')
        @options[:rubies].should eql '1.8.6,1.8.7'
      end
      
      it "should parse --rvm-versions with dashes" do
        parse_options('--rubies=1.8.7-p249,1.9.1-p378')
        @options[:rubies].should eql '1.8.7-p249,1.9.1-p378'
      end
      
      it "should parse --verbose" do
        parse_options('--verbose')
        @options[:verbose].should be_true
      end
      
    end

    describe "#rspec?" do

      it "should return true if using rspec" do
        parse_options('--rspec')
        @options.rspec?.should be_true
      end
      
      it "should explicity return false if not using rspec" do
        parse_options('--test-unit')
        @options.rspec?.should be_false
      end
      
      it "should not return nil when not using rspec" do
        parse_options('--rubies=1.8.6')
        @options.rspec?.should_not be_nil
      end
      
    end
    
    def parse_options(*arguments)
      @options = InfinityTest::Options.new(arguments)
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
infinity_test-0.2.0 spec/infinity_test/options_spec.rb
infinity_test-0.1.0 spec/infinity_test/options_spec.rb