2020-08-17 17:09:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe RawUsageData do
|
|
|
|
describe 'validations' do
|
|
|
|
it { is_expected.to validate_presence_of(:payload) }
|
|
|
|
it { is_expected.to validate_presence_of(:recorded_at) }
|
|
|
|
|
|
|
|
context 'uniqueness validation' do
|
|
|
|
let!(:existing_record) { create(:raw_usage_data) }
|
|
|
|
|
|
|
|
it { is_expected.to validate_uniqueness_of(:recorded_at) }
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#update_sent_at!' do
|
|
|
|
let(:raw_usage_data) { create(:raw_usage_data) }
|
|
|
|
|
2020-12-15 04:10:00 -05:00
|
|
|
it 'updates sent_at' do
|
|
|
|
raw_usage_data.update_sent_at!
|
2020-08-17 17:09:56 -04:00
|
|
|
|
2020-12-15 04:10:00 -05:00
|
|
|
expect(raw_usage_data.sent_at).not_to be_nil
|
2020-08-17 17:09:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|