Last change
on this file since 30960 was 30960, checked in by davidb, 8 years ago |
Switch to using Puppet to provision machine. Strongly based on files developed for spark-hdfs cluster
|
-
Property svn:executable
set to
*
|
File size:
1.4 KB
|
Rev | Line | |
---|
[30960] | 1 | require 'spec_helper'
|
---|
| 2 |
|
---|
| 3 | describe 'assert_private' do
|
---|
| 4 | context 'when called from inside module' do
|
---|
| 5 | it "should not fail" do
|
---|
| 6 | scope.expects(:lookupvar).with('module_name').returns('foo')
|
---|
| 7 | scope.expects(:lookupvar).with('caller_module_name').returns('foo')
|
---|
| 8 |
|
---|
| 9 | is_expected.to run.with_params()
|
---|
| 10 | end
|
---|
| 11 | end
|
---|
| 12 |
|
---|
| 13 | context "when called from private class" do
|
---|
| 14 | before :each do
|
---|
| 15 | scope.expects(:lookupvar).with('module_name').returns('foo')
|
---|
| 16 | scope.expects(:lookupvar).with('caller_module_name').returns('bar')
|
---|
| 17 | end
|
---|
| 18 |
|
---|
| 19 | it "should fail with a class error message" do
|
---|
| 20 | scope.source.expects(:name).returns('foo::baz')
|
---|
| 21 | scope.source.expects(:type).returns('hostclass')
|
---|
| 22 |
|
---|
| 23 | is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /Class foo::baz is private/)
|
---|
| 24 | end
|
---|
| 25 |
|
---|
| 26 | context "with an explicit failure message" do
|
---|
| 27 | it { is_expected.to run.with_params('failure message!').and_raise_error(Puppet::ParseError, /failure message!/) }
|
---|
| 28 | end
|
---|
| 29 | end
|
---|
| 30 |
|
---|
| 31 | context "when called from private definition" do
|
---|
| 32 | it "should fail with a class error message" do
|
---|
| 33 | scope.expects(:lookupvar).with('module_name').returns('foo')
|
---|
| 34 | scope.expects(:lookupvar).with('caller_module_name').returns('bar')
|
---|
| 35 | scope.source.expects(:name).returns('foo::baz')
|
---|
| 36 | scope.source.expects(:type).returns('definition')
|
---|
| 37 |
|
---|
| 38 | is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /Definition foo::baz is private/)
|
---|
| 39 | end
|
---|
| 40 | end
|
---|
| 41 | end
|
---|
Note:
See
TracBrowser
for help on using the repository browser.