diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-03 14:01:35 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-11-03 14:01:35 +0100 |
commit | c3dae798e16dee0b64bc8c9fd0e0e21b2502318e (patch) | |
tree | d966d7c9ddeb26786ee5d33c79a72d046d901d93 /spec | |
parent | 7dd6485a0fd7fc264f86f389da3ab846c62e8724 (diff) | |
download | gitlab-ce-c3dae798e16dee0b64bc8c9fd0e0e21b2502318e.tar.gz |
Extend tests for environments serializer
Diffstat (limited to 'spec')
-rw-r--r-- | spec/serializers/environment_serializer_spec.rb | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/spec/serializers/environment_serializer_spec.rb b/spec/serializers/environment_serializer_spec.rb index 2c94a076aba..81393beb416 100644 --- a/spec/serializers/environment_serializer_spec.rb +++ b/spec/serializers/environment_serializer_spec.rb @@ -24,21 +24,30 @@ describe EnvironmentSerializer do let(:project) { deployment.project } let(:resource) { deployment.environment } - it 'shows json' do - pp serializer.as_json - end - it 'it generates payload for single object' do expect(serializer.as_json).to be_an_instance_of Hash end + + it 'contains important elements of environment' do + expect(serializer.as_json) + .to include(:name, :external_url, :environment_url, :last_deployment) + end + + it 'contains relevant information about last deployment' do + last_deployment = serializer.as_json.fetch(:last_deployment) + + expect(last_deployment) + .to include(:ref, :user, :commit, :deployable, :manual_actions) + end 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 - puts serializer.as_json + it 'contains important elements of environment' do + expect(serializer.as_json.first) + .to include(:last_deployment, :name, :external_url) end it 'generates payload for collection' do |