mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 02:39:37 +02:00
Add REPP Contacts spec
This commit is contained in:
parent
b63d448c04
commit
0eb6937dc5
1 changed files with 23 additions and 0 deletions
23
spec/requests/contact_v1_spec.rb
Normal file
23
spec/requests/contact_v1_spec.rb
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
describe Repp::ContactV1 do
|
||||||
|
let(:epp_user) { Fabricate(:epp_user) }
|
||||||
|
|
||||||
|
before(:each) { create_settings }
|
||||||
|
|
||||||
|
describe 'GET /repp/v1/contacts' do
|
||||||
|
it 'returns contacts of the current registrar' do
|
||||||
|
Fabricate.times(2, :contact, registrar: epp_user.registrar)
|
||||||
|
Fabricate.times(2, :contact)
|
||||||
|
|
||||||
|
get_with_auth '/repp/v1/contacts', {}, epp_user
|
||||||
|
expect(response.status).to eq(200)
|
||||||
|
|
||||||
|
body = JSON.parse(response.body)
|
||||||
|
expect(body['total_pages']).to eq(1)
|
||||||
|
|
||||||
|
# TODO: Maybe there is a way not to convert from and to json again
|
||||||
|
expect(body['contacts'].to_json).to eq(epp_user.registrar.contacts.to_json)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue