Sha256: 7ac50a2222e8c284127400f7dd45657191c254e0d73c0c7930f3b17035e24fbf
Contents?: true
Size: 1.1 KB
Versions: 2
Compression:
Stored size: 1.1 KB
Contents
require File.dirname(__FILE__) + '/../spec_helper.rb' require 'reek/options' include Reek describe Options, ' when given no arguments' do it "should retain the default sort order" do default_order = Options[:sort_order] Options.parse ['nosuchfile.rb'] Options[:sort_order].should == default_order end end describe Options, ' when --sort_order is specified' do before :each do @default_order = Options[:sort_order] end it 'should require an argument' do lambda { Options.parse_args(['-s']) }.should raise_error(OptionParser::MissingArgument) Options[:sort_order].should == @default_order end it "should allow sort by smell" do Options.parse %w{-s smell xx} Options[:sort_order].should == Report::SORT_ORDERS[:smell] end it "should allow sort by context" do Options.parse %w{-s context xx} Options[:sort_order].should == Report::SORT_ORDERS[:context] end it "should reject illegal sort order" do lambda { Options.parse_args(%w{-s tarts}) }.should raise_error(OptionParser::InvalidArgument) Options[:sort_order].should == @default_order end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
reek-0.3.0 | spec/reek/options_spec.rb |
reek-0.3.1 | spec/reek/options_spec.rb |