fluke/devops-service/spec/models/key_spec.rb

24 lines
607 B
Ruby
Raw Permalink Normal View History

2015-11-03 11:46:54 +03:00
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
2016-01-21 20:46:15 +03:00
describe 'validations', stubbed_logger: true do
2015-11-03 11:46:54 +03:00
it 'key file should exist in file system' do
2018-04-04 22:44:39 +03:00
pending 'bug: missing validator'
2015-11-03 11:46:54 +03:00
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
2018-04-04 22:44:39 +03:00
it '#to_hash returns id and path' do
expect(key.to_hash.keys).to match_array(%w(id path))
2015-11-03 11:46:54 +03:00
end
end