REPP: Test domain status editing

This commit is contained in:
Karl Erik Õunapuu 2021-02-01 12:35:20 +02:00
parent c5e2ebe15e
commit bad06307b6
No known key found for this signature in database
GPG key ID: C9DD647298A34764
2 changed files with 88 additions and 6 deletions

View file

@ -6,9 +6,9 @@ module Repp
before_action :verify_status
api :DELETE, '/repp/v1/domains/:domain_name/statuses/:status'
param :domain_name, String, desc: 'Domain name'
param :status, String, desc: 'Status to be removed'
desc 'Remove status from specific domain'
param :domain_name, String, required: true, desc: 'Domain name'
param :status, String, required: true, desc: 'Status to be removed'
def destroy
return editing_failed unless domain_with_status?(params[:id])
@ -21,9 +21,9 @@ module Repp
end
api :PUT, '/repp/v1/domains/:domain_name/statuses/:status'
param :domain_name, String, desc: 'Domain name'
param :status, String, desc: 'Status to be added'
desc 'Add status to specific domain'
param :domain_name, String, required: true, desc: 'Domain name'
param :status, String, required: true, desc: 'Status to be added'
def update
return editing_failed if domain_with_status?(params[:id])
@ -37,8 +37,8 @@ module Repp
private
def domain_with_status?
@domain.statuses.include?(params[:id])
def domain_with_status?(status)
@domain.statuses.include?(status)
end
def verify_status