Testing hash contents using RSpec

后端 未结 4 585
南旧
南旧 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 20:56

    Another easy way to test if the whole content is a Hash is to checkout if the content is the Hash Object itself:

    it 'is to be a Hash Object' do
        workbook = {name: 'A', address: 'La'}
        expect(workbook.is_a?(Hash)).to be_truthy
    end
    

    For the question above we can check as follow:

    expect(adjusted_jump_locations).to match(hash_including('upper_left' => true))
    

提交回复
热议问题