Using RSpec to run some tests, I get the following error:
/spec/requests/booking_applications_spec.rb:13: syntax error, unexpected '\n', expecting => (SyntaxError)
Here's the file:
spec/requests/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.
Ruby cannot parse options hash in the end of method call, it expects smth like
post :create, :booking_id => 1, params => 'something'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With