diff --git a/spec/controllers/groups/variables_controller_spec.rb b/spec/controllers/groups/variables_controller_spec.rb index 94d13b632cd3840df697704826a866fd8d1eb4c9..80b6be39291920e3a9e6c3549b204cc8af537a2d 100644 --- a/spec/controllers/groups/variables_controller_spec.rb +++ b/spec/controllers/groups/variables_controller_spec.rb @@ -19,7 +19,7 @@ describe Groups::VariablesController do it 'renders the ci_group_variable as json' do subject - expect(response).to match_response_schema('variable') + expect(response).to match_response_schema('variables') end end @@ -85,7 +85,7 @@ describe Groups::VariablesController do it 'has all variables in response' do subject - expect(response).to match_response_schema('variable') + expect(response).to match_response_schema('variables') end end @@ -111,7 +111,7 @@ describe Groups::VariablesController do it 'has all variables in response' do subject - expect(json_response['variables'].count).to eq(0) + expect(response).to match_response_schema('variables') end end end diff --git a/spec/controllers/projects/variables_controller_spec.rb b/spec/controllers/projects/variables_controller_spec.rb index 4dbcfb125a270ca9021d93c5360b057bac6ef19e..0082757a5c6d6ea8f0169da4f16d9518e97618fb 100644 --- a/spec/controllers/projects/variables_controller_spec.rb +++ b/spec/controllers/projects/variables_controller_spec.rb @@ -24,7 +24,7 @@ describe Projects::VariablesController do it 'renders the ci_variable as json' do subject - expect(response).to match_response_schema('variable') + expect(response).to match_response_schema('variables') end end @@ -94,7 +94,7 @@ describe Projects::VariablesController do it 'has all variables in response' do subject - expect(response).to match_response_schema('variable') + expect(response).to match_response_schema('variables') end end @@ -120,7 +120,7 @@ describe Projects::VariablesController do it 'has all variables in response' do subject - expect(json_response['variables'].count).to eq(0) + expect(response).to match_response_schema('variables') end end end diff --git a/spec/fixtures/api/schemas/variable.json b/spec/fixtures/api/schemas/variable.json index b91ab633d26320683becf3bc8ff64dc2f350b15b..78977118b0a9d3f69dfd26f139a4a39357df1c7a 100644 --- a/spec/fixtures/api/schemas/variable.json +++ b/spec/fixtures/api/schemas/variable.json @@ -1,24 +1,16 @@ { "type": "object", - "required": ["variables"], + "required": [ + "id", + "key", + "value", + "protected" + ], "properties": { - "variables": { - "type": "array", - "items": { - "required": [ - "id", - "key", - "value", - "protected" - ], - "properties": { - "id": { "type": "integer" }, - "key": { "type": "string" }, - "value": { "type": "string" }, - "protected": { "type": "boolean" } - } - } - } + "id": { "type": "integer" }, + "key": { "type": "string" }, + "value": { "type": "string" }, + "protected": { "type": "boolean" } }, "additionalProperties": false } diff --git a/spec/fixtures/api/schemas/variables.json b/spec/fixtures/api/schemas/variables.json new file mode 100644 index 0000000000000000000000000000000000000000..8002f39a7b813e908cb918fbe7774b8e9611a303 --- /dev/null +++ b/spec/fixtures/api/schemas/variables.json @@ -0,0 +1,11 @@ +{ + "type": "object", + "required": ["variables"], + "properties": { + "variables": { + "type": "array", + "items": { "$ref": "variable.json" } + } + }, + "additionalProperties": false +}