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
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
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
@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
@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
#数字のみ
@laws.tel01 = 'abcd'
@laws.should_not be_valid
- #4桁以下
- @laws.tel01 = '12345'
+ #6桁以下
+ @laws.tel01 = '1234567'
@laws.should_not be_valid
end
#数字のみ
@laws.tel02 = 'abcd'
@laws.should_not be_valid
- #4桁以下
- @laws.tel02 = '12345'
+ #6桁以下
+ @laws.tel02 = '1234567'
@laws.should_not be_valid
end
#数字のみ
@laws.tel03 = 'abcd'
@laws.should_not be_valid
- #4桁以下
- @laws.tel03 = '12345'
+ #6桁以下
+ @laws.tel03 = '1234567'
@laws.should_not be_valid
end
#数字のみ
@laws.fax01 = 'abcd'
@laws.should_not be_valid
- #4桁以下
- @laws.fax01 = '12345'
+ #6桁以下
+ @laws.fax01 = '1234567'
@laws.should_not be_valid
end
#数字のみ
@laws.fax02 = 'abcd'
@laws.should_not be_valid
- #4桁以下
- @laws.fax02 = '12345'
+ #6桁以下
+ @laws.fax02 = '1234567'
@laws.should_not be_valid
end
#数字のみ
@laws.fax03 = 'abcd'
@laws.should_not be_valid
- #4桁以下
- @laws.fax03 = '12345'
+ #6桁以下
+ @laws.fax03 = '1234567'
@laws.should_not be_valid
end
@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
@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