Sha256: 7115abbe1af75e009c11aacc96bf404255b9cc8ac0ec956c49daf3735acf2ebf
Contents?: true
Size: 784 Bytes
Versions: 1
Compression:
Stored size: 784 Bytes
Contents
require 'spec_helper' describe String do it "should change a single # to a number 0-9" do (0..9).should include(Integer(Forgery::Extend("#").to_numbers)) end it "should change two #'s to two numbers 0-9" do Forgery::Extend("##").to_numbers.split("").each do |s| (0..9).should include(Integer(s)) end end it "should only replace #'s in the string with numbers 0-9" do s = Forgery::Extend('###-###-####') n = s.to_numbers 0.upto(s.size - 1) do |i| if s[i, 1] == "#" ('0'..'9').should include(n[i, 1]) else ('0'..'9').should_not include(n[i, 1]) end end end it "should allow the replacing of a different character" do (0..9).should include(Integer(Forgery::Extend("-").to_numbers("-"))) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
forgery-0.6.0 | spec/extensions/string_spec.rb |