Rename Contact::address_processing to address_processing?

#251
This commit is contained in:
Artur Beljajev 2016-12-12 04:36:28 +02:00
parent 5af4c585d4
commit 5e1c43f7cc
5 changed files with 7 additions and 7 deletions

View file

@ -17,7 +17,7 @@ module Repp
if params[:details] == 'true' if params[:details] == 'true'
contacts = current_user.registrar.contacts.limit(limit).offset(offset) contacts = current_user.registrar.contacts.limit(limit).offset(offset)
unless Contact.address_processing unless Contact.address_processing?
attributes = Contact.attribute_names - Contact.address_attribute_names attributes = Contact.attribute_names - Contact.address_attribute_names
contacts = contacts.select(attributes) contacts = contacts.select(attributes)
end end

View file

@ -22,7 +22,7 @@ class Epp::ContactsController < EppController
@contact.add_legal_file_to_new(frame) @contact.add_legal_file_to_new(frame)
@response_code = if Contact.address_processing @response_code = if Contact.address_processing?
1000 1000
else else
frame.css('postalInfo addr').size != 0 ? 1100 : 1000 frame.css('postalInfo addr').size != 0 ? 1100 : 1000

View file

@ -258,7 +258,7 @@ class Contact < ActiveRecord::Base
pluck(:email) pluck(:email)
end end
def address_processing def address_processing?
Setting.address_processing Setting.address_processing
end end

View file

@ -23,7 +23,7 @@ RSpec.describe Repp::ContactV1, db: true do
context 'when address processing is enabled' do context 'when address processing is enabled' do
before do before do
expect(Contact).to receive(:address_processing).and_return(true) expect(Contact).to receive(:address_processing?).and_return(true)
get '/repp/v1/contacts', { limit: 1, details: true }, { 'HTTP_AUTHORIZATION' => http_auth_key } get '/repp/v1/contacts', { limit: 1, details: true }, { 'HTTP_AUTHORIZATION' => http_auth_key }
end end
@ -34,7 +34,7 @@ RSpec.describe Repp::ContactV1, db: true do
context 'when address processing is disabled' do context 'when address processing is disabled' do
before do before do
expect(Contact).to receive(:address_processing).and_return(false) expect(Contact).to receive(:address_processing?).and_return(false)
get '/repp/v1/contacts', { limit: 1, details: true }, { 'HTTP_AUTHORIZATION' => http_auth_key } get '/repp/v1/contacts', { limit: 1, details: true }, { 'HTTP_AUTHORIZATION' => http_auth_key }
end end

View file

@ -384,13 +384,13 @@ RSpec.describe Contact, db: false do
end end
end end
describe '::address_processing' do describe '::address_processing?' do
before do before do
Setting.address_processing = 'test' Setting.address_processing = 'test'
end end
it 'returns setting value' do it 'returns setting value' do
expect(described_class.address_processing).to eq('test') expect(described_class.address_processing?).to eq('test')
end end
end end