如果我没理解错的话,以如下形式创建用户不会在数据库中创建记录。
我想创建一个系统测试来遵循这些步骤:
1. 以表格形式报名
2. 访问账户页面
3.更新账户信息
什么技术可以实现上述场景?
within 'form#t-signup-form' do
fill_in 'first_name', with: 'Eve'
fill_in 'last_name', with: 'Farmer'
fill_in 'email', with: 'eve@example.com'
fill_in 'password', with: 'Something'
find('button').click
end
最佳答案
用户记录是否实际提交到数据库取决于您是否使用事务测试。如果您正在使用事务测试,那么记录实际上不会被提交,但这无关紧要,因为(如果配置正确)您的测试和应用程序中的所有内容都应该访问相同的预提交事务,因此会看到记录。做你想做的事
visit signup_path #whatever is the correct route to the page with the signup form
within '#t-signup-form' do
fill_in 'first_name', with: 'Eve'
fill_in 'last_name', with: 'Farmer'
fill_in 'email', with: 'eve@example.com'
fill_in 'password', with: 'Something'
find('button').click
end
assert_content('You are signed up!') # assert for visible change in page that indicates signup has succeeded
visit account_path # route to whatever page you want to go to
... # do whatever actions are required to update the account
关于ruby-on-rails - 注册用户然后访问带有系统测试的帐户页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47603011/