spec/beaker/dsl/helpers_spec.rb in beaker-1.9.1 vs spec/beaker/dsl/helpers_spec.rb in beaker-1.10.0
- old
+ new
@@ -445,10 +445,30 @@
:acceptable_exit_codes => (1..5),
:trace => true,
:expect_failures => true
)
end
+
+ it 'can set the --parser future flag' do
+ subject.should_receive( :create_remote_file ).and_return( true )
+ subject.should_receive( :puppet ).
+ with( 'apply', '--verbose', '--parser future', '--detailed-exitcodes', 'agent' ).
+ and_return( 'puppet_command' )
+ subject.should_receive( :on ).with(
+ agent,
+ 'puppet_command',
+ :acceptable_exit_codes => [1,2,3,4,5,6]
+ )
+
+ subject.apply_manifest_on(
+ agent,
+ 'class { "boo": }',
+ :acceptable_exit_codes => (1..5),
+ :future_parser => true,
+ :expect_failures => true
+ )
+ end
end
describe "#apply_manifest" do
it "delegates to #apply_manifest_on with the default host" do
subject.stub( :hosts ).and_return( hosts )
@@ -652,15 +672,17 @@
describe '#with_puppet_running_on' do
let(:test_case_path) { 'testcase/path' }
let(:tmpdir_path) { '/tmp/tmpdir' }
let(:puppet_path) { '/puppet/path' }
+ let(:puppetservice) { @ps || nil }
let(:is_pe) { false }
let(:host) do
FakeHost.new(:pe => is_pe,
:options => {
'puppetpath' => puppet_path,
+ 'puppetservice' => puppetservice,
'platform' => 'el'
})
end
def stub_host_and_subject_to_allow_the_default_testdir_argument_to_be_created
@@ -687,26 +709,26 @@
describe "with valid arguments" do
before do
Tempfile.should_receive(:open).with('beaker')
end
- context 'as pe' do
- let(:is_pe) { true }
+ context 'with puppetservice and service-path defined' do
+ let(:puppetservice) { 'whatever' }
it 'bounces puppet twice' do
subject.with_puppet_running_on(host, {})
- expect(host).to execute_commands_matching(/pe-httpd restart/).exactly(2).times
+ expect(host).to execute_commands_matching(/#{@ps} restart/).exactly(2).times
end
it 'yield to a block after bouncing service' do
execution = 0
expect do
subject.with_puppet_running_on(host, {}) do
- expect(host).to execute_commands_matching(/pe-httpd restart/).once
+ expect(host).to execute_commands_matching(/#{@ps} restart/).once
execution += 1
end
end.to change { execution }.by(1)
- expect(host).to execute_commands_matching(/pe-httpd restart/).exactly(2).times
+ expect(host).to execute_commands_matching(/#{@ps} restart/).exactly(2).times
end
end
context 'running from source' do