rspec main theme
...................................................................................................................
# it "when tax not found" do
# @tax.destroy
# get TAX_URL + "#{@tax.id}", headers: @headers
# json_data = json_response(response)
# expect(json_data["errors"]).to eq nil
# expect(response).to have_http_status 404
# end
...................................................................................................................
1. first give url -
get TAX_URL + "#{@tax.id}", headers: @headers
with our without id - request goes through this
with id --- get TAX_URL + "#{@tax.id}", headers: @headers
without id --- get TAX_URL , headers: @headers
2. after this take the response ---
json_data = json_response(response)
3. after that compare the error if any error is there --
expect(json_data["errors"]).to eq nil OR
expect(json_data["errors"]['name'].join("")).to eq "name can't be blank"
4. after that you compare the response ---
...................................................................................................................
...................................................................................................................
...................................................................................................................
Comments
Post a Comment