fluke/devops-service/spec/models/key_spec.rb
Tim Lianov 03dc3d8d99 v3
2018-04-04 22:44:39 +03:00

24 lines
607 B
Ruby

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