mirror of
https://github.com/internetee/registry.git
synced 2025-07-03 01:33:36 +02:00
Merge branch 'master' of github.com:internetee/registry
This commit is contained in:
commit
8c20f2697b
9 changed files with 220 additions and 166 deletions
36
spec/support/request.rb
Normal file
36
spec/support/request.rb
Normal file
|
@ -0,0 +1,36 @@
|
|||
module Request
|
||||
def get_with_auth(path, params, epp_user)
|
||||
get path, params, env_with_auth(epp_user)
|
||||
end
|
||||
|
||||
def delete_with_auth(path, epp_user)
|
||||
delete path, params, env_with_auth(epp_user)
|
||||
end
|
||||
|
||||
def post_with_auth(path, params, epp_user)
|
||||
post path, params, env_with_auth(epp_user)
|
||||
end
|
||||
|
||||
def patch_with_auth(path, params, epp_user)
|
||||
patch path, params, env_with_auth(epp_user)
|
||||
end
|
||||
|
||||
def env
|
||||
{
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json'
|
||||
}
|
||||
end
|
||||
|
||||
def env_with_auth(epp_user)
|
||||
env.merge({
|
||||
'HTTP_AUTHORIZATION' => ActionController::HttpAuthentication::Basic.encode_credentials(
|
||||
epp_user.username, epp_user.password
|
||||
)
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.configure do |c|
|
||||
c.include Request, type: :request
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue