testing - Rspec request specs and Rails 5 -


i'm starting new project, first rails 5.1.0. have pb first request spec.

describe 'users', type: :request   'are created external data'     json_string = file.read('path/to/test_data/user_data.json')     params = { user: json.parse(json_string) }     headers = { "content_type" => "application/json" }      expect       post '/api/v1/users', params.to_s, headers     end.to change {       user.count     }.by(1)      expect(response.status).to eq 200   end end 

this spec return error argumenterror: wrong number of arguments (given 3, expected 1). official documentation don't much.

if take out .to_s, , send hash, this:

post '/api/v1/users', params, headers 

i got error:

argumenterror: unknown keyword: user 

any thought?

i think changed syntax recently. should use keyword args. so, this:

post '/api/v1/users', params: params, headers: headers 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -