我是Capybara的新手,一般来说是在Rails上进行测试,所以如果这是一个简单的答案,请原谅我。我有这个测试it"shouldbeabletoeditanassignment"dovisitdashboard_pathselect(@project.client+"-"+@project.name,:from=>"assignment_project_id")select(@team_member.first_name+""+@team_member.last_name,:from=>"assignment_person_id")click_button"Createassignm
我对RSpec一直坚持使用基于xUnit的测试框架有点迷茫,但我正在试一试。规范编写方式的嵌套性质让我有些头疼,因为我应该在哪里进行数据库设置/拆卸。根据DatabaseCleaner自述文件:Spec::Runner.configuredo|config|config.before(:suite)doDatabaseCleaner.strategy=:transactionDatabaseCleaner.clean_with(:truncation)endconfig.before(:each)doDatabaseCleaner.startendconfig.after(:each)
我目前在运行PostgreSQL的Rails项目中使用DatabaseCleaner,并将其设置如下。RSpec.configuredo|config|config.before(:suite)doDatabaseCleaner.clean_with(:truncation,{pre_count:true,reset_ids:true})endconfig.before(:each,js:true)doDatabaseCleaner.strategy=:truncationendconfig.before(:each)doDatabaseCleaner.strategy=:transa