diff options
-rw-r--r-- | spec/controllers/groups/variables_controller_spec.rb | 6 | ||||
-rw-r--r-- | spec/controllers/projects/variables_controller_spec.rb | 6 | ||||
-rw-r--r-- | spec/fixtures/api/schemas/variable.json | 28 | ||||
-rw-r--r-- | spec/fixtures/api/schemas/variables.json | 11 |
4 files changed, 27 insertions, 24 deletions
diff --git a/spec/controllers/groups/variables_controller_spec.rb b/spec/controllers/groups/variables_controller_spec.rb index 94d13b632cd..80b6be39291 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 4dbcfb125a2..0082757a5c6 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 b91ab633d26..78977118b0a 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 00000000000..8002f39a7b8 --- /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 +} |