Skip to content

Commit

Permalink
Merge pull request #379 from dmitry-sinina/1.7.9
Browse files Browse the repository at this point in the history
1.7.9
  • Loading branch information
dmitry-sinina committed Oct 2, 2018
2 parents a7889d4 + bd1850c commit 2cd3e56
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 10 deletions.
2 changes: 2 additions & 0 deletions app/admin/equipment/gateways.rb
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,8 @@ def resource_params
end if s.allow_termination?

end

active_admin_comments
end

sidebar :links, only: [:show, :edit] do
Expand Down
2 changes: 1 addition & 1 deletion app/admin/equipment/lnp_database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

member_action :test, method: :post do
begin
lrn=Lnp::Database.find(resource)
lrn=Lnp::Database.find(resource.id)
r=lrn.test_db(params['dst']['dst']) if lrn.present?
flash[:notice] = "Database: #{lrn.name} Destination: #{params['dst']['dst']} LRN: #{r.lrn}, TAG: #{r.tag}"
rescue StandardError => e
Expand Down
2 changes: 1 addition & 1 deletion app/admin/routing/destinations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
{
enabled: boolean_select,
prefix: 'text',
routing_tag_mode: Routing::RoutingTag.pluck(:name, :id),
routing_tag_mode_id: Routing::RoutingTagMode.pluck(:name,:id),
reject_calls: boolean_select,
quality_alarm: boolean_select,
rateplan_id: Rateplan.pluck(:name, :id),
Expand Down
2 changes: 1 addition & 1 deletion app/admin/routing/dialpeers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{
enabled: boolean_select,
prefix: 'text',
routing_tag_mode: Routing::RoutingTag.pluck(:name, :id),
routing_tag_mode_id: Routing::RoutingTagMode.pluck(:name,:id),
routing_group_id: RoutingGroup.pluck(:name, :id),
priority: 'text',
force_hit_rate: 'text',
Expand Down
6 changes: 5 additions & 1 deletion app/resources/api/rest/admin/account_resource.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
class Api::Rest::Admin::AccountResource < ::BaseResource
attributes :name, :min_balance, :max_balance, :external_id,
attributes :name,
:balance, :min_balance, :max_balance,
:balance_low_threshold, :balance_high_threshold, :send_balance_notifications_to,
:external_id, :uuid,
:origination_capacity, :termination_capacity, :send_invoices_to

has_one :contractor
Expand All @@ -24,6 +26,8 @@ def send_balance_notifications_to=(value)
def self.updatable_fields(_context)
[
:name,
:uuid,
:external_id,
:min_balance,
:max_balance,
:balance_low_threshold,
Expand Down
28 changes: 22 additions & 6 deletions spec/controllers/api/rest/admin/accounts_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,15 @@
it { expect(response_data['id']).to eq(account.id.to_s) }
it 'has balance threshold attributes' do
expect(response_data['attributes']).to include(
'name',
'balance','min-balance', 'max-balance',
'uuid',
'external-id',
'origination-capacity', 'termination-capacity', 'send-invoices-to',
'balance-low-threshold',
'balance-high-threshold',
'send-balance-notifications-to')
'send-balance-notifications-to'
)
end
end

Expand All @@ -63,13 +69,17 @@
context 'when attributes are valid' do
let(:attributes) do
{
name: 'name',
name: 'name',
'min-balance': 1,
'external-id': 100,
'uuid': '29161666-c29c-11e8-a11d-a088b4454590',
'max-balance': 10,
'balance-low-threshold': 90,
'balance-high-threshold': 95,
'send-balance-notifications-to': Array.wrap(Billing::Contact.collection.first.id)
'send-balance-notifications-to': Array.wrap(Billing::Contact.collection.first.id),
'send-invoices-to': Billing::Contact.collection.first.id,
'origination-capacity': 10,
'termination-capacity': 3
}
end

Expand Down Expand Up @@ -106,10 +116,16 @@
let(:attributes) do
{
name: 'name',
'external-id': 110,
'uuid': '5d24297a-c29c-11e8-a11d-a088b4454590',
'min-balance': -100,
'max-balance': 100,
'balance-low-threshold': 90,
'balance-high-threshold': 95,
'send-balance-notifications-to': Billing::Contact.collection.first.id,
'send-invoices-to': Billing::Contact.collection.first.id
'send-invoices-to': Billing::Contact.collection.first.id,
'origination-capacity': 10,
'termination-capacity': 3
}
end

Expand All @@ -125,10 +141,10 @@
end

context 'when attributes are not updatable' do
let(:attributes) { { 'external-id': 200 } }
let(:attributes) { { 'balance': 2100.2 } }

it { expect(response.status).to eq(400) }
it { expect(account.reload.external_id).to_not eq(200) }
it { expect(account.reload.external_id).to_not eq(2100.2) }
end
end

Expand Down

0 comments on commit 2cd3e56

Please sign in to comment.