88* [ Configuration] ( #configuration )
99* [ Naming conventions] ( #naming-conventions )
1010* [ Example groups] ( #example-groups )
11- * [ Defined Types, Classes & Applications ] ( #defined-types-classes--applications )
11+ * [ Defined Types and Classes ] ( #defined-types-and-classes )
1212* [ Functions] ( #functions )
1313* [ Hiera integration] ( #hiera-integration )
1414* [ Producing coverage reports] ( #producing-coverage-reports )
@@ -259,9 +259,6 @@ structure and naming convention.
259259 ├── defines/
260260 │ └── <define_name>_spec.rb
261261 │
262- ├── applications/
263- │ └── <application_name>_spec.rb
264- │
265262 ├── functions/
266263 │ └── <function_name>_spec.rb
267264 │
@@ -289,10 +286,6 @@ describe 'mydefine', :type => :define do
289286 ...
290287end
291288
292- describe ' myapplication' , :type => :application do
293- ...
294- end
295-
296289describe ' myfunction' , :type => :puppet_function do
297290 ...
298291end
@@ -310,7 +303,7 @@ describe 'myhost.example.com', :type => :host do
310303end
311304```
312305
313- ## Defined Types, Classes & Applications
306+ ## Defined Types and Classes
314307
315308### Matchers
316309
@@ -601,7 +594,7 @@ let(:title) { 'foo' }
601594
602595#### Specifying the parameters to pass to a resources or parameterised class
603596
604- Parameters of a defined type, class or application can be passed defining ` :params ` in a let,
597+ Parameters of a defined type or class can be passed defining ` :params ` in a let,
605598and passing it a hash as seen below.
606599
607600``` ruby
@@ -621,7 +614,7 @@ let(:params) { {'password' =>sensitive('secret') } }
621614```
622615
623616For references to nodes or resources as seen when using ` require ` or ` before ` properties,
624- or an ` application ` resource you can pass the string as an argument to the ` ref ` helper:
617+ you can pass the string as an argument to the ` ref ` helper:
625618
626619``` ruby
627620let(:params ) { ' require' => ref(' Package' , ' sudoku' ) }
@@ -633,18 +626,6 @@ Which translates to:
633626mydefine { 'mytitle': require => Package['sudoku'] }
634627```
635628
636- Another example, for an application setup (when using ` app_management ` ):
637-
638- ``` ruby
639- let(:params ) { { ' nodes' => { ref(' Node' , ' dbnode' ) => ref(' Myapp::Mycomponent' , ' myapp' ) } } }
640- ```
641-
642- Will translate to:
643-
644- ``` puppet
645- site { myapp { 'myimpl': nodes => { Node['dbnode'] => Myapp::Mycomponent['myimpl'] } } }
646- ```
647-
648629#### Specifying the FQDN of the test node
649630
650631If the manifest you're testing expects to run on host with a particular name,
@@ -835,46 +816,6 @@ You can also use `exported_resources` directly in a test:
835816it { expect(exported_resources).to contain_file(' foo' ) }
836817```
837818
838- #### Testing applications
839-
840- Applications in some ways behave as defined resources, but are more complex so
841- require a number of elements already documented above to be combined for testing.
842-
843- A full example of the simplest rspec test for a single component application:
844-
845- ``` ruby
846- require ' spec_helper'
847-
848- describe ' orch_app' do
849- let(:node ) { ' my_node' }
850- let(:title ) { ' my_awesome_app' }
851- let(:params ) do
852- {
853- ' nodes' => {
854- ref(' Node' , node) => ref(' Orch_app::Db' , title),
855- }
856- }
857- end
858-
859- it { should compile }
860- it { should contain_orch_app(title) }
861- end
862- ```
863-
864- Each piece is required:
865-
866- * You must turn on app_management during testing for the handling to work
867- * The ` :node ` definition is required to be set so later on you can reference it in the ` :nodes ` argument within ` :params `
868- * Applications act like defined resources, and each require a ` :title ` to be defined
869- * The ` :nodes ` key in ` :params ` requires the use of node reference mappings to resource
870- mappings. The ` ref ` keyword allows you to provide these (a normal string will not work).
871-
872- Beyond these requirements, the very basic ` should compile ` test and other matchers
873- as you would expect will work the same as classes and defined resources.
874-
875- ** Note:** for the moment, cross-node support is not available and will return an error.
876- Ensure you model your tests to be single-node for the time being.
877-
878819## Functions
879820
880821### Matchers
0 commit comments