OSDN Git Service

add rspec example for berkshelf-api-server-ya::default recipe.
authorwhitestar <whitestar@gaea.test>
Sat, 17 Oct 2015 08:50:50 +0000 (17:50 +0900)
committerwhitestar <whitestar@gaea.test>
Sat, 17 Oct 2015 08:50:50 +0000 (17:50 +0900)
cookbooks/berkshelf-api-server-ya/spec/recipes/default_spec.rb

index d538804..e5cf0db 100644 (file)
 require_relative '../spec_helper'
 
 describe 'berkshelf-api-server-ya::default' do
-=begin
-  subject { ChefSpec::Runner.new.converge(described_recipe) }
+  before {
+    stub_command(%r|cd /opt/berkshelf-api/v\d+\.\d+\.\d+ && /opt/chef/embedded/bin/bundle check|).
+      and_return(true)
+  }
 
-  # Write quick specs using `it` blocks with implied subjects
-  it { should do_something('...') }
+  let(:chef_run) { ChefSpec::SoloRunner.new.converge(described_recipe) }
 
-  # Write full examples using the `expect` syntax
-  it 'does something' do
-    expect(subject).to do_something('...')
+  it 'includes berkshelf-api-server-ya recipes.' do
+    expect(chef_run).to include_recipe('berkshelf-api-server-ya::app')
+    expect(chef_run).to include_recipe('berkshelf-api-server-ya::http_proxy')
   end
-
-  # Use an explicit subject
-  let(:chef_run) { ChefSpec::Runner.new.converge(described_recipe) }
-
-  it 'does something' do
-    expect(chef_run).to do_something('...')
-  end
-=end
 end
+