Sha256: 859c6ba6011acd0b3f4d675c91bbc623cf5b626ad8c5d82b97f4ec4a62d4ebcc

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

require 'spec_helper'

module SpecI18n
  module CommandLine
    describe Options do
      describe 'parsing' do
        
        before(:each) do
          @output_stream ||= StringIO.new
          @error_stream ||= StringIO.new
        end
        
        def options 
          @options ||= Options.new(@output_stream, @error_stream)          
        end
        
        def when_parsing(args)
          yield
          options.parse!(args.is_a?(Array) ? args : args.split(' '))
        end
        
        context "--language" do
          context "with LANG especified as help" do
            
            it "should list all know languages" do
              when_parsing "--language help" do
                require 'spec-i18n/command_line/language_help_formatter'
                LanguageHelpFormatter.should_receive(:list_languages_and_exit).with(@output_stream)
              end
            end
            
            it "should list all know keywords for the language" do
              when_parsing "--language pt" do
                require 'spec-i18n/command_line/language_help_formatter'
                LanguageHelpFormatter.should_receive(:list_keywords_and_exit).with("pt")
              end
            end
            
            it "exits the program" do
              when_parsing('--language help') { Kernel.should_receive(:exit) }
            end
            
          end
        end
      end
    
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-i18n-0.2.0 spec/spec-i18n/command_line/options_spec.rb