diff options
author | James Lopez <james@jameslopez.es> | 2016-11-18 08:13:34 +0100 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2016-11-18 08:13:34 +0100 |
commit | e56c305be003ee33b093f9ba42622fba0da903f2 (patch) | |
tree | 03165847694615ccdd2709a6f07d8032ba7f2bbd /spec/serializers | |
parent | 24c2aa39ad0f55321ef2c28ce10d740bf6b78980 (diff) | |
download | gitlab-ce-e56c305be003ee33b093f9ba42622fba0da903f2.tar.gz |
fix spec failuresfeature/cycle-analytics-events
Diffstat (limited to 'spec/serializers')
-rw-r--r-- | spec/serializers/analytics_issue_serializer_spec.rb (renamed from spec/serializers/analytics_generic_serializer_spec.rb) | 4 | ||||
-rw-r--r-- | spec/serializers/analytics_merge_request_serializer_spec.rb | 34 |
2 files changed, 36 insertions, 2 deletions
diff --git a/spec/serializers/analytics_generic_serializer_spec.rb b/spec/serializers/analytics_issue_serializer_spec.rb index 99f2254d22c..2842e1ba52f 100644 --- a/spec/serializers/analytics_generic_serializer_spec.rb +++ b/spec/serializers/analytics_issue_serializer_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe AnalyticsGenericSerializer do +describe AnalyticsIssueSerializer do let(:serializer) do described_class .new(project: project, entity: :merge_request) @@ -26,7 +26,7 @@ describe AnalyticsGenericSerializer do expect(json).to be_an_instance_of Hash end - it 'contains important elements of analyticsBuild' do + it 'contains important elements of the issue' do expect(json).to include(:title, :iid, :created_at, :total_time, :url, :author) end end diff --git a/spec/serializers/analytics_merge_request_serializer_spec.rb b/spec/serializers/analytics_merge_request_serializer_spec.rb new file mode 100644 index 00000000000..564207984df --- /dev/null +++ b/spec/serializers/analytics_merge_request_serializer_spec.rb @@ -0,0 +1,34 @@ +require 'spec_helper' + +describe AnalyticsMergeRequestSerializer do + let(:serializer) do + described_class + .new(project: project, entity: :merge_request) + .represent(resource) + end + + let(:user) { create(:user) } + let(:json) { serializer.as_json } + let(:project) { create(:project) } + let(:resource) do + { + total_time: "172802.724419", + title: "Eos voluptatem inventore in sed.", + iid: "1", + id: "1", + state: 'open', + created_at: "2016-11-12 15:04:02.948604", + author: user + } + end + + context 'when there is a single object provided' do + it 'it generates payload for single object' do + expect(json).to be_an_instance_of Hash + end + + it 'contains important elements of the merge request' do + expect(json).to include(:title, :iid, :created_at, :total_time, :url, :author, :state) + end + end +end |