How to solve the error "undefined method `docker_image' for cookbook" in chefspec unit test

I am trying to setup unit tests for a chef cookbook using chefspec. I have a docker resource in my recipe that utilises the docker cookbook. I get this error when I run chef exec rspec undefined method `docker_image' for cookbook . Relevant code in default recipe looks like this

docker_image 'vault' do
  repo 'vault'
  tag latest
  action :pull_if_missing
end

My test file in default_spec.rb looks like this

require 'spec_helper'

describe 'vault::default' do
  let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'centos', version: '7').converge(described_recipe) }

  it 'pulls docker_image[vault]' do
    expect(chef_run).to pull_docker_image('vault').with(
      repo: 'vault'
    )
  end    
end

The metadata.rb file has depends 'docker' and Berksfile has cookbook 'docker', '= 4.0.0' .

From the error, it seems like chefspec cant load the docker cookbook. Any idea on how to solve this will be great