Sha256: bf4b8e24bf6a78282d274bc3fd50bd93e0288c69afeda1b35168b5ddbbf6cd49

Contents?: true

Size: 1.57 KB

Versions: 28

Compression:

Stored size: 1.57 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


  it "notifies" do
    notify_send("butt", "hello i am a butt\nbuttbuttbutt")
  end

end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
epitools-0.5.136 spec/clitools_spec.rb
epitools-0.5.134 spec/clitools_spec.rb
epitools-0.5.133 spec/clitools_spec.rb
epitools-0.5.131 spec/clitools_spec.rb
epitools-0.5.130 spec/clitools_spec.rb
epitools-0.5.129 spec/clitools_spec.rb
epitools-0.5.128 spec/clitools_spec.rb
epitools-0.5.126 spec/clitools_spec.rb
epitools-0.5.125 spec/clitools_spec.rb
epitools-0.5.124 spec/clitools_spec.rb
epitools-0.5.123 spec/clitools_spec.rb
epitools-0.5.122 spec/clitools_spec.rb
epitools-0.5.121 spec/clitools_spec.rb
epitools-0.5.119 spec/clitools_spec.rb
epitools-0.5.118 spec/clitools_spec.rb
epitools-0.5.116 spec/clitools_spec.rb
epitools-0.5.115 spec/clitools_spec.rb
epitools-0.5.114 spec/clitools_spec.rb
epitools-0.5.113 spec/clitools_spec.rb
epitools-0.5.112 spec/clitools_spec.rb