[英]syntax error, unexpected '\n', expecting => (SyntaxError)
Using RSpec to run some tests, I get the following error: 使用RSpec运行一些测试,我得到以下错误:
/spec/requests/booking_applications_spec.rb:13: syntax error, unexpected '\n', expecting => (SyntaxError)
Here's the file: 这是文件:
spec/requests/booking_applications_spec.rb: 规格/要求/booking_applications_spec.rb:
require 'spec_helper'
require "rails_helper"
RSpec.describe "Booking applications", :type => :request do
describe "POST new booking application" do
it "creates a new booking application" do
BookingApplication.destroy_all
BookingApplication.count.should == 0
params = { format: :json, booking_application: { driver_id: 1 } } #Error
post :create, :booking_id => 1, params
BookingApplication.count.should == 1
response.status.should eq(200)
end
end
end
Your error seem to be in the next line: 您的错误似乎在下一行:
post :create, :booking_id => 1, params
You need to change it to: 您需要将其更改为:
post :create, params.merge(booking_id: 1)
Or include booking_id: 1
in params at once. 或在参数中同时包含
booking_id: 1
。
Ruby cannot parse options hash in the end of method call, it expects smth like Ruby无法在方法调用结束时解析选项哈希,它期望像
post :create, :booking_id => 1, params => 'something'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.