mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 09:45:11 +02:00
commit
924df78fe5
31 changed files with 212 additions and 34 deletions
|
@ -49,7 +49,7 @@ Fabricator(:eis, from: :registrar) do
|
|||
city 'Tallinn'
|
||||
street 'Paldiski mnt 80'
|
||||
zip '10617'
|
||||
url 'www.internet.ee'
|
||||
website 'www.internet.ee'
|
||||
code { sequence(:code) { |i| "EIS#{i}" } }
|
||||
accounts(count: 1) { Fabricate(:account, account_activities: []) }
|
||||
end
|
||||
|
|
20
spec/features/admin/registrars/create_spec.rb
Normal file
20
spec/features/admin/registrars/create_spec.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.feature 'New registrar' do
|
||||
background do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
it 'creates registrar' do
|
||||
visit admin_registrars_url
|
||||
click_link_or_button 'New registrar'
|
||||
|
||||
fill_in 'registrar[name]', with: 'test'
|
||||
fill_in 'registrar[reg_no]', with: '1234567'
|
||||
fill_in 'registrar[email]', with: 'test@test.com'
|
||||
fill_in 'registrar[code]', with: 'test'
|
||||
click_link_or_button 'Create registrar'
|
||||
|
||||
expect(page).to have_text('Registrar has been successfully created')
|
||||
end
|
||||
end
|
18
spec/features/admin/registrars/edit_spec.rb
Normal file
18
spec/features/admin/registrars/edit_spec.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.feature 'Edit registrar' do
|
||||
given!(:registrar) { create(:registrar) }
|
||||
|
||||
background do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
it 'updates registrar' do
|
||||
visit admin_registrar_url(registrar)
|
||||
click_link_or_button 'Edit'
|
||||
|
||||
click_link_or_button 'Update registrar'
|
||||
|
||||
expect(page).to have_text('Registrar has been successfully updated')
|
||||
end
|
||||
end
|
|
@ -607,7 +607,6 @@ end
|
|||
|
||||
RSpec.describe Domain, db: false do
|
||||
it { is_expected.to alias_attribute(:on_hold_time, :outzone_at) }
|
||||
it { is_expected.to alias_attribute(:force_delete_time, :force_delete_at) }
|
||||
it { is_expected.to alias_attribute(:outzone_time, :outzone_at) }
|
||||
|
||||
describe 'nameserver validation', db: true do
|
||||
|
|
|
@ -25,10 +25,10 @@ RSpec.describe RegistrarPresenter do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#url' do
|
||||
it 'returns url' do
|
||||
expect(registrar).to receive(:url).and_return('test url')
|
||||
expect(presenter.url).to eq('test url')
|
||||
describe '#website' do
|
||||
it 'returns website' do
|
||||
expect(registrar).to receive(:website).and_return('test')
|
||||
expect(presenter.website).to eq('test')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
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
|
33
spec/routing/admin/registrars_routing_spec.rb
Normal file
33
spec/routing/admin/registrars_routing_spec.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Admin::RegistrarsController do
|
||||
describe 'routing' do
|
||||
it 'routes to #index' do
|
||||
expect(get: '/admin/registrars').to route_to('admin/registrars#index')
|
||||
end
|
||||
|
||||
it 'routes to #new' do
|
||||
expect(get: '/admin/registrars/new').to route_to('admin/registrars#new')
|
||||
end
|
||||
|
||||
it 'routes to #show' do
|
||||
expect(get: '/admin/registrars/1').to route_to('admin/registrars#show', id: '1')
|
||||
end
|
||||
|
||||
it 'routes to #edit' do
|
||||
expect(get: '/admin/registrars/1/edit').to route_to('admin/registrars#edit', id: '1')
|
||||
end
|
||||
|
||||
it 'routes to #create' do
|
||||
expect(post: '/admin/registrars').to route_to('admin/registrars#create')
|
||||
end
|
||||
|
||||
it 'routes to #update' do
|
||||
expect(patch: '/admin/registrars/1').to route_to('admin/registrars#update', id: '1')
|
||||
end
|
||||
|
||||
it 'routes to #destroy' do
|
||||
expect(delete: '/admin/registrars/1').to route_to('admin/registrars#destroy', id: '1')
|
||||
end
|
||||
end
|
||||
end
|
15
spec/views/admin/registrars/_form.haml_spec.rb
Normal file
15
spec/views/admin/registrars/_form.haml_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'admin/registrars/_form' do
|
||||
let(:registrar) { build_stubbed(:registrar) }
|
||||
|
||||
before :example do
|
||||
assign(:registrar, registrar)
|
||||
stub_template 'shared/_full_errors' => ''
|
||||
end
|
||||
|
||||
it 'has website' do
|
||||
render
|
||||
expect(rendered).to have_css('[name="registrar[website]"]')
|
||||
end
|
||||
end
|
15
spec/views/admin/registrars/show.haml_spec.rb
Normal file
15
spec/views/admin/registrars/show.haml_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'admin/registrars/show' do
|
||||
let(:registrar) { build_stubbed(:registrar, website: 'test website') }
|
||||
|
||||
before :example do
|
||||
assign(:registrar, registrar)
|
||||
stub_template 'shared/_title' => ''
|
||||
end
|
||||
|
||||
it 'has website' do
|
||||
render
|
||||
expect(rendered).to have_text('test website')
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@ RSpec.shared_examples 'domain mailer registrar info' do
|
|||
name
|
||||
email
|
||||
phone
|
||||
url
|
||||
website
|
||||
)
|
||||
|
||||
attributes.each do |attr_name|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue