|
|
@ -94,6 +94,7 @@ RSpec.describe Api::V1::Admin::DomainAllowsController, type: :controller do
|
|
|
|
describe 'POST #create' do
|
|
|
|
describe 'POST #create' do
|
|
|
|
let!(:domain_allow) { Fabricate(:domain_allow, domain: 'example.com') }
|
|
|
|
let!(:domain_allow) { Fabricate(:domain_allow, domain: 'example.com') }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context do
|
|
|
|
before do
|
|
|
|
before do
|
|
|
|
post :create, params: { domain: 'foo.bar.com' }
|
|
|
|
post :create, params: { domain: 'foo.bar.com' }
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -115,4 +116,15 @@ RSpec.describe Api::V1::Admin::DomainAllowsController, type: :controller do
|
|
|
|
expect(DomainAllow.find_by(domain: 'foo.bar.com')).to_not be_nil
|
|
|
|
expect(DomainAllow.find_by(domain: 'foo.bar.com')).to_not be_nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context 'with invalid domain name' do
|
|
|
|
|
|
|
|
before do
|
|
|
|
|
|
|
|
post :create, params: { domain: 'foo bar' }
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it 'returns http unprocessable entity' do
|
|
|
|
|
|
|
|
expect(response).to have_http_status(422)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|