puppetlabs_spec_helper 1.1.1 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.rubocop.yml +504 -0
- data/.travis.yml +17 -6
- data/CHANGELOG.md +47 -3
- data/CONTRIBUTING.md +5 -46
- data/Gemfile +15 -9
- data/{README.markdown → README.md} +185 -64
- data/Rakefile +5 -40
- data/lib/puppetlabs_spec_helper/module_spec_helper.rb +2 -8
- data/lib/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals.rb +2 -0
- data/lib/puppetlabs_spec_helper/rake_tasks.rb +153 -22
- data/lib/puppetlabs_spec_helper/version.rb +4 -1
- data/puppetlabs_spec_helper.gemspec +27 -83
- metadata +69 -58
- data/spec/lib/puppet/type/spechelper.rb +0 -6
- data/spec/spec_helper.rb +0 -2
- data/spec/unit/puppetlabs_spec_helper/puppetlabs_spec/puppet_internals_spec.rb +0 -91
- data/spec/watchr.rb +0 -79
| @@ -23,12 +23,12 @@ Usage | |
| 23 23 | 
             
            =====
         | 
| 24 24 |  | 
| 25 25 | 
             
            When developing or testing modules, simply clone this repository and install the
         | 
| 26 | 
            -
            gem it contains.
         | 
