sti_resource.feature 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. Feature: STI Resource
  2. Ensure that standard CRUD works with STI models
  3. Background:
  4. Given I am logged in
  5. And a configuration of:
  6. """
  7. ActiveAdmin.register Publisher
  8. ActiveAdmin.register User
  9. """
  10. Scenario: Create, update and delete a child STI resource
  11. Given I am on the index page for publishers
  12. When I follow "New Publisher"
  13. And I fill in "First name" with "Terry"
  14. And I fill in "Last name" with "Fox"
  15. And I fill in "Username" with "terry_fox"
  16. And I press "Create Publisher"
  17. Then I should see "Publisher was successfully created"
  18. And I should see "Terry"
  19. When I follow "Edit Publisher"
  20. And I fill in "First name" with "Joe"
  21. And I press "Update Publisher"
  22. Then I should see "Publisher was successfully updated"
  23. And I should see "Joe"
  24. When I follow "Delete Publisher"
  25. Then I should see "Publisher was successfully destroyed"
  26. Scenario: Create, update and delete a parent STI resource
  27. Given I am on the index page for users
  28. When I follow "New User"
  29. And I fill in "First name" with "Terry"
  30. And I fill in "Last name" with "Fox"
  31. And I fill in "Username" with "terry_fox"
  32. And I press "Create User"
  33. Then I should see "User was successfully created"
  34. And I should see "Terry"
  35. When I follow "Edit User"
  36. And I fill in "First name" with "Joe"
  37. And I press "Update User"
  38. Then I should see "User was successfully updated"
  39. And I should see "Joe"
  40. When I follow "Delete User"
  41. Then I should see "User was successfully destroyed"
  42. Scenario: Update and delete a child STI when the parent is registered
  43. Given a publisher named "Terry Fox" exists
  44. And I am on the index page for users
  45. When I follow "Edit"
  46. And I fill in "First name" with "Joe"
  47. And I press "Update Publisher"
  48. Then I should see "Publisher was successfully updated"
  49. And I should see "Joe"
  50. When I follow "Delete User"
  51. Then I should see "Publisher was successfully destroyed"