summaryrefslogtreecommitdiff
path: root/spec/serializers/analytics_summary_serializer_spec.rb
diff options
context:
space:
mode:
authorJames Lopez <james@jameslopez.es>2016-11-22 11:46:02 +0100
committerJames Lopez <james@jameslopez.es>2017-01-17 11:32:54 +0100
commitfc6f8f20562ad761c034ffff076d329a3e9e8f4d (patch)
tree401c48a79209f656fa74dffe102d4385caefea76 /spec/serializers/analytics_summary_serializer_spec.rb
parentdc6ea14b0d11a5e73e81c95ef723f0c1af69215b (diff)
downloadgitlab-ce-fc6f8f20562ad761c034ffff076d329a3e9e8f4d.tar.gz
added new summary serializers and refactor all of the summary stuff into separate logical classes
Diffstat (limited to 'spec/serializers/analytics_summary_serializer_spec.rb')
-rw-r--r--spec/serializers/analytics_summary_serializer_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/serializers/analytics_summary_serializer_spec.rb b/spec/serializers/analytics_summary_serializer_spec.rb
new file mode 100644
index 00000000000..e08e3f88710
--- /dev/null
+++ b/spec/serializers/analytics_summary_serializer_spec.rb
@@ -0,0 +1,24 @@
+require 'spec_helper'
+
+describe AnalyticsSummarySerializer do
+ let(:serializer) do
+ described_class
+ .new.represent(resource)
+ end
+
+ let(:json) { serializer.as_json }
+ let(:project) { create(:empty_project) }
+ let(:resource) { Gitlab::CycleAnalytics::Summary::Issue.new(project: double, from: 1.day.ago) }
+
+ before do
+ allow_any_instance_of(Gitlab::CycleAnalytics::Summary::Issue).to receive(:value).and_return(1.12)
+ end
+
+ it 'it generates payload for single object' do
+ expect(json).to be_an_instance_of Hash
+ end
+
+ it 'contains important elements of AnalyticsStage' do
+ expect(json).to include(:title, :value)
+ end
+end