action_item.feature 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. Feature: Action Item
  2. Creating and Configuring action items
  3. Background:
  4. Given I am logged in
  5. And a post with the title "Hello World" exists
  6. Scenario: Create an member action
  7. Given a configuration of:
  8. """
  9. ActiveAdmin.register Post do
  10. action_item do
  11. link_to "Embiggen", '/'
  12. end
  13. end
  14. """
  15. When I am on the index page for posts
  16. Then I should not see a member link to "Embiggen"
  17. When I follow "View"
  18. Then I should see an action item link to "Embiggen"
  19. When I follow "Edit Post"
  20. Then I should see an action item link to "Embiggen"
  21. When I am on the index page for posts
  22. When I follow "New Post"
  23. Then I should see an action item link to "Embiggen"
  24. Scenario: Create an member action with if clause that returns true
  25. Given a configuration of:
  26. """
  27. ActiveAdmin.register Post do
  28. action_item :if => proc{ !current_active_admin_user.nil? } do
  29. link_to "Embiggen", '/'
  30. end
  31. end
  32. """
  33. When I am on the index page for posts
  34. Then I should not see a member link to "Embiggen"
  35. When I follow "View"
  36. Then I should see an action item link to "Embiggen"
  37. When I follow "Edit Post"
  38. Then I should see an action item link to "Embiggen"
  39. When I am on the index page for posts
  40. When I follow "New Post"
  41. Then I should see an action item link to "Embiggen"
  42. Scenario: Create an member action with if clause that returns false
  43. Given a configuration of:
  44. """
  45. ActiveAdmin.register Post do
  46. action_item :if => proc{ current_active_admin_user.nil? } do
  47. link_to "Embiggen", '/'
  48. end
  49. end
  50. """
  51. When I am on the index page for posts
  52. Then I should not see a member link to "Embiggen"
  53. When I follow "View"
  54. Then I should not see an action item link to "Embiggen"
  55. When I follow "Edit Post"
  56. Then I should not see an action item link to "Embiggen"
  57. When I am on the index page for posts
  58. When I follow "New Post"
  59. Then I should not see an action item link to "Embiggen"