From cb353d655bd8802c14a1e12e0fe78a1f7cc2e4ed Mon Sep 17 00:00:00 2001 From: James Lopez Date: Fri, 18 Nov 2016 12:05:29 +0100 Subject: added new build updater, specs and refactored allowed_ids --- spec/lib/gitlab/cycle_analytics/author_updater_spec.rb | 12 ++++++++++++ spec/lib/gitlab/cycle_analytics/build_updater_spec.rb | 12 ++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 spec/lib/gitlab/cycle_analytics/author_updater_spec.rb create mode 100644 spec/lib/gitlab/cycle_analytics/build_updater_spec.rb (limited to 'spec/lib/gitlab/cycle_analytics') diff --git a/spec/lib/gitlab/cycle_analytics/author_updater_spec.rb b/spec/lib/gitlab/cycle_analytics/author_updater_spec.rb new file mode 100644 index 00000000000..f9e4d1714e6 --- /dev/null +++ b/spec/lib/gitlab/cycle_analytics/author_updater_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe Gitlab::CycleAnalytics::AuthorUpdater do + let(:user) { create(:user) } + let(:events) { [{ 'author_id' => user.id }] } + + it 'maps the correct user' do + described_class.update!(events) + + expect(events.first['author']).to eq(user) + end +end diff --git a/spec/lib/gitlab/cycle_analytics/build_updater_spec.rb b/spec/lib/gitlab/cycle_analytics/build_updater_spec.rb new file mode 100644 index 00000000000..8e461f6c6ea --- /dev/null +++ b/spec/lib/gitlab/cycle_analytics/build_updater_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe Gitlab::CycleAnalytics::BuildUpdater do + let(:build) { create(:ci_build) } + let(:events) { [{ 'id' => build.id }] } + + it 'maps the correct user' do + described_class.update!(events) + + expect(events.first['build']).to eq(build) + end +end -- cgit v1.2.3