0

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.

Anand Kumar
  • 227
  • 1
  • 4
  • 8

1 Answers1

0

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?

Community
  • 1
  • 1
Phil Dudley
  • 326
  • 3
  • 4