-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e080d69
commit 96011fd
Showing
11 changed files
with
60 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
class PersonalGenderList < ApplicationRecord | ||
validates :jenis_kelamin, presence: true, length: {minimum: 4, maximum: 10}, uniqueness: true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
class PersonalReligionList < ApplicationRecord | ||
validates :agama, presence: true, length: {minimum: 4, maximum: 20}, uniqueness: true | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
|
||
#one: | ||
# jenis_kelamin: MyString | ||
one: | ||
jenis_kelamin: MyString | ||
|
||
#two: | ||
# jenis_kelamin: MyString | ||
two: | ||
jenis_kelamin: MyString |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html | ||
|
||
#one: | ||
# agama: MyString | ||
one: | ||
agama: MyString | ||
|
||
#two: | ||
# agama: MyString | ||
two: | ||
agama: MyString |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
require "test_helper" | ||
|
||
class PersonalGenderListTest < ActiveSupport::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
def setup | ||
@gender = PersonalGenderList.new(jenis_kelamin: "Laki-laki") | ||
end | ||
test "should accept for right information" do | ||
assert @gender.valid? | ||
end | ||
test "should reject for blank gender" do | ||
@gender.jenis_kelamin = " " | ||
assert_not @gender.valid? | ||
end | ||
test "should reject for non unique gender" do | ||
@gender.jenis_kelamin = personal_gender_lists(:one) | ||
assert_not @gender.valid? | ||
end | ||
test "should reject for too long gender" do | ||
@gender.jenis_kelamin = "a" * 11 | ||
assert_not @gender.valid? | ||
end | ||
test "should reject for too short gender" do | ||
@gender.jenis_kelamin = "a" * 3 | ||
assert_not @gender.valid? | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
require "test_helper" | ||
|
||
class PersonalReligionListTest < ActiveSupport::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
def setup | ||
@religion = PersonalReligionList.new(agama: 'protestan') | ||
end | ||
test "should accept the religion list" do | ||
assert @religion.valid? | ||
end | ||
test "should reject religion if it too short" do | ||
@religion.agama ='a'*3 | ||
assert_not @religion.valid? | ||
end | ||
test "should reject religion if too long" do | ||
@religion.agama = 'a'*21 | ||
assert_not @religion.valid? | ||
end | ||
test "should reject duplicate religion" do | ||
@religion.agama = personal_religion_lists(:one) | ||
assert_not @religion.valid? | ||
end | ||
test "should reject an empty religion" do | ||
@religion.agama ='' | ||
assert_not @religion.valid? | ||
end | ||
end |