Rspec 3如何测试Flash消息
我想使用rspec测试控制器的动作和Flash消息是否存在。 动作: def create user = Users::User.find_by_email(params[:email]) if user user.send_reset_password_instructions flash[:success] = "Reset password instructions have been sent to #{user.email}." else flash[:alert] = "Can't find user with this email: #{params[:email]}" end redirect_to root_path end 规格: describe "#create" do it "sends reset password instructions if user exists" do post :create, email: …