我在Rspec中有以下内容
response.should redirect_to %r{\A/my_settings/mysub_path/}
我收到以下错误
NoMethodError: undefined method `model_name' for Regexp:Class
我只需要匹配包含my_settings/mysub_path的路径的一部分.如何在rspec中实现这一目标?
要检查正则表达式的重定向,请在response.location上执行字符串匹配,如下所示:
expect(response.location).to match('your_expected_location.com')