注册测试
This commit is contained in:
parent
bbe7025e2d
commit
230b98d704
|
@ -42,11 +42,10 @@ describe User do
|
|||
# end
|
||||
|
||||
#login长度测试(login最大25字符)
|
||||
describe "when the login is too long" do
|
||||
describe "when the login is too long " do
|
||||
before{@user.login='a'*25}
|
||||
it{should_not be_valid}
|
||||
it{should be_valid}
|
||||
end
|
||||
|
||||
#姓和名的长度测试
|
||||
describe "when the first name is too long " do
|
||||
before{@user.firstname='a'*30}
|
||||
|
@ -73,7 +72,7 @@ describe User do
|
|||
username = %w[jim123 123456 aaaaaa]
|
||||
username.each do |valid_username|
|
||||
@user.login=valid_username
|
||||
expect(@user).not_to be_valid
|
||||
expect(@user).to be_valid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -115,7 +114,22 @@ describe User do
|
|||
#调用相关方法是否能返回期待的结果
|
||||
#userInfo方法,选择项目成员时显示的用户信息的文字
|
||||
describe "returns the user info when choice the members of the project" do
|
||||
|
||||
context "第一种情况" do
|
||||
@user=User.new()
|
||||
expect(@user.userInfo).to eq ''
|
||||
end
|
||||
context "二种情况" do
|
||||
@user=User.new()
|
||||
expect(@user.userInfo).to eq ''
|
||||
end
|
||||
end
|
||||
|
||||
# def name
|
||||
# [firstname, lastname].join(' ')
|
||||
# end
|
||||
# it "returns a contact's full name as a string" do
|
||||
# contact = Contact.new(firstname: 'John', lastname: 'Doe',
|
||||
# email: 'johndoe@example.com')
|
||||
# expect(contact.name).to eq 'John Doe'#调用contact的name方法
|
||||
# end
|
||||
end
|
Loading…
Reference in New Issue