| 26 | 
            +
            gem it contains. The recommended way to do this is using [bundler](http://bundler.io/#getting-started).
         | 
| 27 27 |  | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
                 | 
| 31 | 
            -
                 | 
| 28 | 
            +
            Example Gemfile:
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                source 'https://rubygems.org'
         | 
| 31 | 
            +
                gem 'puppetlabs_spec_helper'
         | 
| 32 32 |  | 
| 33 33 | 
             
            Add this to your project's spec\_helper.rb:
         | 
| 34 34 |  | 
| @@ -61,6 +61,21 @@ Host github.com | |
| 61 61 |  | 
| 62 62 | 
             
            Note: parallel downloads is only available for repositories and not forge modules.
         | 
| 63 63 |  | 
| 64 | 
            +
            ### Parallel tests
         | 
| 65 | 
            +
            It is also possible to use the `parallel_tests` Gem via the `:parallel_spec` Rake task to run rspec commands in parallel on groups of spec files.
         | 
| 66 | 
            +
             | 
| 67 | 
            +
            Use of parallelization at this level can result in large performance benefits when the Rspec examples tend to cause a number of large, CPU-intensive catalog compilations to occur.  An example of where this might be the case is in a complex module with a lot of tests or a control repo with many hosts.
         | 
| 68 | 
            +
             | 
| 69 | 
            +
            Be aware however that in other circumstances this parallelization can result in the tests actually taking longer to run.  The best thing to do is time `rspec spec` and `rspec parallel_spec` and use the parallelization only when there is a clear benefit.
         | 
| 70 | 
            +
             | 
| 71 | 
            +
            To enable this feature, add the `parallel_tests` Gem to your project's Gemfile:
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                gem 'parallel_tests'
         | 
| 74 | 
            +
             | 
| 75 | 
            +
            And then to run spec tests in parallel:
         | 
| 76 | 
            +
             | 
| 77 | 
            +
                $ rake parallel_spec
         | 
| 78 | 
            +
             | 
| 64 79 | 
             
            Issues
         | 
| 65 80 | 
             
            ======
         | 
| 66 81 |  | 
| @@ -93,6 +108,17 @@ branch of this project from github, and install it as a rubygem. | |
| 93 108 | 
             
            There should be few or no cases where you would want to have any other
         | 
| 94 109 | 
             
            branch of this project besides master/HEAD.
         | 
| 95 110 |  | 
| 111 | 
            +
            Running on non-current ruby versions
         | 
| 112 | 
            +
            ------------------------------------
         | 
| 113 | 
            +
             | 
| 114 | 
            +
            Since gem and bundler, ruby's package management tools, do not take the target ruby version into account when downloading packages, the puppetlabs_spec_helper gem can only depend on gems that are available for all supported ruby versions. If you can/want to use features from other packages, install those additional packages manually, or have a look at the Gemfile, which provides code to specify those dependencies in a more "friendly" way. This currently affects the following gems:
         | 
| 115 | 
            +
             | 
| 116 | 
            +
            * puppet
         | 
| 117 | 
            +
            * rubocop
         | 
| 118 | 
            +
            * rubocop-rspec
         | 
| 119 | 
            +
            * json_pure
         | 
| 120 | 
            +
            * rack
         | 
| 121 | 
            +
             | 
| 96 122 | 
             
            Initializing Puppet for Testing
         | 
| 97 123 | 
             
            ===============================
         | 
| 98 124 |  | 
| @@ -119,8 +145,8 @@ variables for the spec run. These are: | |
| 119 145 | 
             
            * ``FUTURE_PARSER`` - set to "yes" to enable the [future parser](http://docs.puppetlabs.com/puppet/latest/reference/experiments_future.html),
         | 
| 120 146 | 
             
              the equivalent of setting [parser=future](http://docs.puppetlabs.com/references/latest/configuration.html#parser)
         | 
| 121 147 | 
             
              in puppet.conf.
         | 
| 122 | 
            -
            * ``STRICT_VARIABLES`` - set to " | 
| 123 | 
            -
              the equivalent of setting [strict_variables](http://docs.puppetlabs.com/references/latest/configuration.html#strictvariables) | 
| 148 | 
            +
            * ``STRICT_VARIABLES`` - set to "no" to disable strict variable checking when using Puppet >= 4.0,
         | 
| 149 | 
            +
              the equivalent of not setting [strict_variables](http://docs.puppetlabs.com/references/latest/configuration.html#strictvariables)
         | 
| 124 150 | 
             
              in puppet.conf.
         | 
| 125 151 | 
             
            * ``ORDERING`` - set to the desired ordering method ("title-hash", "manifest", or "random")
         | 
| 126 152 | 
             
              to set the order of unrelated resources when applying a catalog. Leave unset for the default
         | 
| @@ -140,6 +166,18 @@ and manifest ordering, you would: | |
| 140 166 |  | 
| 141 167 | 
             
                FUTURE_PARSER=yes STRICT_VARIABLES=yes ORDERING=manifest rake spec
         | 
| 142 168 |  | 
| 169 | 
            +
            When executing tests in a matrix CI environment, tests can be split up to run
         | 
| 170 | 
            +
            a share of specs per CI node in parallel.  Set the ``CI_NODE_TOTAL`` environment
         | 
| 171 | 
            +
            variable to the total number of nodes, and the ``CI_NODE_INDEX`` to a number
         | 
| 172 | 
            +
            between 1 and the ``CI_NODE_TOTAL``.
         | 
| 173 | 
            +
             | 
| 174 | 
            +
            If using Travis CI, add new lines to the "env" section of .travis.yml per node,
         | 
| 175 | 
            +
            remembering to duplicate any existing environment variables:
         | 
| 176 | 
            +
             | 
| 177 | 
            +
                env:
         | 
| 178 | 
            +
                  - FUTURE_PARSER=yes CI_NODE_TOTAL=2 CI_NODE_INDEX=1
         | 
| 179 | 
            +
                  - FUTURE_PARSER=yes CI_NODE_TOTAL=2 CI_NODE_INDEX=2
         | 
| 180 | 
            +
             | 
| 143 181 | 
             
            Using Utility Classes
         | 
| 144 182 | 
             
            =====================
         | 
| 145 183 | 
             
            If you'd like to use the Utility classes (PuppetlabsSpec::Files,
         | 
| @@ -158,24 +196,29 @@ Using Fixtures | |
| 158 196 | 
             
            `puppetlabs_spec_helper` has the ability to populate the
         | 
| 159 197 | 
             
            `spec/fixtures/modules` directory with dependent modules when `rake spec` or
         | 
| 160 198 | 
             
            `rake spec_prep` is run. To do so, all required modules should be listed in a
         | 
| 161 | 
            -
            file named `.fixtures.yml` in the root of the project.
         | 
| 199 | 
            +
            file named `.fixtures.yml` in the root of the project. You can specify a alternate location for that file in the `FIXTURES_YML` environment variable.
         | 
| 162 200 |  | 
| 163 201 | 
             
            When specifying the repo source of the fixture you have a few options as to which revision of the codebase you wish to use.
         | 
| 164 202 |  | 
| 165 203 | 
             
             * repo - the url to the repo
         | 
| 166 204 | 
             
             * scm - options include git or hg. This is an optional step as the helper code will figure out which scm is used.
         | 
| 205 | 
            +
             | 
| 167 206 | 
             
               ```yaml
         | 
| 168 207 | 
             
               scm: git
         | 
| 169 208 | 
             
               scm: hg
         | 
| 170 209 | 
             
               ```
         | 
| 210 | 
            +
             | 
| 171 211 | 
             
             * target - the directory name to clone the repo into ie. `target: mymodule`  defaults to the repo name  (Optional)
         | 
| 212 | 
            +
             * subdir - directory to be removed from the cloned repo. Its contents will be moved to the root directory (Optional)
         | 
| 172 213 | 
             
             * ref - used to specify the tag name like version hash of commit (Optional)
         | 
| 214 | 
            +
             | 
| 173 215 | 
             
               ```yaml
         | 
| 174 216 | 
             
               ref: 1.0.0
         | 
| 175 217 | 
             
               ref: 880fca52c
         | 
| 176 218 | 
             
               ```
         | 
| 177 219 | 
             
             * branch - used to specify the branch name you want to use ie. `branch: development`
         | 
| 178 220 | 
             
             * flags - additional flags passed to the module installer (both puppet and scm)
         | 
| 221 | 
            +
             | 
| 179 222 | 
             
               ```yaml
         | 
| 180 223 | 
             
               flags: --verbose
         | 
| 181 224 | 
             
               ```
         | 
| @@ -187,86 +230,164 @@ Fixtures Examples | |
| 187 230 | 
             
            Basic fixtures that will symlink `spec/fixtures/modules/my_modules` to the
         | 
| 188 231 | 
             
            project root:
         | 
| 189 232 |  | 
| 190 | 
            -
             | 
| 191 | 
            -
             | 
| 192 | 
            -
             | 
| 233 | 
            +
            ```yaml
         | 
| 234 | 
            +
            fixtures:
         | 
| 235 | 
            +
              symlinks:
         | 
| 236 | 
            +
                my_module: "#{source_dir}"
         | 
| 237 | 
            +
            ```
         | 
| 193 238 |  | 
| 239 | 
            +
            This is the same as specifying no symlinks fixtures at all.
         | 
| 194 240 |  | 
| 195 241 | 
             
            Add `firewall` and `stdlib` as required module fixtures:
         | 
| 196 242 |  | 
| 197 | 
            -
             | 
| 198 | 
            -
             | 
| 199 | 
            -
             | 
| 200 | 
            -
             | 
| 201 | 
            -
             | 
| 202 | 
            -
             | 
| 243 | 
            +
            ```yaml
         | 
| 244 | 
            +
            fixtures:
         | 
| 245 | 
            +
              repositories:
         | 
| 246 | 
            +
                firewall: "git://github.com/puppetlabs/puppetlabs-firewall"
         | 
| 247 | 
            +
                stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib"
         | 
| 248 | 
            +
            ```
         | 
| 203 249 |  | 
| 204 250 | 
             
            Specify that the git tag `2.4.2` of `stdlib' should be checked out:
         | 
| 205 251 |  | 
| 206 | 
            -
             | 
| 207 | 
            -
             | 
| 208 | 
            -
             | 
| 209 | 
            -
             | 
| 210 | 
            -
             | 
| 211 | 
            -
             | 
| 212 | 
            -
                   | 
| 213 | 
            -
             | 
| 252 | 
            +
            ```yaml
         | 
| 253 | 
            +
            fixtures:
         | 
| 254 | 
            +
              repositories:
         | 
| 255 | 
            +
                firewall: "git://github.com/puppetlabs/puppetlabs-firewall"
         | 
| 256 | 
            +
                stdlib:
         | 
| 257 | 
            +
                  repo: "git://github.com/puppetlabs/puppetlabs-stdlib"
         | 
| 258 | 
            +
                  ref: "2.6.0"
         | 
| 259 | 
            +
            ```
         | 
| 260 | 
            +
             | 
| 261 | 
            +
            Move manifests and siblings to root directory when they are inside a `code` directory:
         | 
| 262 | 
            +
             | 
| 263 | 
            +
            ```yaml
         | 
| 264 | 
            +
            fixtures:
         | 
| 265 | 
            +
              repositories:
         | 
| 266 | 
            +
                stdlib:
         | 
| 267 | 
            +
                  repo: "git://github.com/puppetlabs/puppetlabs-extradirectory"
         | 
| 268 | 
            +
                  subdir: "code"
         | 
| 269 | 
            +
            ```
         | 
| 214 270 |  | 
| 215 271 | 
             
            Install modules from Puppet Forge:
         | 
| 216 272 |  | 
| 217 | 
            -
             | 
| 218 | 
            -
             | 
| 219 | 
            -
             | 
| 220 | 
            -
             | 
| 221 | 
            -
             | 
| 222 | 
            -
             | 
| 273 | 
            +
            ```yaml
         | 
| 274 | 
            +
            fixtures:
         | 
| 275 | 
            +
              forge_modules:
         | 
| 276 | 
            +
                firewall: "puppetlabs/firewall"
         | 
| 277 | 
            +
                stdlib:
         | 
| 278 | 
            +
                  repo: "puppetlabs/stdlib"
         | 
| 279 | 
            +
                  ref: "2.6.0"
         | 
| 280 | 
            +
            ```
         | 
| 223 281 |  | 
| 224 282 | 
             
            Pass additional flags to module installation:
         | 
| 225 283 |  | 
| 226 | 
            -
             | 
| 227 | 
            -
             | 
| 228 | 
            -
             | 
| 229 | 
            -
             | 
| 230 | 
            -
             | 
| 231 | 
            -
             | 
| 232 | 
            -
             | 
| 233 | 
            -
             | 
| 234 | 
            -
             | 
| 235 | 
            -
             | 
| 236 | 
            -
             | 
| 284 | 
            +
            ```yaml
         | 
| 285 | 
            +
            fixtures:
         | 
| 286 | 
            +
              forge_modules:
         | 
| 287 | 
            +
                stdlib:
         | 
| 288 | 
            +
                  repo: "puppetlabs/stdlib"
         | 
| 289 | 
            +
                  ref: "2.6.0"
         | 
| 290 | 
            +
                  flags: "--module_repository https://my_repo.com"
         | 
| 291 | 
            +
                repositories:
         | 
| 292 | 
            +
                  firewall:
         | 
| 293 | 
            +
                    repo: "git://github.com/puppetlabs/puppetlabs-firewall"
         | 
| 294 | 
            +
                    ref: "2.6.0"
         | 
| 295 | 
            +
                    flags: "--verbose"
         | 
| 296 | 
            +
            ```
         | 
| 237 297 |  | 
| 238 298 | 
             
            Testing Parser Functions
         | 
| 239 299 | 
             
            ========================
         | 
| 240 300 |  | 
| 241 | 
            -
            This  | 
| 242 | 
            -
             | 
| 243 | 
            -
             | 
| 301 | 
            +
            This whole section is superseded by improved support of accessing the scope in
         | 
| 302 | 
            +
            rspec-puppet.
         | 
| 303 | 
            +
             | 
| 304 | 
            +
            Generating code coverage reports
         | 
| 305 | 
            +
            ================================
         | 
| 306 | 
            +
             | 
| 307 | 
            +
            This section describes how to add code coverage reports for Ruby files (types, providers, ...).
         | 
| 308 | 
            +
            See the documentation of [RSpec-Puppet](https://github.com/rodjek/rspec-puppet)
         | 
| 309 | 
            +
            for Puppet manifest coverage reports.
         | 
| 310 | 
            +
             | 
| 311 | 
            +
            Starting with Ruby 1.9, the *de facto* standard for Ruby code coverage is
         | 
| 312 | 
            +
            [SimpleCov](https://github.com/colszowka/simplecov).
         | 
| 313 | 
            +
            You can add it to your module like this:
         | 
| 314 | 
            +
             | 
| 315 | 
            +
            ```Ruby
         | 
| 316 | 
            +
            # First line of spec/spec_helper.rb
         | 
| 317 | 
            +
            require 'simplecov'
         | 
| 318 | 
            +
             | 
| 319 | 
            +
            SimpleCov.start do
         | 
| 320 | 
            +
              add_filter '/spec/'
         | 
| 321 | 
            +
              # Exclude bundled Gems in `/.vendor/`
         | 
| 322 | 
            +
              add_filter '/.vendor/'
         | 
| 323 | 
            +
            end
         | 
| 324 | 
            +
             | 
| 325 | 
            +
            require 'puppetlabs_spec_helper/module_spec_helper'
         | 
| 326 | 
            +
            # Further content
         | 
| 327 | 
            +
            ```
         | 
| 328 | 
            +
             | 
| 329 | 
            +
            The reports will then be generated every time you invoke RSpec, e.g. via `rake spec`,
         | 
| 330 | 
            +
            and are written to `/coverage/`, which you should add to `.gitignore`.
         | 
| 331 | 
            +
             | 
| 332 | 
            +
            Remember to add `gem 'simplecov', require: false` to your `Gemfile`.
         | 
| 333 | 
            +
             | 
| 334 | 
            +
            Using Code Climate
         | 
| 335 | 
            +
            ------------------
         | 
| 244 336 |  | 
| 245 | 
            -
             | 
| 337 | 
            +
            You can also use [Code Climate](https://codeclimate.com/) together with SimpleCov:
         | 
| 246 338 |  | 
| 247 | 
            -
             | 
| 248 | 
            -
             | 
| 249 | 
            -
             | 
| 250 | 
            -
                    scope.function_split(['one;two', ';']).should == [ 'one', 'two' ]
         | 
| 251 | 
            -
                  end
         | 
| 252 | 
            -
                end
         | 
| 339 | 
            +
            ```Ruby
         | 
| 340 | 
            +
            # First line of spec/spec_helper.rb
         | 
| 341 | 
            +
            require 'codeclimate-test-reporter'
         | 
| 253 342 |  | 
| 254 | 
            -
             | 
| 255 | 
            -
             | 
| 256 | 
            -
             | 
| 343 | 
            +
            SimpleCov.formatters = [
         | 
| 344 | 
            +
              SimpleCov::Formatter::HTMLFormatter,
         | 
| 345 | 
            +
              CodeClimate::TestReporter::Formatter
         | 
| 346 | 
            +
            ]
         | 
| 257 347 |  | 
| 258 | 
            -
             | 
| 259 | 
            -
             | 
| 260 | 
            -
             | 
| 261 | 
            -
             | 
| 262 | 
            -
             | 
| 263 | 
            -
             | 
| 264 | 
            -
             | 
| 348 | 
            +
            SimpleCov.start do
         | 
| 349 | 
            +
              add_filter '/spec/'
         | 
| 350 | 
            +
              # Exclude bundled Gems in `/.vendor/`
         | 
| 351 | 
            +
              add_filter '/.vendor/'
         | 
| 352 | 
            +
            end
         | 
| 353 | 
            +
             | 
| 354 | 
            +
            require 'puppetlabs_spec_helper/module_spec_helper'
         | 
| 355 | 
            +
            # Further content
         | 
| 356 | 
            +
            ```
         | 
| 357 | 
            +
             | 
| 358 | 
            +
            Remember to add `gem 'codeclimate-test-reporter', require: false` to your `Gemfile`.
         | 
| 359 | 
            +
             | 
| 360 | 
            +
            Using Coveralls
         | 
| 361 | 
            +
            ---------------
         | 
| 362 | 
            +
             | 
| 363 | 
            +
            You can also use [Coveralls](https://coveralls.io/) together with SimpleCov:
         | 
| 364 | 
            +
             | 
| 365 | 
            +
            ```Ruby
         | 
| 366 | 
            +
            # First line of spec/spec_helper.rb
         | 
| 367 | 
            +
            require 'simplecov'
         | 
| 368 | 
            +
            require 'coveralls'
         | 
| 369 | 
            +
             | 
| 370 | 
            +
            SimpleCov.formatters = [
         | 
| 371 | 
            +
              SimpleCov::Formatter::HTMLFormatter,
         | 
| 372 | 
            +
              Coveralls::SimpleCov::Formatter
         | 
| 373 | 
            +
            ]
         | 
| 374 | 
            +
             | 
| 375 | 
            +
            SimpleCov.start do
         | 
| 376 | 
            +
              add_filter '/spec/'
         | 
| 377 | 
            +
              # Exclude bundled Gems in `/.vendor/`
         | 
| 378 | 
            +
              add_filter '/.vendor/'
         | 
| 379 | 
            +
            end
         | 
| 380 | 
            +
             | 
| 381 | 
            +
            require 'puppetlabs_spec_helper/module_spec_helper'
         | 
| 382 | 
            +
            # Further content
         | 
| 383 | 
            +
            ```
         | 
| 384 | 
            +
             | 
| 385 | 
            +
            Remember to add `gem 'coveralls', require: false` to your `Gemfile`.
         | 
| 265 386 |  | 
| 266 387 | 
             
            Some Notes for Windows Users
         | 
| 267 | 
            -
             | 
| 388 | 
            +
            ============================
         | 
| 268 389 |  | 
| 269 | 
            -
            A windows users may need to do one of two things to execute  | 
| 390 | 
            +
            A windows users may need to do one of two things to execute `rake spec`.
         | 
| 270 391 |  | 
| 271 392 | 
             
            Although things may appear to work, the init.pp may not transfer to the fixtures folder as needed
         | 
| 272 393 | 
             
            or may transfer as an empty file.
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -1,50 +1,15 @@ | |
| 1 1 | 
             
            # encoding: utf-8
         | 
| 2 | 
            +
            require "bundler/gem_tasks"
         | 
| 3 | 
            +
            require "rspec/core/rake_task"
         | 
| 2 4 |  | 
| 3 | 
            -
             | 
| 4 | 
            -
            require 'bundler'
         | 
| 5 | 
            -
            begin
         | 
| 6 | 
            -
              Bundler.setup(:default, :development)
         | 
| 7 | 
            -
            rescue Bundler::BundlerError => e
         | 
| 8 | 
            -
              $stderr.puts e.message
         | 
| 9 | 
            -
              $stderr.puts "Run `bundle install` to install missing gems"
         | 
| 10 | 
            -
              exit e.status_code
         | 
| 11 | 
            -
            end
         | 
| 12 | 
            -
            require 'rake'
         | 
| 13 | 
            -
            require_relative 'lib/puppetlabs_spec_helper/version'
         | 
| 14 | 
            -
            require 'jeweler'
         | 
| 15 | 
            -
            Jeweler::Tasks.new do |gem|
         | 
| 16 | 
            -
              # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
         | 
| 17 | 
            -
              gem.name = "puppetlabs_spec_helper"
         | 
| 18 | 
            -
              gem.version = "#{PuppetlabsSpecHelper::Version::STRING}"
         | 
| 19 | 
            -
              gem.homepage = "http://github.com/puppetlabs/puppetlabs_spec_helper"
         | 
| 20 | 
            -
              gem.license = "Apache-2.0"
         | 
| 21 | 
            -
              gem.summary = %Q{Standard tasks and configuration for module spec tests}
         | 
| 22 | 
            -
              gem.description = %Q{Contains rake tasks and a standard spec_helper for running spec tests on puppet modules}
         | 
| 23 | 
            -
              gem.email = ["modules-dept@puppetlabs.com"]
         | 
| 24 | 
            -
              gem.authors = ["Puppet Labs"]
         | 
| 25 | 
            -
              # dependencies defined in Gemfile
         | 
| 26 | 
            -
            end
         | 
| 27 | 
            -
            Jeweler::RubygemsDotOrgTasks.new
         | 
| 5 | 
            +
            task :default => :spec
         | 
| 28 6 |  | 
| 29 | 
            -
            require 'rspec/core'
         | 
| 30 | 
            -
            require 'rspec/core/rake_task'
         | 
| 31 7 | 
             
            RSpec::Core::RakeTask.new(:spec) do |spec|
         | 
| 32 8 | 
             
              spec.pattern = FileList['spec/**/*_spec.rb'].exclude('spec/fixtures/**/*_spec.rb')
         | 
| 33 9 | 
             
            end
         | 
| 34 10 |  | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
              task :tag do
         | 
| 38 | 
            -
                `git tag -m '#{PuppetlabsSpecHelper::Version::STRING}'`
         | 
| 39 | 
            -
              end
         | 
| 40 | 
            -
              desc "Tag and push to master"
         | 
| 41 | 
            -
              task :pl_release do
         | 
| 42 | 
            -
                Rake::Task["git:tag"].invoke
         | 
| 43 | 
            -
                `git push origin master --tags`
         | 
| 44 | 
            -
              end
         | 
| 45 | 
            -
            end
         | 
| 46 | 
            -
             | 
| 47 | 
            -
            task :default => :spec
         | 
| 11 | 
            +
            require 'rubocop/rake_task'
         | 
| 12 | 
            +
            RuboCop::RakeTask.new
         | 
| 48 13 |  | 
| 49 14 | 
             
            require 'yard'
         | 
| 50 15 | 
             
            YARD::Rake::YardocTask.new
         | 
| @@ -8,7 +8,7 @@ end | |
| 8 8 |  | 
| 9 9 | 
             
            def verify_contents(subject, title, expected_lines)
         | 
| 10 10 | 
             
              content = subject.resource('file', title).send(:parameters)[:content]
         | 
| 11 | 
            -
              (content.split("\n") & expected_lines). | 
| 11 | 
            +
              expect(content.split("\n") & expected_lines).to match_array expected_lines.uniq
         | 
| 12 12 | 
             
            end
         | 
| 13 13 |  | 
| 14 14 | 
             
            spec_path = File.expand_path(File.join(Dir.pwd, 'spec'))
         | 
| @@ -24,12 +24,6 @@ RSpec.configure do |c| | |
| 24 24 | 
             
              c.module_path = module_path
         | 
| 25 25 | 
             
              c.manifest_dir = File.join(fixture_path, 'manifests')
         | 
| 26 26 | 
             
              c.parser = 'future' if ENV['FUTURE_PARSER'] == 'yes'
         | 
| 27 | 
            -
              ## This depends on rspec-puppet #209 being released
         | 
| 28 | 
            -
              #c.strict_variables = true if ENV['STRICT_VARIABLES'] == 'yes'
         | 
| 29 | 
            -
              ## These depend on rspec-puppet #212 being released
         | 
| 30 | 
            -
              #c.stringify_facts = false if ENV['STRINGIFY_FACTS'] == 'no'
         | 
| 31 | 
            -
              #c.trusted_node_data = true if ENV['TRUSTED_NODE_DATA'] == 'yes'
         | 
| 32 | 
            -
              #c.ordering = ENV['ORDERING'] if ENV['ORDERING']
         | 
| 33 27 |  | 
| 34 28 | 
             
              c.before :each do
         | 
| 35 29 | 
             
                Puppet.features.stubs(:root?).returns(true)
         | 
| @@ -38,7 +32,7 @@ RSpec.configure do |c| | |
| 38 32 | 
             
                  Puppet.settings[:stringify_facts] = false if ENV['STRINGIFY_FACTS'] == 'no'
         | 
| 39 33 | 
             
                  Puppet.settings[:trusted_node_data] = true if ENV['TRUSTED_NODE_DATA'] == 'yes'
         | 
| 40 34 | 
             
                end
         | 
| 41 | 
            -
                Puppet.settings[:strict_variables] =  | 
| 35 | 
            +
                Puppet.settings[:strict_variables] = (ENV['STRICT_VARIABLES'] == 'yes' or (Puppet.version.to_f >= 4.0 and ENV['STRICT_VARIABLES'] != 'no'))
         | 
| 42 36 | 
             
                Puppet.settings[:ordering] = ENV['ORDERING'] if ENV['ORDERING']
         | 
| 43 37 | 
             
              end
         | 
| 44 38 | 
             
            end
         | 
| @@ -8,6 +8,8 @@ module PuppetlabsSpec | |
| 8 8 | 
             
                # instance suitable for placing in a test harness with the intent of
         | 
| 9 9 | 
             
                # testing parser functions from modules.
         | 
| 10 10 | 
             
                def scope(parts = {})
         | 
| 11 | 
            +
                  RSpec.deprecate('scope', :replacement => 'rspec-puppet 2.2.0 provides a scope property')
         | 
| 12 | 
            +
             | 
| 11 13 | 
             
                  if Puppet.version =~ /^2\.[67]/
         | 
| 12 14 | 
             
                    # loadall should only be necessary prior to 3.x
         | 
| 13 15 | 
             
                    # Please note, loadall needs to happen first when creating a scope, otherwise
         |