Rails JSON API testing POST request with PARAMS in JSON

前端 未结 2 1775
甜味超标
甜味超标 2021-01-04 15:57

This is a problem that has been bothering me for some time. I am building an API function that should receive data in json and response in json. My controller tests run fine

2条回答
  •  长情又很酷
    2021-01-04 16:46

    describe '#create' do 
      let(:email) {'andre'}
      let(:attrs) {{email: email}}
      let(:params) {{format: :json, subscription: attrs}}
    
      it "should return an error if there is no correct email" do
        post "/magazine_subscriptions", params
      end
    end
    

提交回复
热议问题