简体   繁体   中英

rails cucumber paths.rb

I have this, when i do rake routes

admin_pdf_templates GET /admin/pdf_templates(.:format) {:controller=>"admin/pdf_templates", :action=>"show"} PUT /admin/pdf_templates(.:format) {:controller=>"admin/pdf_templates", :action=>"update"} DELETE /admin/pdf_templates(.:format) {:controller=>"admin/pdf_templates", :action=>"destroy"} POST /admin/pdf_templates(.:format) {:controller=>"admin/pdf_templates", :action=>"create"}

what will be be path for create action in paths.rb in cucumber.

My paths.rb is when /create pdf/ admin_pdf_templates_path(:id => @user.id)

above path calls GET method . How do i call POST method in paths.rb in cucumber.

You'll want to describe the steps the user will have to take in order make the post request rather than explicitly making it.

For example.

Given I am on the new item form
When I fill out the form
Then I should see the new item. 

You would then define that When step

fill_in 'Name' :with => 'My Name'
click_button 'Submit'

The click is what would trigger the post.

If there is no interface to test this interaction then perhaps you should not be using cucumber.

If you insist on making the post request without a user triggering it this topic looks similar.

How do you POST to a URL in Capybara?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM