Guest User

Untitled

a guest
Oct 22nd, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.13 KB | None | 0 0
  1. @docs
  2. Feature: Action Exchange Rule Logic
  3. As a user
  4. I want to apply action exchange rules for points exchange
  5. So that users can have more points
  6.  
  7. Background:
  8. Given client group "Pepsi" exists
  9. And client group "Pepsi" has a client "7UP"
  10. And user "u1" exists with password: "secret", password_confirmation: "secret", email: "user@test.test", client: client "7UP"
  11. And user "u2" exists with password: "secret", password_confirmation: "secret", email: "user2@test.test", client: client "7UP"
  12. And I am signed in as user using email: "user@test.test", password: "secret"
  13. And client "7UP" has a campaign "refresh"
  14. And campaign "refresh" has competition template "ct1"
  15. And competition round template "crt1" exists
  16. And point system template "pst1" exists with name: "User", ownership: "user", ownership_scope: "client", client: client "7UP"
  17. And point system template "pst2" exists with name: "User", ownership: "user", ownership_scope: "campaign", campaign: campaign "refresh", client: client "7UP"
  18. And point system template "pst3" exists with name: "User", ownership: "user", ownership_scope: "competition", competition_template: competition template "ct1", client: client "7UP"
  19. And point system template "pst4" exists with name: "User", ownership: "user", ownership_scope: "competition_rounds", array_competition_round_template_uuids: "[crt1]", client: client "7UP"
  20. And campaign "refresh" has entry template "et1"
  21. And entry template "et1" has entry "e1" with user: user "u2", client: client "7UP", campaign: campaign "refresh"
  22. And entry template "et1" has page "p1" with user: user "u2"
  23. And action type "at1" exists with name: "Social Media Link Share", code: "entry.share.social", ownership: "entry", event_name: "entry.share.social"
  24. And action type "at2" exists with name: "Social Media Link Share", code: "page.share.social", ownership: "page", event_name: "page.share.social"
  25.  
  26. Scenario: Triggering action 'Social Media Link Share' with exchange rules when PST has client ownership scope
  27. Given action exchange rule "aer1" exists with action_type: action type "at1", entry_template: entry template "et1", point_system_template: point system template "pst1", award_target: "actor", award_points: "2.5", frequency_times: 2, frequency_period: "3600", frequency_scope: "client", target_condition: "other", only_one_award: false
  28. And action exchange rule "aer2" exists with action_type: action type "at1", entry_template: entry template "et1", point_system_template: point system template "pst1", award_target: "owner", award_points: "3.5", frequency_times: 2, frequency_period: "3600", frequency_scope: "client", target_condition: "other", only_one_award: false
  29. And action exchange rule "aer3" exists with action_type: action type "at1", entry_template: entry template "et1", point_system_template: point system template "pst1", award_target: "owner", award_points: "6.5", frequency_times: 3, frequency_period: "3600", frequency_scope: "client", target_condition: "other", only_one_award: false
  30. And action exchange rule "aer5" exists with action_type: action type "at1", entry_template: entry template "et1", point_system_template: point system template "pst1", award_target: "actor", award_points: "5", frequency_times: 4, frequency_period: "3600", frequency_scope: "campaign", target_condition: "other", only_one_award: false
  31. When I have query values code: "entry.share.social" namespaced with ""
  32. And I send "POST" request to "/entries/e1/actions.json"
  33. Then response should be "created"
  34. And response should have message: "action.notices.created"
  35. And action should exist with entry: entry "e1", user: user "u1"
  36. And point system mapping log should exist with amount: 2.5, user: user "u1", entry: entry "e1", client: client "7UP", campaign: campaign "refresh", action_exchange_rule: action exchange rule "aer1"
  37. And point system mapping log should exist with amount: 5, user: user "u1", entry: entry "e1", client: client "7UP", campaign: campaign "refresh", action_exchange_rule: action exchange rule "aer5"
  38. And user "u1" should have point system with rating: 7.5
  39. And point system mapping log should exist with amount: 3.5, user: user "u1", entry: entry "e1", client: client "7UP", campaign: campaign "refresh", action_exchange_rule: action exchange rule "aer2"
  40. And point system mapping log should exist with amount: 6.5, user: user "u1", entry: entry "e1", client: client "7UP", campaign: campaign "refresh", action_exchange_rule: action exchange rule "aer3"
  41. And user "u2" should have point system with rating: 10, client: client "7UP"
  42.  
  43. Scenario: Triggering action 'Social Media Link Share' with exchange rules when PST has campaign ownership scope
  44. Given action exchange rule "aer1" exists with action_type: action type "at1", entry_template: entry template "et1", only_one_award: false, point_system_template: point system template "pst2", award_target: "actor", award_points: "2.5", frequency_times: 2, frequency_period: "3600", frequency_scope: "client", target_condition: "other", only_one_award: false
  45. When I have query values code: "entry.share.social" namespaced with ""
  46. And I send "POST" request to "/entries/e1/actions.json"
  47. Then response should be "created"
  48. And response should have message: "action.notices.created"
  49. And action should exist with entry: entry "e1", user: user "u1"
  50. And point system mapping log should exist with amount: 2.5, user: user "u1", entry: entry "e1", client: client "7UP", campaign: campaign "refresh", action_exchange_rule: action exchange rule "aer1"
  51. And user "u1" should have point system with rating: 2.5
  52.  
  53. Scenario: Triggering action 'Social Media Link Share' with exchange rules when PST has competition ownership scope
  54. Given action exchange rule "aer1" exists with action_type: action type "at1", entry_template: entry template "et1", point_system_template: point system template "pst3", award_target: "actor", award_points: "2.5", frequency_times: 2, frequency_period: "3600", frequency_scope: "client", target_condition: "other", only_one_award: false
  55. When I have query values code: "entry.share.social" namespaced with ""
  56. And I send "POST" request to "/entries/e1/actions.json"
  57. Then response should be "created"
  58. And response should have message: "action.notices.created"
  59. And action should exist with entry: entry "e1", user: user "u1"
  60. And point system mapping log should exist with amount: 2.5, user: user "u1", entry: entry "e1", client: client "7UP", campaign: campaign "refresh", action_exchange_rule: action exchange rule "aer1"
  61. And user "u1" should have point system with rating: 2.5
  62.  
  63. Scenario: Triggering action 'Social Media Link Share' with exchange rules when PST has competition rounds ownership scope
  64. Given action exchange rule "aer1" exists with action_type: action type "at1", entry_template: entry template "et1", point_system_template: point system template "pst4", award_target: "actor", award_points: "2.5", frequency_times: 2, frequency_period: "3600", frequency_scope: "client", target_condition: "other", only_one_award: false
  65. When I have query values code: "entry.share.social" namespaced with ""
  66. And I send "POST" request to "/entries/e1/actions.json"
  67. Then response should be "created"
  68. And response should have message: "action.notices.created"
  69. And action should exist with entry: entry "e1", user: user "u1"
  70. And point system mapping log should exist with amount: 2.5, user: user "u1", entry: entry "e1", client: client "7UP", campaign: campaign "refresh", action_exchange_rule: action exchange rule "aer1"
  71. And user "u1" should have point system with rating: 2.5
  72.  
  73. Scenario: Triggering action 'Social Media Link Share' for entry with only one award exchange rule
  74. Given action exchange rule "aer1" exists with action_type: action type "at1", entry_template: entry template "et1", point_system_template: point system template "pst1", award_target: "actor", award_points: "2.5", target_condition: "other", only_one_award: true
  75. When I have query values code: "entry.share.social" namespaced with ""
  76. And I send "POST" request to "/entries/e1/actions.json"
  77. Then response should be "created"
  78. And response should have message: "action.notices.created"
  79. And action should exist with entry: entry "e1", user: user "u1"
  80. And point system mapping log should exist with amount: 2.5, user: user "u1", entry: entry "e1", client: client "7UP", campaign: campaign "refresh", action_exchange_rule: action exchange rule "aer1"
  81. And user "u1" should have point system with rating: 2.5
  82. When I have query values code: "entry.share.social" namespaced with ""
  83. And I send "POST" request to "/entries/e1/actions.json"
  84. Then response should be "created"
  85. And response should have message: "action.notices.created"
  86. And action should exist with entry: entry "e1", user: user "u1"
  87. And user "u1" should have point system with rating: 2.5
  88.  
  89. Scenario: Triggering action 'Social Media Link Share' for page with only one award exchange rule
  90. Given action exchange rule "aer1" exists with action_type: action type "at2", entry_template: entry template "et1", point_system_template: point system template "pst1", award_target: "actor", award_points: "2.5", target_condition: "other", only_one_award: true
  91. And action exchange rule "aer2" exists with action_type: action type "at2", entry_template: entry template "et1", point_system_template: point system template "pst1", award_target: "actor", award_points: "3.5", frequency_times: 1, frequency_period: "3600", frequency_scope: "client", target_condition: "other", only_one_award: false
  92. When I have query values code: "page.share.social" namespaced with ""
  93. And I send "POST" request to "/pages/p1/actions.json"
  94. Then response should be "created"
  95. And response should have message: "action.notices.created"
  96. And action should exist with page: page "p1", user: user "u1"
  97. And user "u1" should have point system with rating: 3.5
  98. And point system mapping log should exist with amount: 3.5, user: user "u1", page: page "p1", action_exchange_rule: action exchange rule "aer2"
Add Comment
Please, Sign In to add comment