Add offset support for repp domains

This commit is contained in:
Martin Lensment 2015-03-30 10:44:42 +03:00
parent 7b26ba58df
commit df4cd1ee6d
2 changed files with 24 additions and 3 deletions

View file

@ -30,8 +30,27 @@ describe Repp::DomainV1 do
log[:ip].should == '127.0.0.1'
end
it 'returns domain names of the current registrar' do
it 'returns domain names with offset' do
get_with_auth '/repp/v1/domains', { offset: 1}, @api_user
response.status.should == 200
body = JSON.parse(response.body)
body['total_number_of_records'].should == 2
# TODO: Maybe there is a way not to convert from and to json again
body['domains'].to_json.should == @api_user.reload.registrar.domains.offset(1).pluck(:name).to_json
log = ApiLog::ReppLog.last
log[:request_path].should == '/repp/v1/domains'
log[:request_method].should == 'GET'
log[:request_params].should == '{"offset":1}'
log[:response_code].should == '200'
log[:api_user_name].should == 'gitlab'
log[:api_user_registrar].should == 'registrar1'
log[:ip].should == '127.0.0.1'
end
it 'returns domain names of the current registrar' do
get_with_auth '/repp/v1/domains', {}, @api_user
response.status.should == 200