Sha256: 894fb898e3d6324991c643d20a497c6639533e34864652c79e891fd2dabe928a

Contents?: true

Size: 762 Bytes

Versions: 7

Compression:

Stored size: 762 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe "Trocla::Util" do

  { :random_str => 12, :salt => 8 }.each do |m,length|
    describe m do
      it "should be random" do
        Trocla::Util.send(m).should_not eql(Trocla::Util.send(m))
      end
    
      it "should default to length #{length}" do
        Trocla::Util.send(m).length.should == length
      end
    
      it "should be possible to change length" do
        Trocla::Util.send(m,8).length.should == 8
        Trocla::Util.send(m,32).length.should == 32
        Trocla::Util.send(m,1).length.should == 1
      end
    end
  end

  describe :salt do
    it "should only contain characters and numbers" do
      Trocla::Util.salt =~ /^[a-z0-9]+$/i
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
trocla-0.1.0 spec/trocla/util_spec.rb
trocla-0.0.12 spec/trocla/util_spec.rb
trocla-0.0.11 spec/trocla/util_spec.rb
trocla-0.0.10 spec/trocla/util_spec.rb
trocla-0.0.9 spec/trocla/util_spec.rb
trocla-0.0.8 spec/trocla/util_spec.rb
trocla-0.0.7 spec/trocla/util_spec.rb