mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
parent
c14d15d7b7
commit
c037166085
8 changed files with 88 additions and 2 deletions
24
spec/requests/admin/registrars/create_spec.rb
Normal file
24
spec/requests/admin/registrars/create_spec.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'admin registrar create' do
|
||||
subject(:registrar) { Registrar.first }
|
||||
|
||||
before :example do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
it 'creates new registrar' do
|
||||
expect { post admin_registrars_path, registrar: attributes_for(:registrar) }
|
||||
.to change { Registrar.count }.from(0).to(1)
|
||||
end
|
||||
|
||||
it 'saves website' do
|
||||
post admin_registrars_path, { registrar: attributes_for(:registrar, website: 'test') }
|
||||
expect(registrar.website).to eq('test')
|
||||
end
|
||||
|
||||
it 'redirects to :show' do
|
||||
post admin_registrars_path, { registrar: attributes_for(:registrar) }
|
||||
expect(response).to redirect_to admin_registrar_path(registrar)
|
||||
end
|
||||
end
|
24
spec/requests/admin/registrars/update_spec.rb
Normal file
24
spec/requests/admin/registrars/update_spec.rb
Normal file
|
@ -0,0 +1,24 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'admin registrar update' do
|
||||
before :example do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
it 'updates website' do
|
||||
registrar = create(:registrar, website: 'test')
|
||||
|
||||
patch admin_registrar_path(registrar), registrar: attributes_for(:registrar, website: 'new-website')
|
||||
registrar.reload
|
||||
|
||||
expect(registrar.website).to eq('new-website')
|
||||
end
|
||||
|
||||
it 'redirects to :show' do
|
||||
registrar = create(:registrar)
|
||||
|
||||
patch admin_registrar_path(registrar), { registrar: attributes_for(:registrar) }
|
||||
|
||||
expect(response).to redirect_to admin_registrar_path(registrar)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue