Skip to content

Instantly share code, notes, and snippets.

@orodio
Created February 8, 2012 08:50
Show Gist options
  • Save orodio/1766955 to your computer and use it in GitHub Desktop.
Save orodio/1766955 to your computer and use it in GitHub Desktop.
KingDosser Ranks sytem?
# Understanding expected results: username[rank]
Feature: Ranking System
Before:
Given these users
| username |
| user1 |
| user2 |
| user3 |
| user4 |
| user5 |
| user6 |
Scenario: first two unranked users fight
Given Nobody has any ranks yet
When User1 fights User2
And User1 wins
Then User1 gets a rank of 1
And User2 gets a rank of 2
# user1[1], user2[2], user3[nil], user4[nil], user5[nil], user6[nil]
Scenario: unranked user vs unranked user
Given users have ranks
When User3 fights User4
And User3 wins
Then User3 gets a rank of max + 1
And User4 gets a rank of User3s rank + 1
# user1[1], user2[2], user3[3], user4[4], user5[nil], user6[nil]
Scenario: Ranked user vs unranked user, ranked user wins
Given users have ranks
When user1 fights user5
And user1
Then user1 keeps rank
And user5 gets rank of max + 1
# user1[1], user2[2], user3[3], user4[4], user5[5], user6[nil]
Scenario: Ranked user vs unranked user, unranked user wins
Given users have ranks
When user2 fights user6
And user6 wins
Then user6 gets user2s rank
And user2 gets rank of max + 1
# user1[1], user2[6], user3[3], user4[4], user5[5], user6[2]
Scenario: Ranked user vs ranked user, lower ranks wins
Given users have ranks
When user3 fights user4
And user4 wins
Then users user4 and user3 swap ranks
# user1[1], user2[6], user3[4], user4[3], user5[5], user6[2]
Scenario: Ranked user vs ranked user, higher ranks wins
Given users have ranks
When user1 fights user5
And user1 wins
Then both users ranks stay the same
# user1[1], user2[6], user3[4], user4[3], user5[5], user6[2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment