diff options
author | James Lopez <james@jameslopez.es> | 2016-11-18 13:00:38 +0100 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-11-18 13:00:38 +0100 |
commit | f5b792e22eb7bd4ecafcd2ad3bc7a388abb36ffc (patch) | |
tree | c647334269f0d4ae414d13e77711f8279aa57697 /spec/lib/gitlab/cycle_analytics | |
parent | 0aa477884c6ac3298f79f62e08e63294d81735a3 (diff) | |
download | gitlab-ce-f5b792e22eb7bd4ecafcd2ad3bc7a388abb36ffc.tar.gz |
refactored updater and updated specs
Diffstat (limited to 'spec/lib/gitlab/cycle_analytics')
-rw-r--r-- | spec/lib/gitlab/cycle_analytics/author_updater_spec.rb | 12 | ||||
-rw-r--r-- | spec/lib/gitlab/cycle_analytics/build_updater_spec.rb | 12 | ||||
-rw-r--r-- | spec/lib/gitlab/cycle_analytics/updater_spec.rb | 25 |
3 files changed, 25 insertions, 24 deletions
diff --git a/spec/lib/gitlab/cycle_analytics/author_updater_spec.rb b/spec/lib/gitlab/cycle_analytics/author_updater_spec.rb deleted file mode 100644 index f9e4d1714e6..00000000000 --- a/spec/lib/gitlab/cycle_analytics/author_updater_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -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 deleted file mode 100644 index 70886d7b453..00000000000 --- a/spec/lib/gitlab/cycle_analytics/build_updater_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -require 'spec_helper' - -describe Gitlab::CycleAnalytics::BuildUpdater do - let(:build) { create(:ci_build) } - let(:events) { [{ 'id' => build.id }] } - - it 'maps the correct build' do - described_class.update!(events) - - expect(events.first['build']).to eq(build) - end -end diff --git a/spec/lib/gitlab/cycle_analytics/updater_spec.rb b/spec/lib/gitlab/cycle_analytics/updater_spec.rb new file mode 100644 index 00000000000..eff54cd3692 --- /dev/null +++ b/spec/lib/gitlab/cycle_analytics/updater_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +describe Gitlab::CycleAnalytics::Updater do + 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 |