diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-17 12:01:45 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-17 12:01:45 +0100 |
commit | b80bd744ad873f6fc43018bc4bfb90677de167bd (patch) | |
tree | 072c4b0e33d442528555b82c415f5e7a1712b2b0 /test/unit/sip_account_test.rb | |
parent | 3e706c2025ecc5523e81ad649639ef2ff75e7bac (diff) |
Start of GS5.
Diffstat (limited to 'test/unit/sip_account_test.rb')
-rw-r--r-- | test/unit/sip_account_test.rb | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/unit/sip_account_test.rb b/test/unit/sip_account_test.rb new file mode 100644 index 0000000..6595ccc --- /dev/null +++ b/test/unit/sip_account_test.rb @@ -0,0 +1,34 @@ +require 'test_helper' + +class SipAccountTest < ActiveSupport::TestCase + + def test_should_have_a_valid_factory + assert Factory.build(:sip_account).valid? + end + + test "that the value_of_to_s field is filled" do + sip_account = Factory.create(:sip_account) + assert_equal sip_account.value_of_to_s, sip_account.to_s + end + + test "should have a unique auth_name per sip_domain" do + provider_sip_domain = Factory.create(:sip_domain) + tenants = [] + sip_accounts = [] + 2.times { |i| + tenants[i] = provider_sip_domain.tenants.create(Factory.build(:tenant).attributes) + sip_accounts[i] = Factory.build( + :sip_account, + :sip_accountable => tenants[i], + :auth_name => "somerandomauthname", + :tenant_id => tenants[i].id + ) + } + sip_accounts[0].save! + + assert sip_accounts[0].valid? + assert ! sip_accounts[1].valid?, + "Shouldn't be possible to use the same phone number more than once per SIP realm." + end + +end |