-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix RoutingGroupDuplication at 1.7 branch (#410)
* fix RoutingGroupDuplication. refs #408
- Loading branch information
1 parent
c686fda
commit 2164e94
Showing
3 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Copy Routing group action', type: :feature do | ||
include_context :login_as_admin | ||
|
||
context 'success' do | ||
|
||
let!(:routing_group) do | ||
create(:routing_group).reload # after_save | ||
end | ||
|
||
let(:new_name) { routing_group.name + '_copy' } | ||
|
||
before { visit routing_group_path(routing_group.id) } | ||
|
||
before do | ||
click_link('Copy', exact_text: true) | ||
within '#new_routing_group' do | ||
fill_in('routing_group_name', with: new_name) | ||
end | ||
end | ||
|
||
subject do | ||
find('input[type=submit]').click | ||
find('h3', text: 'Routing Group Details') # wait page reload | ||
end | ||
|
||
it 'creates new Routing group with identical fields, except name' do | ||
subject | ||
expect(routing_group.dialpeers.count).to eq(0) | ||
expect(RoutingGroup.count).to eq(2) | ||
expect(RoutingGroup.last).to have_attributes( | ||
name: new_name | ||
) | ||
end | ||
|
||
|
||
end | ||
|
||
end |
39 changes: 39 additions & 0 deletions
39
spec/features/routing_groups/copy_routing_group_with_dialpeers_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
require 'spec_helper' | ||
|
||
describe 'Copy Routing group with dialpeers action', type: :feature do | ||
include_context :login_as_admin | ||
|
||
|
||
let!(:routing_group) do | ||
create(:routing_group) | ||
end | ||
|
||
before do | ||
create_list(:dialpeer, 2, routing_group: routing_group) | ||
end | ||
|
||
let(:new_name) { routing_group.name + '_copy' } | ||
|
||
before { visit routing_group_path(routing_group.id) } | ||
|
||
before do | ||
click_link('Copy with dialpeers', exact_text: true) | ||
within '#new_routing_routing_group_duplicator' do | ||
fill_in('Name', with: new_name) | ||
find('input[type=submit]').click | ||
end | ||
#find('h2', text: 'Dialpeers') # wait page load | ||
end | ||
|
||
|
||
it 'creates new Routing group with duplicated Dialpeers' do | ||
expect(page).to have_css('.flash_notice', text: 'Routing group duplicator was successfully created.') | ||
|
||
expect(routing_group.reload.dialpeers.count).to eq(2) | ||
expect(RoutingGroup.count).to eq(2) | ||
expect(RoutingGroup.last.dialpeers.count).to eq(2) | ||
end | ||
|
||
|
||
|
||
end |