lib/assert/factory.rb in assert-2.9.0 vs lib/assert/factory.rb in assert-2.10.0

- old
+ new

@@ -64,10 +64,14 @@ def url(host = nil, length = nil) self.type_cast(Random.url_string(host, length), :string) end + def email(domain = nil, length = nil) + self.type_cast(Random.email_string(domain, length), :string) + end + def binary self.type_cast(Random.binary, :binary) end def boolean @@ -142,9 +146,14 @@ File.join(self.dir_path_string, self.file_name_string) end def self.url_string(host = nil, length = nil) File.join(host.to_s, self.dir_path_string(length)) + end + + def self.email_string(domain = nil, length = nil) + domain ||= "#{self.string(5)}.com" + "#{self.string(length)}@#{domain}" end def self.binary [ self.integer(10000) ].pack('N*') end