我遇到的问题是我正在编写一个rspec功能测试,该测试使用设计对应用程序进行身份验证并创建记录。
当点击提交创建记录时,在重定向时,我退出了我的会话。
我似乎无法在日志文件中找到任何奇怪的内容,我可以使用selenium-webdriver和chromedriver-helper重现此问题。
我想知道是否有其他人遇到过这个问题以及你如何解决它。
我的环境:
规格/支持/ devise.rb
RSpec.configure do |config|
config.include Devise::TestHelpers, type: :controller
config.include Devise::TestHelpers, type: :view
end
规格/特征/笔记/ create_note_spec.rb:
require 'rails_helper'
feature 'note management' do
scenario 'user can create a new note' do
visit root_path
click_link 'Sign In'
fill_in 'user_email', with: user.email
fill_in 'user_password', with: CONFIG[:test_user_password]
click_button 'Log in'
click_link 'Notes'
click_link 'New Note'
fill_in 'note_title', with: Faker::Lorem.word
fill_in 'note_content', with: Faker::Lorem.paragraph
click_button 'Create Note'
expect(page).to have_content 'Note created'
end
end