Commit b01275f1 authored by Thong Kuah's avatar Thong Kuah

Swap unconditional expose test with schema check

Though we still need to verify that rollout_status is present or not as
schema check can't do that for us
parent 9877a301
......@@ -19,7 +19,10 @@
]
},
"rollout_status": {
"$ref": "../rollout_status.json"
"oneOf": [
{ "type": "null" },
{ "$ref": "../rollout_status.json" }
]
},
"updated_at": { "type": "date" }
},
......
......@@ -22,28 +22,16 @@ describe Clusters::EnvironmentEntity do
subject { described_class.new(environment, request: request).as_json }
it 'exposes project' do
expect(subject).to include(:project)
end
it 'exposes last_deployment' do
expect(subject).to include(:last_deployment)
end
it 'exposes environment_path' do
expect(subject).to include(:environment_path)
end
it 'exposes updated_at' do
expect(subject).to include(:updated_at)
end
context 'deploy board available' do
before do
allow(group).to receive(:feature_available?).and_call_original
allow(group).to receive(:feature_available?).with(:cluster_deployments).and_return(true)
end
it 'matches expected schema' do
expect(subject.with_indifferent_access).to match_schema('clusters/environment', dir: 'ee')
end
it 'exposes rollout_status' do
expect(subject).to include(:rollout_status)
end
......@@ -54,6 +42,10 @@ describe Clusters::EnvironmentEntity do
allow(group).to receive(:feature_available?).with(:cluster_deployments).and_return(false)
end
it 'matches expected schema' do
expect(subject.with_indifferent_access).to match_schema('clusters/environment', dir: 'ee')
end
it 'does not expose rollout_status' do
expect(subject).not_to include(:rollout_status)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment