title: How can I test my LWRP with ChefSpec?
body: <p>I created my custom LWRP, but when I run the <a href="https://github.com/sethvargo/chefspec">ChefSpec</a> units test. It doesn't know  my LWRP actions.</p>
  
  <p>Here is my <strong>resource</strong>:</p>
  
  <p></p>
  
  <pre><code>actions :install, :uninstall
  default_action :install
  
  attribute :version, :kind_of =&gt; String
  attribute :options, :kind_of =&gt; String
  </code></pre>
  
  <p>Here is my <strong>provider</strong>:</p>
  
  <p></p>
  
  <pre><code>def whyrun_supported?
    true
  end
  
  action :install do
    version = @new_resource.version
    options = @new_resource.options
    e = execute "sudo apt-get install postgresql-#{version} #{options}"
    @new_resource.updated_by_last_action(e.updated_by_last_action?)
  end
  </code></pre>
  
  <p>And here is my ChefSpec unit test:</p>
  
  <p></p>
  
  <pre><code>require_relative '../spec_helper'
  
  describe 'app_cookbook::postgresql' do
  
    let(:chef_run) do
      ChefSpec::Runner.new do |node|
        node.set[:app][:postgresql][:database_user] = 'test'
        node.set[:app][:postgresql][:database_password] = 'test'
        node.set[:app][:postgresql][:database_name] = 'testdb'
      end.converge(described_recipe)
    end
  
    it 'installs postgresql 9.1 package' do
      expect(chef_run).to run_execute('sudo apt-get install postgresql-9.1 -y --force-yes')
    end
  end
  </code></pre>
  
  <p>Here is the console output:</p>
  
  <pre><code>app_cookbook::postgresql
  
  expected "execute[sudo apt-get install postgresql-9.1 -y --force-yes] with" action :run to be in Chef run. Other execute resources:
  
  ./spec/recipes/postgresql_spec.rb:23:in `block (2 levels) in &lt;top (required)&gt;'
    installs postgresql 9.1 package (FAILED - 1)
  
  Failures:
  
    1) app_cookbook::postgresql installs postgresql 9.1 package
       Failure/Error: expect(chef_run).to run_execute('sudo apt-get install postgresql-9.1 -y --force-yes')
         expected "execute[sudo apt-get install postgresql-9.1 -y --force-yes] with" action :run to be in Chef run. Other execute resources:
  
       # ./spec/recipes/postgresql_spec.rb:23:in `block (2 levels) in &lt;top (required)&gt;'
  
  1 example, 1 failure, 0 passed
  </code></pre>
  
  <p>How can I say to ChefSpec that run the test with the LWRPs actions?</p>