mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 03:06:14 +02:00
Added some missing model specs + PaperTrail session fix
This commit is contained in:
parent
c248a957a6
commit
a637eb5e01
39 changed files with 1447 additions and 845 deletions
|
@ -1,23 +1,24 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Repp::ContactV1 do
|
||||
let(:api_user) { Fabricate(:api_user) }
|
||||
|
||||
before(:each) { create_settings }
|
||||
before :all do
|
||||
create_settings
|
||||
@api_user = Fabricate(:gitlab_api_user)
|
||||
end
|
||||
|
||||
describe 'GET /repp/v1/contacts' do
|
||||
it 'returns contacts of the current registrar' do
|
||||
Fabricate.times(2, :contact, registrar: api_user.registrar)
|
||||
Fabricate.times(2, :contact, registrar: @api_user.registrar)
|
||||
Fabricate.times(2, :contact)
|
||||
|
||||
get_with_auth '/repp/v1/contacts', {}, api_user
|
||||
get_with_auth '/repp/v1/contacts', {}, @api_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(api_user.registrar.contacts.to_json)
|
||||
expect(body['contacts'].to_json).to eq(@api_user.registrar.contacts.to_json)
|
||||
|
||||
log = ApiLog::ReppLog.first
|
||||
expect(log[:request_path]).to eq('/repp/v1/contacts')
|
||||
|
@ -26,7 +27,6 @@ describe Repp::ContactV1 do
|
|||
expect(log[:response].length).to be > 20
|
||||
expect(log[:response_code]).to eq('200')
|
||||
expect(log[:api_user_name]).to eq('gitlab')
|
||||
expect(log[:api_user_registrar]).to eq('Registrar OÜ')
|
||||
expect(log[:ip]).to eq('127.0.0.1')
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue