diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-02-02 11:54:35 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-02-02 11:54:35 +0800 |
commit | 54fca95160389fe7993df5d82635b83804833fee (patch) | |
tree | 8552f29a7bfbf24af39a5d6a3f8b110c1695f7de /spec/serializers | |
parent | eb242fc865c032f6408f3b68700da9b840b416dd (diff) | |
parent | 40a824357c700280f3d2f8e2cda2fabc65af7f69 (diff) | |
download | gitlab-ce-fix-git-hooks-when-creating-file.tar.gz |
Merge remote-tracking branch 'upstream/master' into fix-git-hooks-when-creating-filefix-git-hooks-when-creating-file
* upstream/master: (190 commits)
Remove unnecessary returns / unset variables from the CoffeeScript -> JS conversion.
update spec
Change the reply shortcut to focus the field even without a selection.
use destroy_all
Remove settings cog from within admin scroll tabs; keep links centered
add changelog
remove old project members from project
add spec replicating validation error
Fix small typo on new branch button spec
Improve styling of the new issue message
Don't capitalize environment name in show page
Abillity to promote project labels to group labels
Edited the column header for the environments list from created to updated and added created to environments detail page colum header titles
Update and pin the `jwt` gem to ~> 1.5.6
refactor merge request build service
Update index.md
Clarify that Auto Deploy requires a public project.
19164 Add settings dropdown to mobile screens
cop for gem fetched from a git source
Add CHANGELOG entry
...
Diffstat (limited to 'spec/serializers')
7 files changed, 28 insertions, 40 deletions
diff --git a/spec/serializers/analytics_build_serializer_spec.rb b/spec/serializers/analytics_build_serializer_spec.rb index f0551c78671..e3b1dd93dc2 100644 --- a/spec/serializers/analytics_build_serializer_spec.rb +++ b/spec/serializers/analytics_build_serializer_spec.rb @@ -1,17 +1,13 @@ require 'spec_helper' describe AnalyticsBuildSerializer do - let(:serializer) do - described_class - .new.represent(resource) - end - - let(:json) { serializer.as_json } let(:resource) { create(:ci_build) } + subject { described_class.new.represent(resource) } + context 'when there is a single object provided' do it 'contains important elements of analyticsBuild' do - expect(json) + expect(subject) .to include(:name, :branch, :short_sha, :date, :total_time, :url, :author) end end diff --git a/spec/serializers/analytics_issue_serializer_spec.rb b/spec/serializers/analytics_issue_serializer_spec.rb index 6afbb2df35c..2f08958a783 100644 --- a/spec/serializers/analytics_issue_serializer_spec.rb +++ b/spec/serializers/analytics_issue_serializer_spec.rb @@ -1,14 +1,13 @@ require 'spec_helper' describe AnalyticsIssueSerializer do - let(:serializer) do + subject 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 { @@ -23,7 +22,7 @@ describe AnalyticsIssueSerializer do context 'when there is a single object provided' do it 'contains important elements of the issue' do - expect(json).to include(:title, :iid, :created_at, :total_time, :url, :author) + expect(subject).to include(:title, :iid, :created_at, :total_time, :url, :author) end end end diff --git a/spec/serializers/analytics_merge_request_serializer_spec.rb b/spec/serializers/analytics_merge_request_serializer_spec.rb index cdfae27193f..62067cc0ef2 100644 --- a/spec/serializers/analytics_merge_request_serializer_spec.rb +++ b/spec/serializers/analytics_merge_request_serializer_spec.rb @@ -1,14 +1,13 @@ require 'spec_helper' describe AnalyticsMergeRequestSerializer do - let(:serializer) do + subject 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 { @@ -24,7 +23,7 @@ describe AnalyticsMergeRequestSerializer do context 'when there is a single object provided' do it 'contains important elements of the merge request' do - expect(json).to include(:title, :iid, :created_at, :total_time, :url, :author, :state) + expect(subject).to include(:title, :iid, :created_at, :total_time, :url, :author, :state) end end end diff --git a/spec/serializers/analytics_stage_serializer_spec.rb b/spec/serializers/analytics_stage_serializer_spec.rb index f9951826683..be6aa7c65c3 100644 --- a/spec/serializers/analytics_stage_serializer_spec.rb +++ b/spec/serializers/analytics_stage_serializer_spec.rb @@ -1,13 +1,13 @@ require 'spec_helper' describe AnalyticsStageSerializer do - let(:serializer) do - described_class - .new.represent(resource) + subject do + described_class.new.represent(resource) end - let(:json) { serializer.as_json } - let(:resource) { Gitlab::CycleAnalytics::CodeStage.new(project: double, options: {}) } + let(:resource) do + Gitlab::CycleAnalytics::CodeStage.new(project: double, options: {}) + end before do allow_any_instance_of(Gitlab::CycleAnalytics::BaseStage).to receive(:median).and_return(1.12) @@ -15,10 +15,10 @@ describe AnalyticsStageSerializer do end it 'it generates payload for single object' do - expect(json).to be_kind_of Hash + expect(subject).to be_kind_of Hash end it 'contains important elements of AnalyticsStage' do - expect(json).to include(:title, :description, :value) + expect(subject).to include(:title, :description, :value) end end diff --git a/spec/serializers/analytics_summary_serializer_spec.rb b/spec/serializers/analytics_summary_serializer_spec.rb index 7a84c8b0b40..5d7a94c2d02 100644 --- a/spec/serializers/analytics_summary_serializer_spec.rb +++ b/spec/serializers/analytics_summary_serializer_spec.rb @@ -1,29 +1,28 @@ require 'spec_helper' describe AnalyticsSummarySerializer do - let(:serializer) do - described_class - .new.represent(resource) + subject do + described_class.new.represent(resource) end - let(:json) { serializer.as_json } let(:project) { create(:empty_project) } let(:user) { create(:user) } + let(:resource) do - Gitlab::CycleAnalytics::Summary::Issue.new(project: double, - from: 1.day.ago, - current_user: user) + Gitlab::CycleAnalytics::Summary::Issue + .new(project: double, from: 1.day.ago, current_user: user) end before do - allow_any_instance_of(Gitlab::CycleAnalytics::Summary::Issue).to receive(:value).and_return(1.12) + 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_kind_of Hash + expect(subject).to be_kind_of Hash end it 'contains important elements of AnalyticsStage' do - expect(json).to include(:title, :value) + expect(subject).to include(:title, :value) end end diff --git a/spec/serializers/environment_serializer_spec.rb b/spec/serializers/environment_serializer_spec.rb index b7ed4eb0239..3c37660885d 100644 --- a/spec/serializers/environment_serializer_spec.rb +++ b/spec/serializers/environment_serializer_spec.rb @@ -1,16 +1,15 @@ require 'spec_helper' describe EnvironmentSerializer do - let(:serializer) do + let(:user) { create(:user) } + let(:project) { create(:project) } + + let(:json) do described_class .new(user: user, project: project) .represent(resource) end - let(:json) { serializer.as_json } - let(:user) { create(:user) } - let(:project) { create(:project) } - context 'when there is a single object provided' do before do create(:ci_build, :manual, name: 'manual1', diff --git a/spec/serializers/pipeline_serializer_spec.rb b/spec/serializers/pipeline_serializer_spec.rb index 3a32cb394dd..7cbf131e41e 100644 --- a/spec/serializers/pipeline_serializer_spec.rb +++ b/spec/serializers/pipeline_serializer_spec.rb @@ -7,11 +7,7 @@ describe PipelineSerializer do described_class.new(user: user) end - let(:entity) do - serializer.represent(resource) - end - - subject { entity.as_json } + subject { serializer.represent(resource) } describe '#represent' do context 'when used without pagination' do |