Sha256: af294e239da20530b36aa8b33df988717fbec420e63c5b47c5a4777958c209ae
Contents?: true
Size: 1.48 KB
Versions: 2
Compression:
Stored size: 1.48 KB
Contents
require 'epitools/minimal' require 'epitools/clitools' describe Object do # it "'highlight's" do # color = :light_yellow # highlighted = "xxx#{"match".send(color)}zzz" # "xxxmatchzzz".highlight(/match/, color).should == highlighted # "xxxmatchzzz".highlight("match", color).should == highlighted # "xxxmatchzzz".highlight(/m.+h/, color).should == highlighted # "xxxmatchzzz".highlight(/MATCH/i, color).should == highlighted # end # it "'highlight's with a block" do # result = "xxxmatchxxx".highlight(/match/) { |match| "<8>#{match}</8>" } # result.should == "xxx<8>match</8>xxx" # end it "'cmd's" do cmd( ['test -f ?', __FILE__] ).should == true cmd( ['test -d ?', __FILE__] ).should == false cmd( "test", "-f", __FILE__ ).should == true cmd( "test", "-d", __FILE__ ).should == false -> { cmd( ["test -f ? ?", __FILE__] ) }.should raise_error(TypeError) # more ?'s than args -> { cmd( ["test -f", __FILE__] ) }.should raise_error(RuntimeError) # more args than ?'s end it "'which'es" do which("totally nonexistant", "probably nonexistant", "ls", "df").should_not == nil which("totally nonexistant", "probably nonexistant").should == nil which("ls", "df").should =~ /\/ls$/ end it "'geoip's" do geoip("128.100.100.128").country_name.should == "Canada" -> { geoip("butt"*20) }.should raise_error(SocketError) $geoip = nil -> { geoip("8.8.4.4", nil, nil) }.should raise_error(RuntimeError) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
epitools-0.5.100 | spec/clitools_spec.rb |
epitools-0.5.99 | spec/clitools_spec.rb |