Merge branch 'master' of github.com:internetee/registry

This commit is contained in:
Andres Keskküla 2015-01-08 11:37:47 +02:00
commit 8c20f2697b
9 changed files with 220 additions and 166 deletions

36
spec/support/request.rb Normal file
View 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