Sha256: dea7496f7aa0bb6cdcd27daffa0093089cf279b7a97b8b9afa1e5c427484cfc9
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
require_relative "../test_helper" require "stig" require "stig/generators/string" include Stig setup { Stig::Generators::String } test "defaults to all ASCII characters with maximum length 25" do |mod| set = Stig::Generators::Character::ASCII property(mod) do |string| assert string.chars.all? { |char| set.include? char } true end property(mod) do |string| assert string.size.between?(0, 25) true end end test "takes character sets" do |mod| generator = generator_for(mod, ["a"]) property(generator) do |string| assert_equal string.class, String true end property(generator) do |string| assert [["a"], []].include?(string.chars.uniq) true end end test "doesn't take an empty character set" do |mod| assert_raise(ArgumentError) { mod.random([]) } end test "takes a maximum length" do |mod| generator = generator_for(mod, ["a"], 10) property(generator) do |string| assert string.size.between?(0, 10) true end end test "takes a range as length" do |mod| generator = generator_for(mod, ["a"], 5..10) property(generator) do |string| assert string.size.between?(5, 10) true end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stig-0.1.0 | test/stig/string_generator.rb |