2014-10-07 2 views
0

메인터치하는 방법 rspec-puppet을 사용하여 정의 하시겠습니까?

define hello::world { 
    file { "/tmp/helloworld${name}": } 
} 

테스트

require 'spec_helper' 

describe 'hello::world' do 
     let(:title) { '0' } 

     context 'test' do 
       let(:title) { '0' } 

       it do 
         should contain_file("/tmp/helloworld0") 
       end 
     end 
end 

at_exit { RSpec::Puppet::Coverage.report! } 

결과

[[email protected]] sudo rspec 
. 

Finished in 0.26947 seconds 
1 example, 0 failures 

Total resources: 2 
Touched resources: 1 
Resource coverage: 50.00% 
Untouched resources: 

    hello::world[0] 

여러 소스 1 즉, 23 읽은 및

it { should contain_define('hello::world[0]') }

또는

it { should contain_class('hello::world[0]') }

이 추가되었지만, 문제는 지속됩니다.

방법 RSpec에-꼭두각시를 사용하여 정의를 만지지 질문?

답변

2

documentation에 따르면 자원 유형의 콜론을 밑줄로 대체하여 올바른 정규 표현식을 생성해야합니다.

it { should contain_hello__world('0') } 
관련 문제