Sha256: 1969e7a652a7a83ae93a1b9aa82725458a4aa0c06b02cdb1569f36ef8e933131
Contents?: true
Size: 792 Bytes
Versions: 2
Compression:
Stored size: 792 Bytes
Contents
require "test_helper" class DsaTest < Minitest::Test let(:model) { Class.new { def self.name "User" end include ActiveModel::Model validates_ssh_private_key :key, type: "dsa" attr_accessor :key } } test "accepts dsa key" do record = model.new(key: SSHKey.generate(type: "dsa").private_key) record.valid? assert record.errors[:key].empty? end test "rejects rsa key" do record = model.new(key: SSHKey.generate(type: "rsa").private_key) record.valid? refute record.errors[:key].empty? end test "sets translated error message" do I18n.locale = "pt-BR" record = model.new(key: SSHKey.generate(type: "rsa").private_key) record.valid? assert_includes record.errors[:key], "precisa ser uma chave DSA" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
validators-2.8.1 | test/validators/validates_ssh_private_key/dsa_test.rb |
validators-2.8.0 | test/validators/validates_ssh_private_key/dsa_test.rb |