diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-03 12:54:10 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-03 13:27:00 +0100 |
commit | 573921cb9d0b139dec324fb1368feb1347b51624 (patch) | |
tree | 048c3f8a4c05127a0fc1be1de6ad60b6165bcb32 /spec | |
parent | f1e9c97d64b96bdd398616743ad048f8d147e26b (diff) | |
download | gitlab-ce-573921cb9d0b139dec324fb1368feb1347b51624.tar.gz |
Implement entities needed for environments folders
Diffstat (limited to 'spec')
-rw-r--r-- | spec/factories/deployments.rb | 4 | ||||
-rw-r--r-- | spec/serializers/environment_serializer_spec.rb | 15 |
2 files changed, 14 insertions, 5 deletions
diff --git a/spec/factories/deployments.rb b/spec/factories/deployments.rb index 6f24bf58d14..8c8e5dc54c2 100644 --- a/spec/factories/deployments.rb +++ b/spec/factories/deployments.rb @@ -1,9 +1,9 @@ FactoryGirl.define do factory :deployment, class: Deployment do - sha '97de212e80737a608d939f648d959671fb0a0142' + sha 'b83d6e391c22777fca1ed3012fce84f633d7fed0' ref 'master' tag false - project nil + project environment factory: :environment diff --git a/spec/serializers/environment_serializer_spec.rb b/spec/serializers/environment_serializer_spec.rb index cd9486111f1..f7de6c450ab 100644 --- a/spec/serializers/environment_serializer_spec.rb +++ b/spec/serializers/environment_serializer_spec.rb @@ -2,17 +2,25 @@ require 'spec_helper' describe EnvironmentSerializer do let(:serializer) do - described_class.new(path: 'some path', user: user) + described_class + .new(user: user, project: project) .represent(resource) end let(:user) { create(:user) } context 'when there is a single object provided' do - let(:resource) { create(:environment) } + let(:deployment) do + create(:deployment, deployable: deployable, + user: user) + end + + let(:deployable) { create(:ci_build) } + let(:project) { deployment.project } + let(:resource) { deployment.environment } it 'shows json' do - puts serializer.as_json + pp serializer.as_json end it 'it generates payload for single object' do @@ -21,6 +29,7 @@ describe EnvironmentSerializer do end context 'when there is a collection of objects provided' do + let(:project) { create(:empty_project) } let(:resource) { create_list(:environment, 2) } it 'shows json' do |