Sha256: 6605c4a5395d01a6fcb33f04e9ecaab5ac1604614bcde5a57c14c3d800d050f9

Contents?: true

Size: 644 Bytes

Versions: 2

Compression:

Stored size: 644 Bytes

Contents

require 'epitools/rash'

describe Rash do

  attr_accessor :r
  
  before :each do
    @r = Rash.new(
      /hello/ => "hello",
      /world/ => "world",
      "other" => "whee",
      true    => false,
      1       => "awesome"
      #/.+/ => "EVERYTHING"
    )
  end
  
  it "string lookups" do
    r["other"].should == "whee"
    r["well hello there"].should == ["hello"]
    r["the world is round"].should == ["world"]
    r["hello world"].sort.should == ["hello", "world"]
  end

  it "regex lookups" do
    r[/other/].should == ["whee"]
  end

  it "other objects" do  
    r[true].should == false
    r[1].should == "awesome"
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
epitools-0.5.1 spec/rash_spec.rb
epitools-0.5.0 spec/rash_spec.rb