debian-mirror-gitlab/spec/lib/gitlab/cycle_analytics/updater_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
703 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::CycleAnalytics::Updater do
2017-08-17 22:00:37 +05:30
describe 'updates authors' do
let(:user) { create(:user) }
let(:events) { [{ 'author_id' => user.id }] }
it 'maps the correct user' do
described_class.update!(events, from: 'author_id', to: 'author', klass: User)
expect(events.first['author']).to eq(user)
end
end
describe 'updates builds' do
let(:build) { create(:ci_build) }
let(:events) { [{ 'id' => build.id }] }
it 'maps the correct build' do
described_class.update!(events, from: 'id', to: 'build', klass: ::Ci::Build)
expect(events.first['build']).to eq(build)
end
end
end