I do this with params.merge! in a before block:

here is an example:


https://github.com/stackforge/puppet-openstack/blob/master/spec/classes/openstack_cinder_all_spec.rb#L61


On Mon, Oct 7, 2013 at 6:26 AM, Johan De Wit <[email protected]> wrote:

> Hi,
>
> I'm looking for a way to avoid repeating all necessary facts to make the
> catalog compile.
>
> I'm using the let function for passing needed facts:
>
> Now I have to repeat all facts in every context to make it work.  Is there
> a way to do something like :
>
>
> describe 'x' do
>   let(:facts) {{ :x => 'x',: y => 'y', ......, :many => 'more' , z => 'z'
> }}
>
>   it {}  //test using default facts
>
>   context 'x has other value' do
>     let(:x) { 'overruled value' }
>          ====> is still using  the facts :x => 'x'
>   end
>
>   context 'y has other value' do
>     let(:params)  {{ :y => 'overruled' }}
>        =====> all other params are gone, only :y exists
>   end
> end
>
> Only when i repeat all facts, in every context, it works as should, but i
> would like tot ovoid repeating  this in every context.
>
> Any hints on where to look for a solution are welcome.
>
> I have looked at before(:each) .. but still no working solution
>
> Thx
>
> Johan
>
> --
> Johan De Wit
>
> Open Source Consultant
>
> Red Hat Certified Engineer         (805008667232363)
> Puppet Certified Professional 2013 (PCP0000006)
> ______________________________**___________________________
>  Open-Future                 Phone     +32 (0)2/255 70 70
> Zavelstraat 72              Fax       +32 (0)2/255 70 71
> 3071 KORTENBERG             Mobile    +32 (0)474/42 40 73
> BELGIUM                     http://www.open-future.be
> ______________________________**___________________________
>
> Next Events:
> Extending Puppet Training 2013 | http://www.open-future.be/**
> extending-puppet-training-8-**till-11th-october<http://www.open-future.be/extending-puppet-training-8-till-11th-october>
> Puppet Fundamentals Training | http://www.open-future.be/**
> puppet-fundamentals-training-**15-till-17th-october<http://www.open-future.be/puppet-fundamentals-training-15-till-17th-october>
> Puppet Advanced Training | https://www.open-future.be/**
> puppet-advanced-training-12-**till-14th-november<https://www.open-future.be/puppet-advanced-training-12-till-14th-november>
> Zabbix Certified Training | http://www.open-future.be/**
> zabbix-certified-training-18-**till-20th-november<http://www.open-future.be/zabbix-certified-training-18-till-20th-november>
> Zabbix Large Environments Training | http://www.open-future.be/**
> zabbix-large-environments-**training-21-till-22nd-november<http://www.open-future.be/zabbix-large-environments-training-21-till-22nd-november>
> Puppet Fundamentals Training | http://www.open-future.be/**
> puppet-fundamentals-training-**10-till-12th-december<http://www.open-future.be/puppet-fundamentals-training-10-till-12th-december>
> Subscribe to our newsletter | http://eepurl.com/BUG8H
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to 
> puppet-users+unsubscribe@**googlegroups.com<puppet-users%[email protected]>
> .
> To post to this group, send email to [email protected].
> Visit this group at 
> http://groups.google.com/**group/puppet-users<http://groups.google.com/group/puppet-users>
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to