Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barelyknown/0428adb96ba1eb68a153 to your computer and use it in GitHub Desktop.
Save barelyknown/0428adb96ba1eb68a153 to your computer and use it in GitHub Desktop.
blackjack-rails-api spec documentation after TableRuleSet model implemented
Seans-MacBook-Pro:blackjack-rails-api seandevine$ bundle exec rspec --format documentation
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Randomized with seed 31252
V1::CardResource
has no updatable fields
has no creatable fields
has the fetchable fields name and color
Table Rule Sets
GET /v1/table-rule-sets/:id
GET /v1/table-rule-sets/:id
GET /v1/table-rule-sets
GET /v1/table-rule-sets
POST /v1/table-rule-sets
POST /v1/table-rule-sets
Cards
GET /v1/cards
GET /v1/cards
GET /v1/cards/:id
GET /v1/cards/:id
Ranks
GET /v1/ranks/:id
GET /v1/ranks/:id
GET /v1/ranks
GET /v1/ranks
TableRuleSet
original_bets_only must be nil if no_hole_card is false
validates that the maximum_players_per_position greater than or equal to 1
has a insurance_pay_out attribute that is a decimal
validates that blackjack_pay_out is greater than 0
has an original_bets_only that defaults to nil
validates that the double_down_minimum_percentage is greater than 0
has a dealer_match_available attribute that defaults to true
validates that surrender_percentage is less than 1 if surrender is early or late
validates that the player_position_count is greater than or equal to 5
has a blackjack_pay_out attribute that is a decimal
validates that surrender_percentage is nil if surrender is not_allowed
has attribute non_controlling_player_chooses_split_hand_to_bet_if_not_following that is false by default
has a surrender enum with valid values of early, late, or not_allowed
validates that the maximum_players_per_position less than or equal to 13
validates that may_hit_split_aces is true or false
has a double_down_maximum_percentage that's a decimal
has a standard_pay_out attribute that is a decimal
validates that the double_down_maximum_percentage is greater than or equal to the double_down_minimum_percentage
validates that dealer_wins_ties is either true or false
validates that restrict_doubling_to_hard_totals is valid if the members are all between 2 and 21
allows maximum_double_count_per_hand to be nil
validates that restrict_doubling_to_hard_totals has no members that are greater than 21
has a may_hit_split_aces attribute that defaults to false
validates that standard_pay_out is greater than 0
validates that maximum_split_count_per_hand is greater than or equal to 0
has a maximum_players_per_position attribute
has a dealer_stands_at attribute that defaults to 17
has a maximum_split_count_per_hand attribute that is nil by default
has a deck_count
validates that the player_position_count is less than or equal to 7
has a dealer_wins_ties attribute that defaults to false
has a maximum_bets_per_player
validates that the dealer_match_pay_out is greater than 0 if dealer_match_available is true
has a default double_down_maximum_percentage of 1.0
validates that the dealer_stands_at is less than or equal to 21
validates that surrender_percentage is greater than 0 if surrender is early or late
has a double_down_minimum_percentage attribute that's a decimal
validates that dealer_match_available is true or false
validates that restrict_doubling_to_hard_totals has no members that are less than 2
has a dealer_match_pay_out atribute that is a decimal
has a player_position_count attribute
validates that the deck_count is greater than or equal to 1
has a split_identical_ranks_only attribute that is false by default
validates that non_controlling_player_chooses_split_hand_to_bet_if_not_following is true or false
has a surrender_percentage that is a decimal
allows maximum_split_count_per_hand to be nil
has a default double_down_minimum_percentage of 1.0
has an initial_player_card_face_up attribute that defaults to true
has attribute player_must_stand_on_soft_21 that defaults to true
validates the uniqueness of the name
validates that the split_identical_ranks_only is true or false
validates that the dealer_match_pay_out is nil if dealer_match_available = false
has restrict_doubling_to_hard_totals attribute that defaults to nil
has a insurance_available attribute that defaults to true
has a no_hole_card attribute that defaults to false
validates that player_must_stand_on_soft_21 is true or false
validates that the maximum_bets_per_player is greater than or equal to 1
has a maximum_double_count_per_hand attribute that is nil by default
validates that the double_down_maximum_percentage is greater than 0
defaults surrender to 'not_allowed'
has a name attribute that is nil by default
original_bets_only must be true or false if no_hole_card is true
validates that insurance_available is either true or false
validates that insurance_pay_out is nil if insurance_available is false
validates that insurance_pay_out is greater than 0 if insurance_available is true
has a dealer_draws_if_soft_stand_at that defaults to false
validates that dealer_draws_if_soft_stand_at is not nil
validates that the dealer_stands_at is greater than or equal to 12
validates that maximum_double_count_per_hand is greater than or equal to 0
V1::RankResource
has no creatable fields
has no updatable fields
has the fetchable fields id, initial, name, values, and order
Rank
seeds all the ranks
has an order attribute that is required
knows that numbered cards are numbered but not face
validates that values is not empty
sorts the ranks by order by default
can set and get the initial
can set and get the name
knows that face cards are face but not numbered
uses the initial as the primary_key
has a valid factory for each pip rank
has a values attribute
Deck
can shuffle the deck and put the cards in a different order
has cards, one of each suit and rank
V1::TableRuleSetResource
can create the correct fields
can update the correct fields
can fetch the correct fields
Suit
uses the initial as the primary_key
can find the suit using the name
can get and set the initial
has a color enum with black as 0 and red as 1
can set and get the name
can set and get the color
seeds the four traditional suits as expected
Suits
GET /v1/suits/:id
GET /v1/suits/:id
GET /v1/suits
GET /v1/suits
Card
has a #all class method that returns all the cards
has a rank_id method
is initialized with a rank and a suit
has an id which concatenates the initial of the rank and the suit
has a suit_id method
V1::SuitResource
has the fetchable fields name and color
has no updatable fields
has no creatable fields
Finished in 0.56 seconds (files took 1.27 seconds to load)
115 examples, 0 failures
Randomized with seed 31252
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment