Chef spec test mysql

#1

Hello,
I have made a recipe to create my sql database

Create DB

execute 'create-db' do
command "mysql -uroot -p'#{pw}' -e 'CREATE DATABASE #{node['cms_mysql']['db_name']}';"
not_if "mysql -u root -p'#{pw}' -Be\ 'SHOW DATABASES' | grep #{node['cms_mysql']['db_name']};"
end
Can you pls guide me how to write the spec test for the above .

#2

it 'create-db' do
expect(chef_run).to exec("mysql -u root -p'Czt' -Be 'CREATE DATABASE #{node['cms_mysql']['db_name']}';")

 end

But this does not work for me.