39 lines
965 B
Ruby
39 lines
965 B
Ruby
require 'db/mongo/models/report'
|
|
|
|
RSpec.describe Devops::Model::Report, type: :model do
|
|
let(:report) { build(:report) }
|
|
|
|
describe '#initialize' do
|
|
let(:given_moment) { Time.new(2007,11,1,15,25,0, "+01:00") }
|
|
|
|
it 'converts created_at to localtime' do
|
|
converted = build(:report, created_at: given_moment).created_at
|
|
expect(converted).to eq given_moment.localtime
|
|
end
|
|
|
|
it 'converts updated_at to localtime' do
|
|
converted = build(:report, updated_at: given_moment).updated_at
|
|
expect(converted).to eq given_moment.localtime
|
|
end
|
|
end
|
|
|
|
describe '#to_hash_without_id' do
|
|
it 'contains several fields' do
|
|
expect(report.to_hash_without_id.keys).to match_array(%w(
|
|
file
|
|
created_at
|
|
updated_at
|
|
created_by
|
|
project
|
|
deploy_env
|
|
type
|
|
chef_node_name
|
|
host
|
|
status
|
|
stack
|
|
subreports
|
|
job_result_code
|
|
))
|
|
end
|
|
end
|
|
end |