Sha256: 9c0f28343c867fa17e484b261adca2e5bd37cad07a15e418a57e7270d98282a2
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
require_relative 'spec_helper' describe HasUniqueThreeLetterCode do describe "forbidden_codes" do def set(_) described_class.config.forbidden_codes=_ end it "cannot be nil" do expect{set(nil)}.to raise_error(ArgumentError, "config.forbidden_codes must be an array of 3-character strings. For example: `config.forbidden_codes = ['ABC', 'DEF', 'GHI']`") end it "cannot have a 4-character string" do expect{set(['ABCD'])}.to raise_error(ArgumentError, "config.forbidden_codes contains an element that is the wrong length: ABCD") end it "cannot have a 2-character string" do expect{set(['AB'])}.to raise_error(ArgumentError, "config.forbidden_codes contains an element that is the wrong length: AB") end it "cannot have 2 elements with the wrong number of characters" do expect{set(['ABCD', 'EF'])}.to raise_error(ArgumentError, "config.forbidden_codes contains elements that are the wrong length: ABCD, EF") end it "cannot have an element with a non-alpha character" do expect{set(['AB1'])}.to raise_error(ArgumentError, "config.forbidden_codes contains an element with characters other than capital letters: AB1") end it "cannot have an element with a non-alpha character" do expect{set(['AB1', '2CD'])}.to raise_error(ArgumentError, "config.forbidden_codes contains elements with characters other than capital letters: AB1, 2CD") end it "can be an empty array" do expect{set([])}.to_not raise_error end end after(:all) { described_class.config.reset } end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
has_unique_three_letter_code-0.0.1 | spec/configuration_spec.rb |