OSDN Git Service

電話番号最大桁数チェック変更
authorcho <cho@06daa6dd-5c14-464e-8a85-0d68c524be32>
Wed, 13 Jan 2010 10:04:08 +0000 (10:04 +0000)
committercho <cho@06daa6dd-5c14-464e-8a85-0d68c524be32>
Wed, 13 Jan 2010 10:04:08 +0000 (10:04 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/elecoma/trunk@27 06daa6dd-5c14-464e-8a85-0d68c524be32

app/models/customer.rb
app/models/law.rb
app/models/shop.rb
spec/models/customer_spec.rb
spec/models/laws_spec.rb
spec/models/shop_spec.rb

index 0237c5e..289224d 100644 (file)
@@ -52,10 +52,10 @@ class Customer < ActiveRecord::Base
 
   validates_presence_of :tel01, :tel02, :tel03
   validates_numericality_of :tel01, :tel02, :tel03, :allow_blank => true
-  validates_length_of :tel01, :tel02, :tel03, :maximum => 4, :allow_blank => true
+  validates_length_of :tel01, :tel02, :tel03, :maximum => 6, :allow_blank => true
 
   validates_numericality_of :fax01, :fax02, :fax03, :allow_blank => true
-  validates_length_of :fax01, :fax02, :fax03, :maximum => 4, :allow_blank => true
+  validates_length_of :fax01, :fax02, :fax03, :maximum => 6, :allow_blank => true
 
   validates_inclusion_of :sex, :in => [System::MALE, System::FEMALE], :allow_blank => true
 
index 7c2400a..ac37434 100644 (file)
@@ -11,7 +11,7 @@ class Law < ActiveRecord::Base
 
   validates_length_of :company,:manager,:address_city,:address_detail,:email,:url, :maximum => 50
 
-  validates_length_of :tel01,:tel02,:tel03,:fax01,:fax02,:fax03 , :maximum => 4
+  validates_length_of :tel01,:tel02,:tel03,:fax01,:fax02,:fax03 , :maximum => 6
 
   validates_numericality_of :zipcode01, :zipcode02,:tel01,:tel02,:tel03,:fax01,:fax02,:fax03, :allow_blank => true
 
index e22fc6f..98e19f0 100644 (file)
@@ -25,8 +25,7 @@ class Shop < ActiveRecord::Base
 
   validates_length_of :trade_item,:introduction, :maximum => 99999
 
-  validates_length_of :tel01,:fax01, :maximum => 3
-  validates_length_of :tel02,:tel03, :fax02, :fax03, :maximum => 4
+  validates_length_of :tel01,:tel02,:tel03, :fax01,:fax02, :fax03, :maximum => 6, :allow_blank => true
 
 
   def validate_on_create
index 449ad88..345b3ce 100644 (file)
@@ -181,18 +181,18 @@ describe Customer do
     @customer.should_not be_valid
   end
 
-  it "電話番号1: 4 文字まで" do
-    @customer.tel01 = '12345'
+  it "電話番号1: 6 文字まで" do
+    @customer.tel01 = '1234567'
     @customer.should_not be_valid
   end
 
-  it "電話番号2: 4 文字まで" do
-    @customer.tel02 = '12345'
+  it "電話番号2: 6 文字まで" do
+    @customer.tel02 = '1234567'
     @customer.should_not be_valid
   end
 
-  it "電話番号3: 4 文字まで" do
-    @customer.tel03 = '12345'
+  it "電話番号3: 6 文字まで" do
+    @customer.tel03 = '1234567'
     @customer.should_not be_valid
   end
 
@@ -226,18 +226,18 @@ describe Customer do
     @customer.should_not be_valid
   end
 
-  it "FAX 番号1: 4 文字まで" do
-    @customer.fax01 = '12345'
+  it "FAX 番号1: 6 文字まで" do
+    @customer.fax01 = '1234567'
     @customer.should_not be_valid
   end
 
-  it "FAX 番号2: 4 文字まで" do
-    @customer.fax02 = '12345'
+  it "FAX 番号2: 6 文字まで" do
+    @customer.fax02 = '1234567'
     @customer.should_not be_valid
   end
 
-  it "FAX 番号3: 4 文字まで" do
-    @customer.fax03 = '12345'
+  it "FAX 番号3: 6 文字まで" do
+    @customer.fax03 = '1234567'
     @customer.should_not be_valid
   end
 
index a6ae804..4c3124b 100644 (file)
@@ -105,8 +105,8 @@ describe Law do
       #数字のみ
       @laws.tel01 = 'abcd'
       @laws.should_not be_valid
-      #4桁以下
-      @laws.tel01 = '12345'
+      #6桁以下
+      @laws.tel01 = '1234567'
       @laws.should_not be_valid
     end
     
@@ -117,8 +117,8 @@ describe Law do
       #数字のみ
       @laws.tel02 = 'abcd'
       @laws.should_not be_valid
-      #4桁以下
-      @laws.tel02 = '12345'
+      #6桁以下
+      @laws.tel02 = '1234567'
       @laws.should_not be_valid
     end
     
@@ -129,8 +129,8 @@ describe Law do
       #数字のみ
       @laws.tel03 = 'abcd'
       @laws.should_not be_valid
-      #4桁以下
-      @laws.tel03 = '12345'
+      #6桁以下
+      @laws.tel03 = '1234567'
       @laws.should_not be_valid
     end
     
@@ -141,8 +141,8 @@ describe Law do
       #数字のみ
       @laws.fax01 = 'abcd'
       @laws.should_not be_valid
-      #4桁以下
-      @laws.fax01 = '12345'
+      #6桁以下
+      @laws.fax01 = '1234567'
       @laws.should_not be_valid
     end
     
@@ -153,8 +153,8 @@ describe Law do
       #数字のみ
       @laws.fax02 = 'abcd'
       @laws.should_not be_valid
-      #4桁以下
-      @laws.fax02 = '12345'
+      #6桁以下
+      @laws.fax02 = '1234567'
       @laws.should_not be_valid
     end
     
@@ -165,8 +165,8 @@ describe Law do
       #数字のみ
       @laws.fax03 = 'abcd'
       @laws.should_not be_valid
-      #4桁以下
-      @laws.fax03 = '12345'
+      #6桁以下
+      @laws.fax03 = '1234567'
       @laws.should_not be_valid
     end
     
index 0592f25..a90d471 100644 (file)
@@ -144,14 +144,14 @@ describe Shop do
       @shop.should_not be_valid
     end
     
-    it "TEL01, 02, 03 3-4文字まで" do
+    it "TEL01, 02, 03 6文字まで" do
       @shop.tel01 = '1' * 3
       @shop.tel02 = '1' * 4
       @shop.tel03 = '1' * 4
       @shop.should be_valid
-      @shop.tel01 = '11111'
-      @shop.tel02 = '111111'
-      @shop.tel03 = '111111'
+      @shop.tel01 = '1234567'
+      @shop.tel02 = '1234567'
+      @shop.tel03 = '1234567'
       @shop.should_not be_valid
     end
     
@@ -166,14 +166,14 @@ describe Shop do
       @shop.should_not be_valid
     end
     
-    it "FAX01, 02, 03 3-4 文字まで" do
+    it "FAX01, 02, 03 6 文字まで" do
       @shop.fax01 = '1' * 3
       @shop.fax02 = '1' * 4
       @shop.fax03 = '1' * 4
       @shop.should be_valid
-      @shop.fax01 = '1' * 4
-      @shop.fax02 = '1' * 5
-      @shop.fax02 = '1' * 5
+      @shop.fax01 = '1' * 7
+      @shop.fax02 = '1' * 7
+      @shop.fax02 = '1' * 7
       @shop.should_not be_valid
     end