Sha256: cbcf11a5a5cf5b90c9280efc635b30a35f05388dea1857588f95963c9605be6e
Contents?: true
Size: 794 Bytes
Versions: 2
Compression:
Stored size: 794 Bytes
Contents
require 'spec_helper' describe String do it "should change a single # to a number 0-9" do expect(0..9).to 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| expect(0..9).to 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] == "#" expect('0'..'9').to include(n[i, 1]) else expect('0'..'9').not_to include(n[i, 1]) end end end it "should allow the replacing of a different character" do expect(0..9).to include(Integer(Forgery::Extend("-").to_numbers("-"))) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
forgery-0.8.1 | spec/extensions/string_spec.rb |
forgery-0.7.0 | spec/extensions/string_spec.rb |