summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Gemfile.lock5
-rw-r--r--app/controllers/pager_group_destinations_controller.rb41
-rw-r--r--app/controllers/pager_groups_controller.rb41
-rw-r--r--app/helpers/pager_group_destinations_helper.rb2
-rw-r--r--app/helpers/pager_groups_helper.rb2
-rw-r--r--app/models/pager_group.rb8
-rw-r--r--app/models/pager_group_destination.rb8
-rw-r--r--app/models/sip_account.rb2
-rw-r--r--app/views/pager_group_destinations/_form.html.haml7
-rw-r--r--app/views/pager_group_destinations/_form_core.html.haml3
-rw-r--r--app/views/pager_group_destinations/_index_core.html.haml11
-rw-r--r--app/views/pager_group_destinations/edit.html.haml3
-rw-r--r--app/views/pager_group_destinations/index.html.haml6
-rw-r--r--app/views/pager_group_destinations/new.html.haml3
-rw-r--r--app/views/pager_group_destinations/show.html.haml10
-rw-r--r--app/views/pager_groups/_form.html.haml7
-rw-r--r--app/views/pager_groups/_form_core.html.haml3
-rw-r--r--app/views/pager_groups/_index_core.html.haml11
-rw-r--r--app/views/pager_groups/edit.html.haml3
-rw-r--r--app/views/pager_groups/index.html.haml6
-rw-r--r--app/views/pager_groups/new.html.haml3
-rw-r--r--app/views/pager_groups/show.html.haml10
-rw-r--r--config/locales/views/pager_group_destinations/de.yml45
-rw-r--r--config/locales/views/pager_group_destinations/en.yml45
-rw-r--r--config/locales/views/pager_groups/de.yml45
-rw-r--r--config/locales/views/pager_groups/en.yml45
-rw-r--r--config/routes.rb5
-rw-r--r--db/migrate/20130603150455_create_pager_groups.rb13
-rw-r--r--db/migrate/20130603150603_create_pager_group_destinations.rb13
-rw-r--r--test/functional/pager_group_destinations_controller_test.rb49
-rw-r--r--test/functional/pager_groups_controller_test.rb49
-rw-r--r--test/unit/pager_group_destination_test.rb7
-rw-r--r--test/unit/pager_group_test.rb7
33 files changed, 516 insertions, 2 deletions
diff --git a/Gemfile.lock b/Gemfile.lock
index d133ae6..010c3d1 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -209,8 +209,8 @@ GEM
chronic (>= 0.6.3)
whois (2.7.0)
will_paginate (3.0.4)
- will_paginate-bootstrap (0.2.2)
- will_paginate (>= 3.0.3)
+ will_paginate-bootstrap (0.2.2)
+ will_paginate (>= 3.0.3)
yajl-ruby (1.1.0)
PLATFORMS
@@ -259,3 +259,4 @@ DEPENDENCIES
whenever
whois
will_paginate
+ will_paginate-bootstrap
diff --git a/app/controllers/pager_group_destinations_controller.rb b/app/controllers/pager_group_destinations_controller.rb
new file mode 100644
index 0000000..655054a
--- /dev/null
+++ b/app/controllers/pager_group_destinations_controller.rb
@@ -0,0 +1,41 @@
+class PagerGroupDestinationsController < ApplicationController
+ def index
+ @pager_group_destinations = PagerGroupDestination.all
+ end
+
+ def show
+ @pager_group_destination = PagerGroupDestination.find(params[:id])
+ end
+
+ def new
+ @pager_group_destination = PagerGroupDestination.new
+ end
+
+ def create
+ @pager_group_destination = PagerGroupDestination.new(params[:pager_group_destination])
+ if @pager_group_destination.save
+ redirect_to @pager_group_destination, :notice => t('pager_group_destinations.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @pager_group_destination = PagerGroupDestination.find(params[:id])
+ end
+
+ def update
+ @pager_group_destination = PagerGroupDestination.find(params[:id])
+ if @pager_group_destination.update_attributes(params[:pager_group_destination])
+ redirect_to @pager_group_destination, :notice => t('pager_group_destinations.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @pager_group_destination = PagerGroupDestination.find(params[:id])
+ @pager_group_destination.destroy
+ redirect_to pager_group_destinations_url, :notice => t('pager_group_destinations.controller.successfuly_destroyed')
+ end
+end
diff --git a/app/controllers/pager_groups_controller.rb b/app/controllers/pager_groups_controller.rb
new file mode 100644
index 0000000..4fa21c2
--- /dev/null
+++ b/app/controllers/pager_groups_controller.rb
@@ -0,0 +1,41 @@
+class PagerGroupsController < ApplicationController
+ def index
+ @pager_groups = PagerGroup.all
+ end
+
+ def show
+ @pager_group = PagerGroup.find(params[:id])
+ end
+
+ def new
+ @pager_group = PagerGroup.new
+ end
+
+ def create
+ @pager_group = PagerGroup.new(params[:pager_group])
+ if @pager_group.save
+ redirect_to @pager_group, :notice => t('pager_groups.controller.successfuly_created')
+ else
+ render :new
+ end
+ end
+
+ def edit
+ @pager_group = PagerGroup.find(params[:id])
+ end
+
+ def update
+ @pager_group = PagerGroup.find(params[:id])
+ if @pager_group.update_attributes(params[:pager_group])
+ redirect_to @pager_group, :notice => t('pager_groups.controller.successfuly_updated')
+ else
+ render :edit
+ end
+ end
+
+ def destroy
+ @pager_group = PagerGroup.find(params[:id])
+ @pager_group.destroy
+ redirect_to pager_groups_url, :notice => t('pager_groups.controller.successfuly_destroyed')
+ end
+end
diff --git a/app/helpers/pager_group_destinations_helper.rb b/app/helpers/pager_group_destinations_helper.rb
new file mode 100644
index 0000000..46436dd
--- /dev/null
+++ b/app/helpers/pager_group_destinations_helper.rb
@@ -0,0 +1,2 @@
+module PagerGroupDestinationsHelper
+end
diff --git a/app/helpers/pager_groups_helper.rb b/app/helpers/pager_groups_helper.rb
new file mode 100644
index 0000000..ac8d9fb
--- /dev/null
+++ b/app/helpers/pager_groups_helper.rb
@@ -0,0 +1,2 @@
+module PagerGroupsHelper
+end
diff --git a/app/models/pager_group.rb b/app/models/pager_group.rb
new file mode 100644
index 0000000..861377f
--- /dev/null
+++ b/app/models/pager_group.rb
@@ -0,0 +1,8 @@
+class PagerGroup < ActiveRecord::Base
+ attr_accessible :sip_account_id, :callback_url
+
+ has_many :pager_group_destinations, :dependent => :destroy
+ belongs_to :sip_account
+
+ validates_presence_of :sip_account_id
+end
diff --git a/app/models/pager_group_destination.rb b/app/models/pager_group_destination.rb
new file mode 100644
index 0000000..333d10f
--- /dev/null
+++ b/app/models/pager_group_destination.rb
@@ -0,0 +1,8 @@
+class PagerGroupDestination < ActiveRecord::Base
+ attr_accessible :pager_group_id, :sip_account_id
+
+ belongs_to :pager_group
+
+ validates_presence_of :pager_group_id
+ validates_presence_of :sip_account_id
+end
diff --git a/app/models/sip_account.rb b/app/models/sip_account.rb
index 77fe87a..e4ecfc4 100644
--- a/app/models/sip_account.rb
+++ b/app/models/sip_account.rb
@@ -46,6 +46,8 @@ class SipAccount < ActiveRecord::Base
has_many :voicemail_accounts, :as => :voicemail_accountable, :dependent => :destroy
belongs_to :voicemail_account
+ has_many :pager_groups, :dependent => :destroy
+
# Delegations:
#
delegate :host, :to => :sip_domain, :allow_nil => true
diff --git a/app/views/pager_group_destinations/_form.html.haml b/app/views/pager_group_destinations/_form.html.haml
new file mode 100644
index 0000000..80cb7bb
--- /dev/null
+++ b/app/views/pager_group_destinations/_form.html.haml
@@ -0,0 +1,7 @@
+= simple_form_for(@pager_group_destination) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .form-actions
+ = f.button :submit, conditional_t('pager_group_destinations.form.submit')
diff --git a/app/views/pager_group_destinations/_form_core.html.haml b/app/views/pager_group_destinations/_form_core.html.haml
new file mode 100644
index 0000000..2adae24
--- /dev/null
+++ b/app/views/pager_group_destinations/_form_core.html.haml
@@ -0,0 +1,3 @@
+.inputs
+ = f.input :pager_group_id, :label => t('pager_group_destinations.form.pager_group_id.label'), :hint => conditional_hint('pager_group_destinations.form.pager_group_id.hint')
+ = f.input :sip_account_id, :label => t('pager_group_destinations.form.sip_account_id.label'), :hint => conditional_hint('pager_group_destinations.form.sip_account_id.hint')
diff --git a/app/views/pager_group_destinations/_index_core.html.haml b/app/views/pager_group_destinations/_index_core.html.haml
new file mode 100644
index 0000000..78bf3e5
--- /dev/null
+++ b/app/views/pager_group_destinations/_index_core.html.haml
@@ -0,0 +1,11 @@
+%table.table.table-striped
+ %tr
+ %th= t('pager_group_destinations.index.pager_group_id')
+ %th= t('pager_group_destinations.index.sip_account_id')
+
+
+ - for pager_group_destination in pager_group_destinations
+ %tr
+ %td= pager_group_destination.pager_group_id
+ %td= pager_group_destination.sip_account_id
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => pager_group_destination} \ No newline at end of file
diff --git a/app/views/pager_group_destinations/edit.html.haml b/app/views/pager_group_destinations/edit.html.haml
new file mode 100644
index 0000000..4086329
--- /dev/null
+++ b/app/views/pager_group_destinations/edit.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("pager_group_destinations.edit.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/pager_group_destinations/index.html.haml b/app/views/pager_group_destinations/index.html.haml
new file mode 100644
index 0000000..8072fb7
--- /dev/null
+++ b/app/views/pager_group_destinations/index.html.haml
@@ -0,0 +1,6 @@
+- content_for :title, t("pager_group_destinations.index.page_title")
+
+- if @pager_group_destinations && @pager_group_destinations.count > 0
+ = render "index_core", :pager_group_destinations => @pager_group_destinations
+
+= render :partial => 'shared/create_link', :locals => {:child_class => PagerGroupDestination} \ No newline at end of file
diff --git a/app/views/pager_group_destinations/new.html.haml b/app/views/pager_group_destinations/new.html.haml
new file mode 100644
index 0000000..346911c
--- /dev/null
+++ b/app/views/pager_group_destinations/new.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("pager_group_destinations.new.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/pager_group_destinations/show.html.haml b/app/views/pager_group_destinations/show.html.haml
new file mode 100644
index 0000000..4bc3adb
--- /dev/null
+++ b/app/views/pager_group_destinations/show.html.haml
@@ -0,0 +1,10 @@
+- content_for :title, t("pager_group_destinations.show.page_title")
+
+%p
+ %strong= t('pager_group_destinations.show.pager_group_id') + ":"
+ = @pager_group_destination.pager_group_id
+%p
+ %strong= t('pager_group_destinations.show.sip_account_id') + ":"
+ = @pager_group_destination.sip_account_id
+
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @pager_group_destination } \ No newline at end of file
diff --git a/app/views/pager_groups/_form.html.haml b/app/views/pager_groups/_form.html.haml
new file mode 100644
index 0000000..a9d5782
--- /dev/null
+++ b/app/views/pager_groups/_form.html.haml
@@ -0,0 +1,7 @@
+= simple_form_for(@pager_group) do |f|
+ = f.error_notification
+
+ = render "form_core", :f => f
+
+ .form-actions
+ = f.button :submit, conditional_t('pager_groups.form.submit')
diff --git a/app/views/pager_groups/_form_core.html.haml b/app/views/pager_groups/_form_core.html.haml
new file mode 100644
index 0000000..eeb23d2
--- /dev/null
+++ b/app/views/pager_groups/_form_core.html.haml
@@ -0,0 +1,3 @@
+.inputs
+ = f.input :sip_account_id, :label => t('pager_groups.form.sip_account_id.label'), :hint => conditional_hint('pager_groups.form.sip_account_id.hint')
+ = f.input :callback_url, :label => t('pager_groups.form.callback_url.label'), :hint => conditional_hint('pager_groups.form.callback_url.hint')
diff --git a/app/views/pager_groups/_index_core.html.haml b/app/views/pager_groups/_index_core.html.haml
new file mode 100644
index 0000000..9515bcf
--- /dev/null
+++ b/app/views/pager_groups/_index_core.html.haml
@@ -0,0 +1,11 @@
+%table.table.table-striped
+ %tr
+ %th= t('pager_groups.index.sip_account_id')
+ %th= t('pager_groups.index.callback_url')
+
+
+ - for pager_group in pager_groups
+ %tr
+ %td= pager_group.sip_account_id
+ %td= pager_group.callback_url
+ =render :partial => 'shared/index_view_edit_destroy_part', :locals => {:child => pager_group} \ No newline at end of file
diff --git a/app/views/pager_groups/edit.html.haml b/app/views/pager_groups/edit.html.haml
new file mode 100644
index 0000000..ec71984
--- /dev/null
+++ b/app/views/pager_groups/edit.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("pager_groups.edit.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/pager_groups/index.html.haml b/app/views/pager_groups/index.html.haml
new file mode 100644
index 0000000..455e90e
--- /dev/null
+++ b/app/views/pager_groups/index.html.haml
@@ -0,0 +1,6 @@
+- content_for :title, t("pager_groups.index.page_title")
+
+- if @pager_groups && @pager_groups.count > 0
+ = render "index_core", :pager_groups => @pager_groups
+
+= render :partial => 'shared/create_link', :locals => {:child_class => PagerGroup} \ No newline at end of file
diff --git a/app/views/pager_groups/new.html.haml b/app/views/pager_groups/new.html.haml
new file mode 100644
index 0000000..fbb6ac3
--- /dev/null
+++ b/app/views/pager_groups/new.html.haml
@@ -0,0 +1,3 @@
+- content_for :title, t("pager_groups.new.page_title")
+
+= render "form" \ No newline at end of file
diff --git a/app/views/pager_groups/show.html.haml b/app/views/pager_groups/show.html.haml
new file mode 100644
index 0000000..5e0a8c7
--- /dev/null
+++ b/app/views/pager_groups/show.html.haml
@@ -0,0 +1,10 @@
+- content_for :title, t("pager_groups.show.page_title")
+
+%p
+ %strong= t('pager_groups.show.sip_account_id') + ":"
+ = @pager_group.sip_account_id
+%p
+ %strong= t('pager_groups.show.callback_url') + ":"
+ = @pager_group.callback_url
+
+= render :partial => 'shared/show_edit_destroy_part', :locals => { :child => @pager_group } \ No newline at end of file
diff --git a/config/locales/views/pager_group_destinations/de.yml b/config/locales/views/pager_group_destinations/de.yml
new file mode 100644
index 0000000..7f0d56a
--- /dev/null
+++ b/config/locales/views/pager_group_destinations/de.yml
@@ -0,0 +1,45 @@
+de:
+ pager_group_destinations:
+ name: 'Pagergroupdestination'
+ controller:
+ successfuly_created: 'Pagergroupdestination wurde angelegt.'
+ successfuly_updated: 'Pagergroupdestination wurde aktualisiert.'
+ successfuly_destroyed: 'Pagergroupdestination wurde gelöscht.'
+ index:
+ page_title: 'Übersicht von Pagergroupdestination'
+ pager_group_id: 'Pager group'
+ sip_account_id: 'Sip account'
+ actions:
+ confirm_destroy: 'Sind Sie sicher, dass Sie folgendes löschen möchten: Pagergroupdestination'
+ destroy: 'Löschen'
+ edit: 'Bearbeiten'
+ show: 'Anzeigen'
+ create: 'Neu anlegen'
+ create_for: 'Pagergroupdestination neu anlegen für %{resource}'
+ show:
+ page_title: 'Pagergroupdestination bearbeiten'
+ pager_group_id: 'Pager group'
+ sip_account_id: 'Sip account'
+ actions:
+ confirm_destroy: 'Sind Sie sicher, dass die dieses Element löschen möchten?'
+ destroy: 'Löschen'
+ edit: 'Bearbeiten'
+ view_all: 'Alle anzeigen'
+ new:
+ page_title: 'Pagergroupdestination neu anlegen'
+ actions:
+ back_to_list: 'Zurück zur Übersicht'
+ edit:
+ page_title: 'Pagergroupdestination bearbeiten'
+ actions:
+ back_to_list: 'Zurück zur Übersicht'
+ edit: 'Bearbeiten'
+ view_all: 'Alle anzeigen'
+ form:
+ pager_group_id:
+ label: 'Pager group'
+ hint: ''
+ sip_account_id:
+ label: 'Sip account'
+ hint: ''
+ submit: 'Absenden' \ No newline at end of file
diff --git a/config/locales/views/pager_group_destinations/en.yml b/config/locales/views/pager_group_destinations/en.yml
new file mode 100644
index 0000000..9bf459d
--- /dev/null
+++ b/config/locales/views/pager_group_destinations/en.yml
@@ -0,0 +1,45 @@
+en:
+ pager_group_destinations:
+ name: 'Pagergroupdestination'
+ controller:
+ successfuly_created: 'Successfully created Pagergroupdestination.'
+ successfuly_updated: 'Successfully updated Pagergroupdestination.'
+ successfuly_destroyed: 'Successfully destroyed Pagergroupdestination.'
+ index:
+ page_title: 'Listing Pagergroupdestination'
+ pager_group_id: 'Pager group'
+ sip_account_id: 'Sip account'
+ actions:
+ confirm_destroy: 'Are you sure you want to delete this Pagergroupdestination?'
+ destroy: 'Delete'
+ edit: 'Edit'
+ show: 'View'
+ create: 'New'
+ create_for: 'New Pagergroupdestination for %{resource}'
+ show:
+ page_title: 'Show Pagergroupdestination'
+ pager_group_id: 'Pager group'
+ sip_account_id: 'Sip account'
+ actions:
+ confirm_destroy: 'Are you sure you want to delete this element?'
+ destroy: 'Delete'
+ edit: 'Edit'
+ view_all: 'View All'
+ new:
+ page_title: 'New Pagergroupdestination'
+ actions:
+ back_to_list: 'Back to Index'
+ edit:
+ page_title: 'Editing Pagergroupdestination'
+ actions:
+ back_to_list: 'Back to Index'
+ edit: 'Edit'
+ view_all: 'View All'
+ form:
+ pager_group_id:
+ label: 'Pager group'
+ hint: ''
+ sip_account_id:
+ label: 'Sip account'
+ hint: ''
+ submit: 'Submit' \ No newline at end of file
diff --git a/config/locales/views/pager_groups/de.yml b/config/locales/views/pager_groups/de.yml
new file mode 100644
index 0000000..9865958
--- /dev/null
+++ b/config/locales/views/pager_groups/de.yml
@@ -0,0 +1,45 @@
+de:
+ pager_groups:
+ name: 'Pagergroup'
+ controller:
+ successfuly_created: 'Pagergroup wurde angelegt.'
+ successfuly_updated: 'Pagergroup wurde aktualisiert.'
+ successfuly_destroyed: 'Pagergroup wurde gelöscht.'
+ index:
+ page_title: 'Übersicht von Pagergroup'
+ sip_account_id: 'Sip account'
+ callback_url: 'Callback url'
+ actions:
+ confirm_destroy: 'Sind Sie sicher, dass Sie folgendes löschen möchten: Pagergroup'
+ destroy: 'Löschen'
+ edit: 'Bearbeiten'
+ show: 'Anzeigen'
+ create: 'Neu anlegen'
+ create_for: 'Pagergroup neu anlegen für %{resource}'
+ show:
+ page_title: 'Pagergroup bearbeiten'
+ sip_account_id: 'Sip account'
+ callback_url: 'Callback url'
+ actions:
+ confirm_destroy: 'Sind Sie sicher, dass die dieses Element löschen möchten?'
+ destroy: 'Löschen'
+ edit: 'Bearbeiten'
+ view_all: 'Alle anzeigen'
+ new:
+ page_title: 'Pagergroup neu anlegen'
+ actions:
+ back_to_list: 'Zurück zur Übersicht'
+ edit:
+ page_title: 'Pagergroup bearbeiten'
+ actions:
+ back_to_list: 'Zurück zur Übersicht'
+ edit: 'Bearbeiten'
+ view_all: 'Alle anzeigen'
+ form:
+ sip_account_id:
+ label: 'Sip account'
+ hint: ''
+ callback_url:
+ label: 'Callback url'
+ hint: ''
+ submit: 'Absenden' \ No newline at end of file
diff --git a/config/locales/views/pager_groups/en.yml b/config/locales/views/pager_groups/en.yml
new file mode 100644
index 0000000..f7ce727
--- /dev/null
+++ b/config/locales/views/pager_groups/en.yml
@@ -0,0 +1,45 @@
+en:
+ pager_groups:
+ name: 'Pagergroup'
+ controller:
+ successfuly_created: 'Successfully created Pagergroup.'
+ successfuly_updated: 'Successfully updated Pagergroup.'
+ successfuly_destroyed: 'Successfully destroyed Pagergroup.'
+ index:
+ page_title: 'Listing Pagergroup'
+ sip_account_id: 'Sip account'
+ callback_url: 'Callback url'
+ actions:
+ confirm_destroy: 'Are you sure you want to delete this Pagergroup?'
+ destroy: 'Delete'
+ edit: 'Edit'
+ show: 'View'
+ create: 'New'
+ create_for: 'New Pagergroup for %{resource}'
+ show:
+ page_title: 'Show Pagergroup'
+ sip_account_id: 'Sip account'
+ callback_url: 'Callback url'
+ actions:
+ confirm_destroy: 'Are you sure you want to delete this element?'
+ destroy: 'Delete'
+ edit: 'Edit'
+ view_all: 'View All'
+ new:
+ page_title: 'New Pagergroup'
+ actions:
+ back_to_list: 'Back to Index'
+ edit:
+ page_title: 'Editing Pagergroup'
+ actions:
+ back_to_list: 'Back to Index'
+ edit: 'Edit'
+ view_all: 'View All'
+ form:
+ sip_account_id:
+ label: 'Sip account'
+ hint: ''
+ callback_url:
+ label: 'Callback url'
+ hint: ''
+ submit: 'Submit' \ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 8120e6c..6145765 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,5 +1,9 @@
Gemeinschaft42c::Application.routes.draw do
+ resources :pager_group_destinations
+
+ resources :pager_groups
+
namespace :api, defaults: {format: 'json'} do
namespace :v1 do
resources :switchboards, :only => [:show, :index]
@@ -315,6 +319,7 @@ Gemeinschaft42c::Application.routes.draw do
end
end
resources :voicemail_accounts
+ resources :pager_groups
end
resources :phones, :only => [] do
diff --git a/db/migrate/20130603150455_create_pager_groups.rb b/db/migrate/20130603150455_create_pager_groups.rb
new file mode 100644
index 0000000..c8b2e46
--- /dev/null
+++ b/db/migrate/20130603150455_create_pager_groups.rb
@@ -0,0 +1,13 @@
+class CreatePagerGroups < ActiveRecord::Migration
+ def self.up
+ create_table :pager_groups do |t|
+ t.integer :sip_account_id
+ t.string :callback_url
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :pager_groups
+ end
+end
diff --git a/db/migrate/20130603150603_create_pager_group_destinations.rb b/db/migrate/20130603150603_create_pager_group_destinations.rb
new file mode 100644
index 0000000..427dba0
--- /dev/null
+++ b/db/migrate/20130603150603_create_pager_group_destinations.rb
@@ -0,0 +1,13 @@
+class CreatePagerGroupDestinations < ActiveRecord::Migration
+ def self.up
+ create_table :pager_group_destinations do |t|
+ t.integer :pager_group_id
+ t.integer :sip_account_id
+ t.timestamps
+ end
+ end
+
+ def self.down
+ drop_table :pager_group_destinations
+ end
+end
diff --git a/test/functional/pager_group_destinations_controller_test.rb b/test/functional/pager_group_destinations_controller_test.rb
new file mode 100644
index 0000000..1d1912a
--- /dev/null
+++ b/test/functional/pager_group_destinations_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class PagerGroupDestinationsControllerTest < ActionController::TestCase
+ setup do
+ @pager_group_destination = pager_group_destinations(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:pager_group_destinations)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create pager_group_destination" do
+ assert_difference('PagerGroupDestination.count') do
+ post :create, pager_group_destination: @pager_group_destination.attributes
+ end
+
+ assert_redirected_to pager_group_destination_path(assigns(:pager_group_destination))
+ end
+
+ test "should show pager_group_destination" do
+ get :show, id: @pager_group_destination.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @pager_group_destination.to_param
+ assert_response :success
+ end
+
+ test "should update pager_group_destination" do
+ put :update, id: @pager_group_destination.to_param, pager_group_destination: @pager_group_destination.attributes
+ assert_redirected_to pager_group_destination_path(assigns(:pager_group_destination))
+ end
+
+ test "should destroy pager_group_destination" do
+ assert_difference('PagerGroupDestination.count', -1) do
+ delete :destroy, id: @pager_group_destination.to_param
+ end
+
+ assert_redirected_to pager_group_destinations_path
+ end
+end
diff --git a/test/functional/pager_groups_controller_test.rb b/test/functional/pager_groups_controller_test.rb
new file mode 100644
index 0000000..049ca6c
--- /dev/null
+++ b/test/functional/pager_groups_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class PagerGroupsControllerTest < ActionController::TestCase
+ setup do
+ @pager_group = pager_groups(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:pager_groups)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create pager_group" do
+ assert_difference('PagerGroup.count') do
+ post :create, pager_group: @pager_group.attributes
+ end
+
+ assert_redirected_to pager_group_path(assigns(:pager_group))
+ end
+
+ test "should show pager_group" do
+ get :show, id: @pager_group.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @pager_group.to_param
+ assert_response :success
+ end
+
+ test "should update pager_group" do
+ put :update, id: @pager_group.to_param, pager_group: @pager_group.attributes
+ assert_redirected_to pager_group_path(assigns(:pager_group))
+ end
+
+ test "should destroy pager_group" do
+ assert_difference('PagerGroup.count', -1) do
+ delete :destroy, id: @pager_group.to_param
+ end
+
+ assert_redirected_to pager_groups_path
+ end
+end
diff --git a/test/unit/pager_group_destination_test.rb b/test/unit/pager_group_destination_test.rb
new file mode 100644
index 0000000..cc98606
--- /dev/null
+++ b/test/unit/pager_group_destination_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class PagerGroupDestinationTest < ActiveSupport::TestCase
+ def test_should_be_valid
+ assert PagerGroupDestination.new.valid?
+ end
+end
diff --git a/test/unit/pager_group_test.rb b/test/unit/pager_group_test.rb
new file mode 100644
index 0000000..252ec61
--- /dev/null
+++ b/test/unit/pager_group_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class PagerGroupTest < ActiveSupport::TestCase
+ def test_should_be_valid
+ assert PagerGroup.new.valid?
+ end
+end