File tree Expand file tree Collapse file tree 2 files changed +18
-15
lines changed
integration/provider/oratab Expand file tree Collapse file tree 2 files changed +18
-15
lines changed Original file line number Diff line number Diff line change 7
7
include PuppetlabsSpec ::Files
8
8
9
9
before :each do
10
- described_class . stubs ( :suitable? ) . returns true
11
- described_class . stubs ( :default_target ) . returns fake_oratab
12
- Puppet ::Type . type ( :oratab ) . stubs ( :defaultprovider ) . returns described_class
10
+ allow ( described_class ) . to receive ( :suitable? ) . and_return ( true )
11
+ allow ( described_class ) . to receive ( :default_target ) . and_return ( fake_oratab )
12
+ allow ( Puppet ::Type . type ( :oratab ) ) . to receive ( :defaultprovider ) . and_return ( described_class )
13
13
end
14
14
15
15
let :fake_oratab do
100
100
end
101
101
102
102
def run_in_catalog ( *resources )
103
- Puppet ::FileBucket ::Dipper . any_instance . stubs ( :backup ) # Don't backup to filebucket
103
+ allow_any_instance_of ( Puppet ::FileBucket ::Dipper ) . to receive ( :backup )
104
104
catalog = Puppet ::Resource ::Catalog . new
105
105
catalog . host_config = false
106
106
resources . each do |resource |
107
- resource . expects ( :err ) . never
107
+ expect ( resource ) . not_to receive ( :err )
108
108
catalog . add_resource ( resource )
109
109
end
110
110
catalog . apply
@@ -113,7 +113,7 @@ def run_in_catalog(*resources)
113
113
def check_content_against ( fixture )
114
114
content = File . read ( fake_oratab ) . lines . map { |l | l . chomp } . reject { |l | l =~ /^\s *#|^\s *$/ } . sort . join ( "\n " )
115
115
expected_content = File . read ( my_fixture ( fixture ) ) . lines . map { |l | l . chomp } . reject { |l | l =~ /^\s *#|^\s *$/ } . sort . join ( "\n " )
116
- content . should == expected_content
116
+ expect ( content ) . to eq ( expected_content )
117
117
end
118
118
119
119
describe "when managing one resource" do
Original file line number Diff line number Diff line change 5
5
describe Puppet ::Type . type ( :oratab ) . provider ( :parsed ) do
6
6
7
7
before :each do
8
- described_class . stubs ( :suitable? ) . returns true
9
- described_class . stubs ( :default_target ) . returns my_fixture ( 'oratab' )
10
- Puppet ::Type . type ( :oratab ) . stubs ( :defaultprovider ) . returns described_class
8
+ allow ( Puppet ::Type . type ( :oratab ) ) . to receive ( :defaultprovider ) . and_return ( described_class )
9
+ allow ( described_class ) . to receive ( :default_target ) . and_return ( my_fixture ( 'oratab' ) )
11
10
end
12
11
13
- let :provider do
14
- described_class . new (
15
- :name => 'TEST01' ,
16
- :ensure => :present ,
17
- :home => '/u01/app/oracle/product/9.2.0.1.0' ,
18
- :atboot => :yes ,
12
+ let :resource do
13
+ Puppet :: Type . type ( :oratab ) . new (
14
+ :name => 'TEST01' ,
15
+ :ensure => :present ,
16
+ :home => '/u01/app/oracle/product/9.2.0.1.0' ,
17
+ :atboot => :yes ,
19
18
:description => 'managed by puppet'
20
19
)
21
20
end
22
21
22
+ let :provider do
23
+ described_class . new ( resource )
24
+ end
25
+
23
26
[ :destroy , :create , :exists? ] . each do |method |
24
27
it "should respond to #{ method } " do
25
28
expect ( provider ) . to respond_to method
You can’t perform that action at this time.
0 commit comments