ruby on rails - Capybara issues with request specs for post request url -
i writing request spec capybara , having trouble hit post url, here code
context 'discounts in api', js: true let(:user) { fabricate(:user, activated: true) } let(:api_token) { user.api_token } let(:discount) { fabricate(:discount_coupon, code: 'test_dc', global: true) } 'should able add discount coupon' visit api_url_for("/v1/discount_coupons/#{discount.id}/add", api_token) save_screenshot("tmp/capybara/screenshot-#{time::now.strftime('%y%m%d%h%m%s%n')}.png") save_and_open_page expect(response).to have_text('true') end end
but fails post request, there way hit post url capybara ? form data need api_token. , "api_url_for
" helper go @ http://api.mydomain:3000
Comments
Post a Comment