Use code with only alphas for unqiue-validation

Because in some ocassions a tournament code with only digits is
generated which would fail this test because shoulda is not able to
convert it to an uppercase version to test for case-sensitivity of the
validation.
This commit is contained in:
Thor77 2018-12-02 13:53:26 +01:00
parent dc17cad154
commit 8f88362264
1 changed files with 4 additions and 1 deletions

View File

@ -10,7 +10,10 @@ RSpec.describe Tournament, type: :model do
describe 'validation' do
it { should validate_presence_of :name }
it { should validate_presence_of :code }
it { should validate_uniqueness_of :code }
it do
tournament = create(:tournament, code: Faker::Dog.name)
expect(tournament).to validate_uniqueness_of :code
end
it { should_not validate_presence_of :description }
it { should_not validate_presence_of :public }
end