summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/factories/phone_number_ranges.rb2
-rw-r--r--test/functional/gs_parameters_controller_test.rb49
-rw-r--r--test/unit/callthrough_test.rb10
-rw-r--r--test/unit/conference_test.rb6
-rw-r--r--test/unit/gs_parameter_test.rb7
-rw-r--r--test/unit/phone_number_test.rb2
6 files changed, 66 insertions, 10 deletions
diff --git a/test/factories/phone_number_ranges.rb b/test/factories/phone_number_ranges.rb
index 68d9a03..306fdee 100644
--- a/test/factories/phone_number_ranges.rb
+++ b/test/factories/phone_number_ranges.rb
@@ -2,7 +2,7 @@
FactoryGirl.define do
factory :phone_number_range do
- name INTERNAL_EXTENSIONS
+ name 'internal_extensions'
association :phone_number_rangeable, :factory => :tenant
end
end
diff --git a/test/functional/gs_parameters_controller_test.rb b/test/functional/gs_parameters_controller_test.rb
new file mode 100644
index 0000000..a0e498a
--- /dev/null
+++ b/test/functional/gs_parameters_controller_test.rb
@@ -0,0 +1,49 @@
+require 'test_helper'
+
+class GsParametersControllerTest < ActionController::TestCase
+ setup do
+ @gs_parameter = gs_parameters(:one)
+ end
+
+ test "should get index" do
+ get :index
+ assert_response :success
+ assert_not_nil assigns(:gs_parameters)
+ end
+
+ test "should get new" do
+ get :new
+ assert_response :success
+ end
+
+ test "should create gs_parameter" do
+ assert_difference('GsParameter.count') do
+ post :create, gs_parameter: @gs_parameter.attributes
+ end
+
+ assert_redirected_to gs_parameter_path(assigns(:gs_parameter))
+ end
+
+ test "should show gs_parameter" do
+ get :show, id: @gs_parameter.to_param
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get :edit, id: @gs_parameter.to_param
+ assert_response :success
+ end
+
+ test "should update gs_parameter" do
+ put :update, id: @gs_parameter.to_param, gs_parameter: @gs_parameter.attributes
+ assert_redirected_to gs_parameter_path(assigns(:gs_parameter))
+ end
+
+ test "should destroy gs_parameter" do
+ assert_difference('GsParameter.count', -1) do
+ delete :destroy, id: @gs_parameter.to_param
+ end
+
+ assert_redirected_to gs_parameters_path
+ end
+end
diff --git a/test/unit/callthrough_test.rb b/test/unit/callthrough_test.rb
index c1c6ab3..5764c0d 100644
--- a/test/unit/callthrough_test.rb
+++ b/test/unit/callthrough_test.rb
@@ -30,7 +30,7 @@ class CallthroughTest < ActiveSupport::TestCase
@gemeinschaft_setup.save
super_tenant = Tenant.create(
- :name => SUPER_TENANT_NAME,
+ :name => GsParameter.get('SUPER_TENANT_NAME'),
:country_id => @gemeinschaft_setup.country.id,
:language_id => @gemeinschaft_setup.language_id,
:description => I18n.t('gemeinschaft_setups.initial_setup.super_tenant_description'),
@@ -94,14 +94,14 @@ class CallthroughTest < ActiveSupport::TestCase
# Check the amount of phone_numbers
#
- assert_equal 11, @tenant.phone_number_ranges.find_by_name(INTERNAL_EXTENSIONS).phone_numbers.count
- assert_equal 12, @tenant.phone_number_ranges.find_by_name(DIRECT_INWARD_DIALING_NUMBERS).phone_numbers.count
+ assert_equal 11, @tenant.phone_number_ranges.find_by_name(GsParameter.get('INTERNAL_EXTENSIONS')).phone_numbers.count
+ assert_equal 12, @tenant.phone_number_ranges.find_by_name(GsParameter.get('DIRECT_INWARD_DIALING_NUMBERS')).phone_numbers.count
end
test 'that a callthrough can only be created with at least one DID' do
assert_equal 0, Callthrough.count
- did = @tenant.phone_number_ranges.find_by_name(DIRECT_INWARD_DIALING_NUMBERS).phone_numbers.first
+ did = @tenant.phone_number_ranges.find_by_name(GsParameter.get('DIRECT_INWARD_DIALING_NUMBERS')).phone_numbers.first
callthrough = @tenant.callthroughs.build
@@ -118,7 +118,7 @@ class CallthroughTest < ActiveSupport::TestCase
# test 'that one DID can not be used by two different callthroughs' do
# assert_equal 0, Callthrough.count
- # did = @tenant.phone_number_ranges.find_by_name(DIRECT_INWARD_DIALING_NUMBERS).phone_numbers.first
+ # did = @tenant.phone_number_ranges.find_by_name(GsParameter.get('DIRECT_INWARD_DIALING_NUMBERS')).phone_numbers.first
# callthroughs = Array.new
# (1..2).each do |i|
diff --git a/test/unit/conference_test.rb b/test/unit/conference_test.rb
index 85f7ddb..e7c05c9 100644
--- a/test/unit/conference_test.rb
+++ b/test/unit/conference_test.rb
@@ -29,16 +29,16 @@ class ConferenceTest < ActiveSupport::TestCase
assert conference.valid?
- (MINIMUM_PIN_LENGTH - 1).times do |i|
+ (GsParameter.get('MINIMUM_PIN_LENGTH') - 1).times do |i|
pin = "#{10**i}"
conference.pin = pin
assert !conference.valid?
end
- conference.pin = "#{10**(MINIMUM_PIN_LENGTH - 1)}"
+ conference.pin = "#{10**(GsParameter.get('MINIMUM_PIN_LENGTH') - 1)}"
assert conference.valid?
- conference.pin = "-#{10**(MINIMUM_PIN_LENGTH - 1)}"
+ conference.pin = "-#{10**(GsParameter.get('MINIMUM_PIN_LENGTH') - 1)}"
assert !conference.valid?
conference.pin = 'Teststring'
diff --git a/test/unit/gs_parameter_test.rb b/test/unit/gs_parameter_test.rb
new file mode 100644
index 0000000..2e3793a
--- /dev/null
+++ b/test/unit/gs_parameter_test.rb
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class GsParameterTest < ActiveSupport::TestCase
+ def test_should_be_valid
+ assert GsParameter.new.valid?
+ end
+end
diff --git a/test/unit/phone_number_test.rb b/test/unit/phone_number_test.rb
index 3fd92d6..c991b0f 100644
--- a/test/unit/phone_number_test.rb
+++ b/test/unit/phone_number_test.rb
@@ -200,7 +200,7 @@ class PhoneNumberTest < ActiveSupport::TestCase
# create a tenant
tenant = FactoryGirl.create(:tenant, :country_id => germany.id)
# create some extensions
- internal_extension_range = tenant.phone_number_ranges.create(:name => INTERNAL_EXTENSIONS)
+ internal_extension_range = tenant.phone_number_ranges.create(:name => GsParameter.get('INTERNAL_EXTENSIONS'))
['2000', '2001', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '5', '99'].each do |extension|
internal_extension_range.phone_numbers.create(:name => "Extension #{extension}", :number => extension)
end