|
71 | 71 | end
|
72 | 72 | end
|
73 | 73 |
|
| 74 | + context ".rand_surname" do |
| 75 | + it "should return a random surname" do |
| 76 | + described_class::Surnames.should include(described_class.rand_surname) |
| 77 | + end |
| 78 | + end |
| 79 | + |
| 80 | + context ".rand_name" do |
| 81 | + it "should return a random name" do |
| 82 | + names = described_class::Names_Female + described_class::Names_Male |
| 83 | + names.should include(described_class.rand_name) |
| 84 | + end |
| 85 | + end |
| 86 | + |
| 87 | + context ".rand_name_female" do |
| 88 | + it "should return a random female name" do |
| 89 | + described_class::Names_Female.should include(described_class.rand_name_female) |
| 90 | + end |
| 91 | + end |
| 92 | + |
| 93 | + context ".rand_name_male" do |
| 94 | + it "should return a random male name" do |
| 95 | + described_class::Names_Male.should include(described_class.rand_name_male) |
| 96 | + end |
| 97 | + end |
| 98 | + |
| 99 | + context ".rand_mail_address" do |
| 100 | + it "should return a random mail address" do |
| 101 | + names = described_class::Names_Female + described_class::Names_Male |
| 102 | + surnames = described_class::Surnames |
| 103 | + tlds = described_class::TLDs |
| 104 | + |
| 105 | + # XXX: This is kinda dirty |
| 106 | + mail_address = described_class.rand_mail_address.split("@").map { |x| x.split(".") } |
| 107 | + name, surname = mail_address.first.first, mail_address.first.last |
| 108 | + domain, tld = "example", mail_address.last.last # Poor man's stubbing to preserve TLD |
| 109 | + |
| 110 | + names.should include(name) |
| 111 | + surnames.should include(surname) |
| 112 | + domain.should eq("example") |
| 113 | + tlds.should include(tld) |
| 114 | + end |
| 115 | + end |
| 116 | + |
74 | 117 | end
|
75 | 118 | end
|
76 | 119 |
|
0 commit comments