Fix typo in administered_domains method name

This commit is contained in:
Maciej Szlosarczyk 2018-08-27 09:12:47 +03:00
parent fc2a4eaa9b
commit d725960403
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
3 changed files with 4 additions and 4 deletions

View file

@ -35,7 +35,7 @@ module Api
end end
def authorized_to_manage_locks? def authorized_to_manage_locks?
return if current_user.administrated_domains.include?(@domain) return if current_user.administered_domains.include?(@domain)
render json: { errors: [ render json: { errors: [
{ base: ['Only administrative contacts can manage registry locks'] } { base: ['Only administrative contacts can manage registry locks'] }

View file

@ -28,7 +28,7 @@ class RegistrantUser < User
# In Rails 5, can be replaced with a much simpler `or` query method and the raw SQL parts can be # In Rails 5, can be replaced with a much simpler `or` query method and the raw SQL parts can be
# removed. # removed.
# https://guides.rubyonrails.org/active_record_querying.html#or-conditions # https://guides.rubyonrails.org/active_record_querying.html#or-conditions
def administrated_domains def administered_domains
domains_where_is_administrative_contact = begin domains_where_is_administrative_contact = begin
Domain.joins(:domain_contacts) Domain.joins(:domain_contacts)
.where(domain_contacts: { contact_id: contacts, type: [AdminDomainContact] }) .where(domain_contacts: { contact_id: contacts, type: [AdminDomainContact] })

View file

@ -19,8 +19,8 @@ class RegistrantUserTest < ActiveSupport::TestCase
refute(domain_names.include?('shop.test')) refute(domain_names.include?('shop.test'))
end end
def test_administrated_domains_returns_a_list_of_domains def test_administered_domains_returns_a_list_of_domains
domain_names = @user.administrated_domains.pluck(:name) domain_names = @user.administered_domains.pluck(:name)
assert_equal(3, domain_names.length) assert_equal(3, domain_names.length)
# User is a tech contact for the domain. # User is a tech contact for the domain.