Sha256: cf879121312d52803a25649c6669c4d289d1676ee0a267b0b92d0cfe2a541aa1
Contents?: true
Size: 1.62 KB
Versions: 2
Compression:
Stored size: 1.62 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' Language.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' Language.should_receive(:list_keywords_and_exit).with(@output_stream, "pt") end end it "exits the program" do when_parsing('--language help') { Kernel.should_receive(:exit) } end end end context '--help' do it "should parse the option" do when_parsing('--help') do options.should_receive(:print_and_exit) end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rspec-i18n-1.2.1 | spec/spec-i18n/command_line/options_spec.rb |
rspec-i18n-1.2.0 | spec/spec-i18n/command_line/options_spec.rb |