diff options
author | Jorie Tappa <jorie@jorietappa.com> | 2018-08-01 15:43:32 -0500 |
---|---|---|
committer | Jorie Tappa <jorie@jorietappa.com> | 2018-08-01 16:13:33 -0500 |
commit | 45c0c71d2e3b3b7268a356eea86231a1b35cd4f0 (patch) | |
tree | 82980565e72c4ec04d8f41c6bf1311e636e9dedc /spec | |
parent | 96d65f6d51da6b4798c81a717fb1a0d68c4c90e1 (diff) | |
download | puppet-cron_core-45c0c71d2e3b3b7268a356eea86231a1b35cd4f0.tar.gz puppet-cron_core-45c0c71d2e3b3b7268a356eea86231a1b35cd4f0.tar.bz2 |
Fix RSpec/InstanceVariable violations
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/type/cron_spec.rb | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/spec/unit/type/cron_spec.rb b/spec/unit/type/cron_spec.rb index f60468a..32cab5c 100644 --- a/spec/unit/type/cron_spec.rb +++ b/spec/unit/type/cron_spec.rb @@ -2,13 +2,13 @@ require 'spec_helper' describe Puppet::Type.type(:cron), unless: Puppet.features.microsoft_windows? do let(:simple_provider) do - @provider_class = described_class.provide(:simple) { mk_resource_methods } - @provider_class.stubs(:suitable?).returns true - @provider_class + provider_class = described_class.provide(:simple) { mk_resource_methods } + provider_class.stubs(:suitable?).returns true + provider_class end before :each do - described_class.stubs(:defaultprovider).returns @provider_class + described_class.stubs(:defaultprovider).returns simple_provider end after :each do @@ -505,20 +505,21 @@ describe Puppet::Type.type(:cron), unless: Puppet.features.microsoft_windows? do end describe 'when autorequiring resources' do + let(:user_bob) { Puppet::Type.type(:user).new(name: 'bob', ensure: :present) } + let(:user_alice) { Puppet::Type.type(:user).new(name: 'alice', ensure: :present) } + let(:catalog) { Puppet::Resource::Catalog.new } + before :each do - @user_bob = Puppet::Type.type(:user).new(name: 'bob', ensure: :present) - @user_alice = Puppet::Type.type(:user).new(name: 'alice', ensure: :present) - @catalog = Puppet::Resource::Catalog.new - @catalog.add_resource @user_bob, @user_alice + catalog.add_resource user_bob, user_alice end it 'autorequires the user' do - @resource = described_class.new(name: 'dummy', command: '/usr/bin/uptime', user: 'alice') - @catalog.add_resource @resource - req = @resource.autorequire + resource = described_class.new(name: 'dummy', command: '/usr/bin/uptime', user: 'alice') + catalog.add_resource resource + req = resource.autorequire expect(req.size).to eq(1) - expect(req[0].target).to eq(@resource) - expect(req[0].source).to eq(@user_alice) + expect(req[0].target).to eq(resource) + expect(req[0].source).to eq(user_alice) end end |