我正在处理Rails API Tutorial并面临错误。每当我运行测试时,我都会
1) Api::V1::UsersController PUT/PATCH #update when is not created
Failure/Error: it { should respond_with 422 }
NoMethodError:
undefined method `respond_with' for #<RSpec::ExampleGroups::ApiV1UsersController::PUTPATCH
Update::WhenIsNotCreated:0x007f860e070eb8>
Did you mean? respond_to
答案 0 :(得分:2)
如上所述here,请尝试以下方法:
it { should respond_with 422 }
而不是
// Doing this reads inputStream for the first time
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
while ((line = br.readLine()) != null) {
sb.append(line);
}
// Doing this reads inputStream for the second time, resulting in the error
InputStream is = new BufferedInputStream(inputStream);
Image image = ImageIO.read(is);