travis-api/spec/support/shared_examples.rb
Joe Corcoran 871b915515 Add env vars endpoints
This adds API V3 endpoints for querying, creating, modifying and
deleting environment variables.

It has no concept of encryption yet and should be considered a work in
progress.

We should also talk about the slightly off-track approach in the
EnvVars::Create service – maybe there's a way to standardise the
querying and rendering for post requests?

2016-07-01 23:55:49 -04:00

35 lines
931 B
Ruby

RSpec.shared_examples 'not authenticated' do
example { expect(last_response.status).to eq(403) }
example do
expect(JSON.load(body)).to eq(
'@type' => 'error',
'error_type' => 'login_required',
'error_message' => 'login required'
)
end
end
RSpec.shared_examples 'missing repo' do
example { expect(last_response.status).to eq(404) }
example do
expect(JSON.load(body)).to eq(
'@type' => 'error',
'error_message' => 'repository not found (or insufficient access)',
'error_type' => 'not_found',
'resource_type' => 'repository'
)
end
end
RSpec.shared_examples 'missing env_var' do
example { expect(last_response.status).to eq 404 }
example do
expect(JSON.load(body)).to eq(
'@type' => 'error',
'error_message' => 'env_var not found (or insufficient access)',
'error_type' => 'not_found',
'resource_type' => 'env_var'
)
end
end