Testing hash contents using RSpec

后端 未结 4 584
南旧
南旧 2021-02-06 20:37

I have a test like so:

it \"should not indicate backwards jumps if the checker position is not a king\" do
    board = Board.new
    game_board = board.create_te         


        
4条回答
  •  长发绾君心
    2021-02-06 21:02

    http://rubydoc.info/gems/rspec-expectations/RSpec/Matchers:include

    It works for hashes too:

    jump_locations.should include(
      "upper_left" => true,
      "upper_right" => false,
      "lower_left" => false,
      "lower_right" => true
    )
    

提交回复
热议问题