Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @docs
- Feature: Action Exchange Rule Logic
- As a user
- I want to apply action exchange rules for points exchange
- So that users can have more points
- Background:
- Given client group "Pepsi" exists
- And client group "Pepsi" has a client "7UP"
- And user "u1" exists with password: "secret", password_confirmation: "secret", email: "user@test.test", client: client "7UP"
- And user "u2" exists with password: "secret", password_confirmation: "secret", email: "user2@test.test", client: client "7UP"
- And I am signed in as user using email: "user@test.test", password: "secret"
- And client "7UP" has a campaign "refresh"
- And campaign "refresh" has competition template "ct1"
- And competition round template "crt1" exists
- And point system template "pst1" exists with name: "User", ownership: "user", ownership_scope: "client", client: client "7UP"
- And point system template "pst2" exists with name: "User", ownership: "user", ownership_scope: "campaign", campaign: campaign "refresh", client: client "7UP"
- And point system template "pst3" exists with name: "User", ownership: "user", ownership_scope: "competition", competition_template: competition template "ct1", client: client "7UP"
- And point system template "pst4" exists with name: "User", ownership: "user", ownership_scope: "competition_rounds", array_competition_round_template_uuids: "[crt1]", client: client "7UP"
- And campaign "refresh" has entry template "et1"
- And entry template "et1" has entry "e1" with user: user "u2", client: client "7UP", campaign: campaign "refresh"
- And entry template "et1" has page "p1" with user: user "u2"
- And action type "at1" exists with name: "Social Media Link Share", code: "entry.share.social", ownership: "entry", event_name: "entry.share.social"
- And action type "at2" exists with name: "Social Media Link Share", code: "page.share.social", ownership: "page", event_name: "page.share.social"
- Scenario: Triggering action 'Social Media Link Share' with exchange rules when PST has client ownership scope
- 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
- 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
- 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
- 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
- When I have query values code: "entry.share.social" namespaced with ""
- And I send "POST" request to "/entries/e1/actions.json"
- Then response should be "created"
- And response should have message: "action.notices.created"
- And action should exist with entry: entry "e1", user: user "u1"
- 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"
- 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"
- And user "u1" should have point system with rating: 7.5
- 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"
- 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"
- And user "u2" should have point system with rating: 10, client: client "7UP"
- Scenario: Triggering action 'Social Media Link Share' with exchange rules when PST has campaign ownership scope
- 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
- When I have query values code: "entry.share.social" namespaced with ""
- And I send "POST" request to "/entries/e1/actions.json"
- Then response should be "created"
- And response should have message: "action.notices.created"
- And action should exist with entry: entry "e1", user: user "u1"
- 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"
- And user "u1" should have point system with rating: 2.5
- Scenario: Triggering action 'Social Media Link Share' with exchange rules when PST has competition ownership scope
- 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
- When I have query values code: "entry.share.social" namespaced with ""
- And I send "POST" request to "/entries/e1/actions.json"
- Then response should be "created"
- And response should have message: "action.notices.created"
- And action should exist with entry: entry "e1", user: user "u1"
- 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"
- And user "u1" should have point system with rating: 2.5
- Scenario: Triggering action 'Social Media Link Share' with exchange rules when PST has competition rounds ownership scope
- 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
- When I have query values code: "entry.share.social" namespaced with ""
- And I send "POST" request to "/entries/e1/actions.json"
- Then response should be "created"
- And response should have message: "action.notices.created"
- And action should exist with entry: entry "e1", user: user "u1"
- 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"
- And user "u1" should have point system with rating: 2.5
- Scenario: Triggering action 'Social Media Link Share' for entry with only one award exchange rule
- 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
- When I have query values code: "entry.share.social" namespaced with ""
- And I send "POST" request to "/entries/e1/actions.json"
- Then response should be "created"
- And response should have message: "action.notices.created"
- And action should exist with entry: entry "e1", user: user "u1"
- 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"
- And user "u1" should have point system with rating: 2.5
- When I have query values code: "entry.share.social" namespaced with ""
- And I send "POST" request to "/entries/e1/actions.json"
- Then response should be "created"
- And response should have message: "action.notices.created"
- And action should exist with entry: entry "e1", user: user "u1"
- And user "u1" should have point system with rating: 2.5
- Scenario: Triggering action 'Social Media Link Share' for page with only one award exchange rule
- 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
- 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
- When I have query values code: "page.share.social" namespaced with ""
- And I send "POST" request to "/pages/p1/actions.json"
- Then response should be "created"
- And response should have message: "action.notices.created"
- And action should exist with page: page "p1", user: user "u1"
- And user "u1" should have point system with rating: 3.5
- 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