Sha256: b07fef92b4ee8b2c4f44a038916438c8375bcc37eccfe5145f9b5fdbf626b304

Contents?: true

Size: 1.03 KB

Versions: 25

Compression:

Stored size: 1.03 KB

Contents

require "spec_helper"

module RSpec::Core
  describe OptionParser do
    before do
      RSpec.stub(:deprecate)
    end

    let(:output_file){ mock File }

    it "deprecates the --formatter option" do
      RSpec.should_receive(:deprecate)
      Parser.parse!(%w[--formatter doc])
    end

    it "converts --formatter to --format" do
      options = Parser.parse!(%w[--formatter doc])
      options.should eq( {:formatter=>"doc"} )
    end

    it "does not parse empty args" do
      parser = Parser.new
      OptionParser.should_not_receive(:new)
      parser.parse!([])
    end

    it "parses output stream from --out" do
      File.should_receive(:open).with("foo.txt",'w').and_return(output_file)
      options = Parser.parse!(%w[--out foo.txt])
      options.should eq( {:output_stream=>output_file} )
    end

    it "parses output stream from -o" do
      File.should_receive(:open).with("foo.txt",'w').and_return(output_file)
      options = Parser.parse!(%w[-o foo.txt])
      options.should eq( {:output_stream=>output_file} )
    end
  end
end

Version data entries

25 entries across 25 versions & 3 rubygems

Version Path
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/rspec-core-2.1.0/spec/rspec/core/option_parser_spec.rb
vim-jar-0.1.2 bundler/ruby/1.8/gems/rspec-core-2.1.0/spec/rspec/core/option_parser_spec.rb
vim-jar-0.1.1 bundler/ruby/1.8/gems/rspec-core-2.1.0/spec/rspec/core/option_parser_spec.rb
vim-jar-0.1.0 bundler/ruby/1.8/gems/rspec-core-2.1.0/spec/rspec/core/option_parser_spec.rb
rspec-core-2.3.1 spec/rspec/core/option_parser_spec.rb
rspec-core-2.3.0 spec/rspec/core/option_parser_spec.rb
vim-jar-0.0.3 bundler/ruby/1.8/gems/rspec-core-2.1.0/spec/rspec/core/option_parser_spec.rb
rspec-core-2.2.1 spec/rspec/core/option_parser_spec.rb
vim-jar-0.0.2 bundler/ruby/1.8/gems/rspec-core-2.1.0/spec/rspec/core/option_parser_spec.rb
vim-jar-0.0.1 bundler/ruby/1.8/gems/rspec-core-2.1.0/spec/rspec/core/option_parser_spec.rb
rspec-core-2.2.0 spec/rspec/core/option_parser_spec.rb
rspec-core-2.1.0 spec/rspec/core/option_parser_spec.rb
rspec-core-2.0.1 spec/rspec/core/option_parser_spec.rb
gemrage-1.0.0 vendor/ruby/1.8/gems/rspec-core-2.0.0/spec/rspec/core/option_parser_spec.rb
gemrage-0.4.1 vendor/ruby/1.8/gems/rspec-core-2.0.0/spec/rspec/core/option_parser_spec.rb
gemrage-0.4.0 vendor/ruby/1.8/gems/rspec-core-2.0.0/spec/rspec/core/option_parser_spec.rb
gemrage-0.3.2 vendor/ruby/1.8/gems/rspec-core-2.0.0/spec/rspec/core/option_parser_spec.rb
gemrage-0.3.1 vendor/ruby/1.8/gems/rspec-core-2.0.0/spec/rspec/core/option_parser_spec.rb
gemrage-0.3.0 vendor/ruby/1.8/gems/rspec-core-2.0.0/spec/rspec/core/option_parser_spec.rb
gemrage-0.2.0 vendor/ruby/1.8/gems/rspec-core-2.0.0/spec/rspec/core/option_parser_spec.rb