require 'db/mongo/models/key' RSpec.describe Devops::Model::Key, type: :model do let(:key) { build(:key) } it 'is valid with correct attrs' do expect(key).to be_valid end describe 'validations', stubbed_logger: true do it 'key file should exist in file system' do pending 'bug: missing validator' expect(build(:key, path: './not_exist')).not_to be_valid end end it '#filename returns base name of key file' do expect(key.filename).to eq('blank_file') end it '#to_hash returns id and path' do expect(key.to_hash.keys).to match_array(%w(id path)) end end