mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 08:22:05 +02:00
parent
f35b2dc36c
commit
5d63feb0a5
43 changed files with 262 additions and 816 deletions
|
@ -1,12 +0,0 @@
|
|||
require 'rails_helper'
|
||||
require_relative 'expired_shared'
|
||||
|
||||
RSpec.describe 'mailers/domain_expire_mailer/expired.html.erb' do
|
||||
before :example do
|
||||
stub_template 'mailers/shared/registrar/_registrar.et.html' => 'test registrar estonian'
|
||||
stub_template 'mailers/shared/registrar/_registrar.en.html' => 'test registrar english'
|
||||
stub_template 'mailers/shared/registrar/_registrar.ru.html' => 'test registrar russian'
|
||||
end
|
||||
|
||||
include_examples 'domain expire mailer expired'
|
||||
end
|
|
@ -1,12 +0,0 @@
|
|||
require 'rails_helper'
|
||||
require_relative 'expired_shared'
|
||||
|
||||
RSpec.describe 'mailers/domain_expire_mailer/expired.text.erb' do
|
||||
before :example do
|
||||
stub_template 'mailers/shared/registrar/_registrar.et.text' => 'test registrar estonian'
|
||||
stub_template 'mailers/shared/registrar/_registrar.en.text' => 'test registrar english'
|
||||
stub_template 'mailers/shared/registrar/_registrar.ru.text' => 'test registrar russian'
|
||||
end
|
||||
|
||||
include_examples 'domain expire mailer expired'
|
||||
end
|
|
@ -1,53 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.shared_examples 'domain expire mailer expired' do
|
||||
let(:domain) { instance_spy(DomainPresenter) }
|
||||
let(:registrar) { instance_spy(RegistrarPresenter) }
|
||||
let(:registrant) { instance_spy(RegistrantPresenter) }
|
||||
let(:lang_count) { 3 }
|
||||
|
||||
before :example do
|
||||
assign(:domain, domain)
|
||||
assign(:registrar, registrar)
|
||||
assign(:registrant, registrant)
|
||||
end
|
||||
|
||||
it 'has registrar info in estonian' do
|
||||
render
|
||||
expect(rendered).to have_text('test registrar estonian')
|
||||
end
|
||||
|
||||
it 'has registrar info in english' do
|
||||
render
|
||||
expect(rendered).to have_text('test registrar english')
|
||||
end
|
||||
|
||||
it 'has registrar info in russian' do
|
||||
render
|
||||
expect(rendered).to have_text('test registrar russian')
|
||||
end
|
||||
|
||||
it 'has domain name' do
|
||||
mention_count = 4 * lang_count
|
||||
expect(domain).to receive(:name).exactly(mention_count).times.and_return('test domain name')
|
||||
render
|
||||
expect(rendered).to have_text('test domain name', count: mention_count)
|
||||
end
|
||||
|
||||
domain_attributes = %i(
|
||||
on_hold_date
|
||||
delete_date
|
||||
registrant_name
|
||||
admin_contact_names
|
||||
tech_contact_names
|
||||
nameserver_names
|
||||
)
|
||||
|
||||
domain_attributes.each do |attr_name|
|
||||
it "has domain #{attr_name}" do
|
||||
expect(domain).to receive(attr_name).exactly(lang_count).times.and_return("test domain #{attr_name}")
|
||||
render
|
||||
expect(rendered).to have_text("test domain #{attr_name}", count: lang_count)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
require 'rails_helper'
|
||||
require_relative 'registrant_shared'
|
||||
|
||||
RSpec.describe 'mailers/shared/registrant/_registrant.en.html.erb' do
|
||||
include_examples 'domain mailer registrant info', 'mailers/shared/registrant/_registrant.en.html.erb'
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
require 'rails_helper'
|
||||
require_relative 'registrant_shared'
|
||||
|
||||
RSpec.describe 'mailers/shared/registrant/_registrant.en.text.erb' do
|
||||
include_examples 'domain mailer registrant info', 'mailers/shared/registrant/_registrant.en.text.erb'
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
require 'rails_helper'
|
||||
require_relative 'registrant_shared'
|
||||
|
||||
RSpec.describe 'mailers/shared/registrant/_registrant.et.html.erb' do
|
||||
include_examples 'domain mailer registrant info', 'mailers/shared/registrant/_registrant.et.html.erb'
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
require 'rails_helper'
|
||||
require_relative 'registrant_shared'
|
||||
|
||||
RSpec.describe 'mailers/shared/registrant/_registrant.et.text.erb' do
|
||||
include_examples 'domain mailer registrant info', 'mailers/shared/registrant/_registrant.et.text.erb'
|
||||
end
|
|
@ -1,87 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.shared_examples 'domain mailer registrant info' do |template_path|
|
||||
let(:template_path) { template_path }
|
||||
let(:registrant) { instance_spy(RegistrantPresenter) }
|
||||
|
||||
before :example do
|
||||
without_partial_double_verification do
|
||||
allow(view).to receive(:registrant).and_return(registrant)
|
||||
allow(view).to receive(:address_processing)
|
||||
end
|
||||
end
|
||||
|
||||
it 'has name' do
|
||||
allow(registrant).to receive(:name).and_return('test name')
|
||||
render template: template_path
|
||||
expect(rendered).to have_text('test name')
|
||||
end
|
||||
|
||||
it 'has ident' do
|
||||
allow(registrant).to receive(:ident).and_return('test ident')
|
||||
render template: template_path
|
||||
expect(rendered).to have_text('test ident')
|
||||
end
|
||||
|
||||
context 'when :with_phone is true' do
|
||||
it 'has phone' do
|
||||
allow(registrant).to receive(:phone).and_return('test phone')
|
||||
render template: template_path, locals: { with_phone: true }
|
||||
expect(rendered).to have_text('test phone')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when :with_phone is false' do
|
||||
it 'has no phone' do
|
||||
allow(registrant).to receive(:phone).and_return('test phone')
|
||||
render template: template_path, locals: { with_phone: false }
|
||||
expect(rendered).to_not have_text('test phone')
|
||||
end
|
||||
end
|
||||
|
||||
address_attributes = %i[street city state zip country]
|
||||
|
||||
context 'when address processing is enabled' do
|
||||
before :example do
|
||||
without_partial_double_verification do
|
||||
allow(view).to receive(:address_processing).and_return(true)
|
||||
end
|
||||
end
|
||||
|
||||
address_attributes.each do |attr_name|
|
||||
it "has #{attr_name}" do
|
||||
allow(registrant).to receive(attr_name).and_return("test #{attr_name}")
|
||||
render template: template_path
|
||||
expect(rendered).to have_text("test #{attr_name}")
|
||||
end
|
||||
end
|
||||
|
||||
it 'has no ident country' do
|
||||
allow(registrant).to receive(:ident_country).and_return('test ident country')
|
||||
render template: template_path
|
||||
expect(rendered).to_not have_text('test ident country')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when address processing is disabled' do
|
||||
before :example do
|
||||
without_partial_double_verification do
|
||||
allow(view).to receive(:address_processing).and_return(false)
|
||||
end
|
||||
end
|
||||
|
||||
address_attributes.each do |attr_name|
|
||||
it "has no #{attr_name}" do
|
||||
allow(registrant).to receive(attr_name).and_return("test #{attr_name}")
|
||||
render template: template_path
|
||||
expect(rendered).to_not have_text("test #{attr_name}")
|
||||
end
|
||||
end
|
||||
|
||||
it 'has ident country' do
|
||||
allow(registrant).to receive(:ident_country).and_return('test ident country')
|
||||
render template: template_path
|
||||
expect(rendered).to have_text('test ident country')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
require 'rails_helper'
|
||||
require_relative 'registrar_shared'
|
||||
|
||||
RSpec.describe 'mailers/shared/registrar/_registrar.en.html.erb' do
|
||||
include_examples 'domain mailer registrar info'
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
require 'rails_helper'
|
||||
require_relative 'registrar_shared'
|
||||
|
||||
RSpec.describe 'mailers/shared/registrar/_registrar.en.text.erb' do
|
||||
include_examples 'domain mailer registrar info'
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
require 'rails_helper'
|
||||
require_relative 'registrar_shared'
|
||||
|
||||
RSpec.describe 'mailers/shared/registrar/_registrar.et.html.erb' do
|
||||
include_examples 'domain mailer registrar info'
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
require 'rails_helper'
|
||||
require_relative 'registrar_shared'
|
||||
|
||||
RSpec.describe 'mailers/shared/registrar/_registrar.et.text.erb' do
|
||||
include_examples 'domain mailer registrar info'
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
require 'rails_helper'
|
||||
require_relative 'registrar_shared'
|
||||
|
||||
RSpec.describe 'mailers/shared/registrar/_registrar.ru.html.erb' do
|
||||
include_examples 'domain mailer registrar info'
|
||||
end
|
|
@ -1,6 +0,0 @@
|
|||
require 'rails_helper'
|
||||
require_relative 'registrar_shared'
|
||||
|
||||
RSpec.describe 'mailers/shared/registrar/_registrar.ru.text.erb' do
|
||||
include_examples 'domain mailer registrar info'
|
||||
end
|
|
@ -1,26 +0,0 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.shared_examples 'domain mailer registrar info' do
|
||||
let(:registrar) { instance_spy(RegistrarPresenter) }
|
||||
|
||||
before :example do
|
||||
without_partial_double_verification do
|
||||
allow(view).to receive(:registrar).and_return(registrar)
|
||||
end
|
||||
end
|
||||
|
||||
attributes = %i(
|
||||
name
|
||||
email
|
||||
phone
|
||||
website
|
||||
)
|
||||
|
||||
attributes.each do |attr_name|
|
||||
it "has #{attr_name}" do
|
||||
expect(registrar).to receive(attr_name).and_return("test #{attr_name}")
|
||||
render
|
||||
expect(rendered).to have_text("test #{attr_name}")
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue