Capybara发布了发布请求网址的请求规范

时间:2014-06-27 09:45:16

标签: ruby-on-rails ruby ruby-on-rails-4 rspec capybara

我正在用capybara编写Request spec并且无法点击post URL, 这是我的代码

 context 'discounts in api', js: true do
      let(:user) { Fabricate(:user, activated: true) }
      let(:api_token) { user.api_token }
      let(:discount) { Fabricate(:discount_coupon, code: 'Test_Dc', global: true) }

 it 'should be able to add discount coupon' do
        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

但它没有发布请求,有没有办法用capybara点击帖子网址? 我的表单数据只需要api_token。和“api_url_for”只是一个帮手 的 http://api.mydomain:3000

0 个答案:

没有答案