Skip to content

Commit

Permalink
backup commit 2016.06.12 20:36
Browse files Browse the repository at this point in the history
  • Loading branch information
ptomulik committed Jun 12, 2016
1 parent 06bf90e commit cdf1acf
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions spec/unit/puppet/util/repoutil_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
described_class.expects(:genclass).
once.with(:foo, { :parent => Puppet::Util::RepoUtil,
:overwrite => true,
:hash => described_class.class_variable_get(:@@repoutil_hash),
:hash => described_class.class_eval { class_variable_get(:@@repoutil_hash) },
:attributes => attributes })
described_class.newrepoutil(:foo)
end
Expand All @@ -60,7 +60,7 @@
described_class.expects(:genclass).
once.with(:foo, { :parent => parent,
:overwrite => true,
:hash => described_class.class_variable_get(:@@repoutil_hash),
:hash => described_class.class_eval { class_variable_get(:@@repoutil_hash) },
:attributes => attributes })
described_class.newrepoutil(:foo, :parent => parent)
end
Expand All @@ -73,7 +73,7 @@
described_class.expects(:genclass).
once.with(:foo, { :parent => parent,
:overwrite => true,
:hash => described_class.class_variable_get(:@@repoutil_hash),
:hash => described_class.class_eval { class_variable_get(:@@repoutil_hash) },
:attributes => attributes })
described_class.newrepoutil(:foo, :parent => 'Parent')
end
Expand All @@ -93,7 +93,7 @@
context 'with name=:foo' do
before(:each) do
described_class.expects(:rmclass).
once.with(:foo, :hash => described_class.class_variable_get(:@@repoutil_hash))
once.with(:foo, :hash => described_class.class_eval { class_variable_get(:@@repoutil_hash) })
end
it 'invokes rmclass(:foo, :hash => @@repoutil_hash)' do
described_class.unrepoutil(:foo)
Expand All @@ -110,7 +110,8 @@
let(:loader) { Class.new { def self.load(name, env); true; end } }
let(:foo) { Class.new }
before(:each) do
described_class.class_variable_set(:@@repoutil_hash, {:foo => foo})
hash = {:foo => foo}
described_class.class_eval { class_variable_set(:@@repoutil_hash, hash) }
Puppet::Node::Environment.stubs(:current).returns(:CE1)
Puppet.stubs(:lookup).with(:current_environment).returns(:CE2)
described_class.stubs(:repoutilloader).returns(loader)
Expand All @@ -136,7 +137,7 @@
describe 'repoutils' do
context 'when @@repoutil_hash is empty' do
before(:each) do
described_class.class_variable_set(:@@repoutil_hash, {})
described_class.class_eval { class_variable_set(:@@repoutil_hash, {}) }
end
it 'invokes loadall' do
described_class.expects(:loadall).once.with()
Expand All @@ -145,7 +146,7 @@
end
context 'when @@repoutil_hash is not empty' do
before(:each) do
described_class.class_variable_set(:@@repoutil_hash, {:foo => :RU1, :bar => :RU2})
described_class.class_eval { class_variable_set(:@@repoutil_hash, {:foo => :RU1, :bar => :RU2}) }
end
it 'does not call loadall' do
described_class.expects(:loadall).never
Expand All @@ -160,7 +161,7 @@
describe 'suitablerepoutils' do
context 'when @@repoutil_hash is empty' do
before(:each) do
described_class.class_variable_set(:@@repoutil_hash, {})
described_class.class_eval { class_variable_set(:@@repoutil_hash, {}) }
end
it 'invokes loadall' do
described_class.expects(:loadall).once.with()
Expand All @@ -172,7 +173,8 @@
let(:bar) { Class.new { def self.suitable?; false; end } }
let(:geez) { Class.new { def self.suitable?; true; end } }
before(:each) do
described_class.class_variable_set(:@@repoutil_hash, {:foo => foo, :bar => bar, :geez => geez})
hash = {:foo => foo, :bar => bar, :geez => geez}
described_class.class_eval { class_variable_set(:@@repoutil_hash, hash) }
end
it 'does not call loadall' do
described_class.expects(:loadall).never
Expand Down

0 comments on commit cdf1acf

Please sign in to comment.