Skip to content

Commit

Permalink
Merge pull request #84 from puppetlabs/release-prep
Browse files Browse the repository at this point in the history
Release prep v5.0.0
  • Loading branch information
jordanbreen28 committed Oct 19, 2023
2 parents 5a22182 + a18802d commit f0d253f
Show file tree
Hide file tree
Showing 103 changed files with 3,353 additions and 3,317 deletions.
10 changes: 7 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).

## [v5.0.0](https://github.com/puppetlabs/rspec-puppet/tree/v5.0.0) - 2023-10-18

[Full Changelog](https://github.com/puppetlabs/rspec-puppet/compare/v4.0.0...v5.0.0)

### Changed
- (CAT-1235) - Rename to puppetlabs-rspec-puppet [#76](https://github.com/puppetlabs/rspec-puppet/pull/76) ([jordanbreen28](https://github.com/jordanbreen28))

## [v4.0.0](https://github.com/puppetlabs/rspec-puppet/tree/v4.0.0) - 2023-10-09

[Full Changelog](https://github.com/puppetlabs/rspec-puppet/compare/v3.0.0...v4.0.0)
Expand Down Expand Up @@ -198,9 +205,6 @@ This release had unintended breaking changes and was withdrawn.
Puppet settings (specifically `trusted_server_facts`) when running tests
against the upcoming Puppet 6.0.0 release.
<<<<<<< HEAD
## [v2.12.0](https://github.com/puppetlabs/rspec-puppet/tree/v2.12.0) - 2022-07-21
=======
## [2.6.14]
### Fixed
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ RSpec.configure do |c|
c.manifest = File.join(File.dirname(File.expand_path(__FILE__)), 'fixtures', 'manifests', 'site.pp')
# Coverage generation
c.after(:suite) do
RSpec::Puppet::Coverage.report!
Puppetlabs::RSpecPuppet::Coverage.report!
end
end
```
Expand Down Expand Up @@ -960,7 +960,7 @@ your `spec_helper.rb`
```ruby
RSpec.configure do |c|
c.after(:suite) do
RSpec::Puppet::Coverage.report!
RSpecPuppet::Coverage.report!
end
end
```
Expand All @@ -974,7 +974,7 @@ A desired code coverage level can be provided. If this level is not achieved, a
```ruby
RSpec.configure do |c|
c.after(:suite) do
RSpec::Puppet::Coverage.report!(95)
RSpecPuppet::Coverage.report!(95)
end
end
```
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require 'puppet'
task :default => :test
task :spec => :test

require 'rspec-puppet/tasks/release_test'
require 'puppetlabs/rspec-puppet/tasks/release_test'

fixtures_dir = File.expand_path(File.join(__FILE__, '..', 'spec', 'fixtures', 'modules'))
fixtures = {
Expand Down
6 changes: 3 additions & 3 deletions bin/rspec-puppet-init
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w[.. lib/puppetlabs])

require 'rspec-puppet'
require '../puppetlabs/rspec-puppet'
require 'optparse'

options = {
Expand All @@ -18,4 +18,4 @@ OptionParser.new do |opts|
end
end.parse!

RSpec::Puppet::Setup.run(options[:module_name])
Puppetlabs::RSpecPuppet::Setup.run(options[:module_name])
10 changes: 5 additions & 5 deletions docs/documentation/coverage/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ test run by the following to your `spec/spec_helper.rb` file.
{% highlight ruby %}
RSpec.configure do |c|
c.after(:suite) do
RSpec::Puppet::Coverage.report!
Puppetlabs::RSpecPuppet::Coverage.report!
end
end
{% endhighlight %}
Expand All @@ -39,12 +39,12 @@ hook in a spec file).
## Setting A Minimum Coverage Level

A desired code coverage percentage can be provided as an argument to
`RSpec::Puppet::Coverage.report!`.
`Puppetlabs::RSpecPuppet::Coverage.report!`.

{% highlight ruby %}
RSpec.configure do |c|
c.after(:suite) do
RSpec::Puppet::Coverage.report!(95)
Puppetlabs::RSpecPuppet::Coverage.report!(95)
end
end
{% endhighlight %}
Expand All @@ -63,9 +63,9 @@ use the `add_filter(type, title)` and `add_filter_regex(type, regex)` methods:
RSpec.configure do |c|
c.before(:suite) do
# Exclude File[/tmp] from all coverage reports
RSpec::Puppet::Coverage.add_filter('File', '/tmp')
Puppetlabs::RSpecPuppet::Coverage.add_filter('File', '/tmp')
# Exclude all anchor resources from all coverage reports
RSpec::Puppet::Coverage.add_filter_regex('Anchor', '.*')
Puppetlabs::RSpecPuppet::Coverage.add_filter_regex('Anchor', '.*')
end
end
{% endhighlight %}
Expand Down
20 changes: 10 additions & 10 deletions docs/documentation/setup/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ breadcrumbs:
---
## Installation

### Installing rspec-puppet
### Installing puppetlabs-rspec-puppet

If you are using [Bundler](https://bundler.io) to manage the gems in your
module or control repository (highly recommended), you should add rspec-puppet
module or control repository (highly recommended), you should add puppetlabs-rspec-puppet
to your `Gemfile` and then run `bundle install`.

{% highlight ruby %}
gem 'rspec-puppet', '~> 2.0'
gem 'puppetlabs-rspec-puppet', '~> 5.0'
{% endhighlight %}

Alternatively, you can install rspec-puppet using `gem`.
Alternatively, you can install puppetlabs-rspec-puppet using `gem`.

{% highlight console %}
$ gem install rspec-puppet
$ gem install puppetlabs-rspec-puppet
{% endhighlight %}

### Installing Puppet

rspec-puppet needs to have Puppet installed on the host in order to operate,
puppetlabs-rspec-puppet needs to have Puppet installed on the host in order to operate,
but does not have it specified in the gem as dependency as Puppet can be
installed as a native package or gem.

Expand All @@ -48,8 +48,8 @@ will find in many open source modules that support multiple Puppet versions.

### Automatic setup

rspec-puppet ships with a small script that will automate the setup process for
you by creating the various files and directories that rspec and rspec-puppet
puppetlabs-rspec-puppet ships with a small script that will automate the setup process for
you by creating the various files and directories that rspec and puppetlabs-rspec-puppet
require.

{% highlight console %}
Expand All @@ -75,12 +75,12 @@ $ mkdir -p spec/fixtures/{manifests,modules}
$ touch spec/fixtures/manifests/site.pp
{% endhighlight %}

RSpec needs to be configured to use rspec-puppet, which is done in the
RSpec needs to be configured to use puppetlabs-rspec-puppet, which is done in the
`spec/spec_helper.rb` file which should be created now with the following
content.

{% highlight ruby %}
require 'rspec-puppet'
require 'puppetlabs-rspec-puppet'

RSpec.configure do |c|
c.environmentpath = __dir__
Expand Down
40 changes: 21 additions & 19 deletions lib/rspec-puppet.rb → lib/puppetlabs/rspec-puppet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
require 'rspec'
require 'fileutils'
require 'tmpdir'
require 'rspec-puppet/errors'
require 'rspec-puppet/matchers'
require 'rspec-puppet/example'
require 'rspec-puppet/setup'
require 'rspec-puppet/coverage'
require 'rspec-puppet/adapters'
require 'rspec-puppet/consts'
require 'puppetlabs/rspec-puppet/errors'
require 'puppetlabs/rspec-puppet/matchers'
require 'puppetlabs/rspec-puppet/example'
require 'puppetlabs/rspec-puppet/setup'
require 'puppetlabs/rspec-puppet/coverage'
require 'puppetlabs/rspec-puppet/adapters'
require 'puppetlabs/rspec-puppet/consts'

begin
require 'puppet/test/test_helper'
Expand All @@ -21,17 +21,19 @@
c.add_setting :enable_pathname_stubbing, default: false
end

module RSpec::Puppet
def self.rspec_puppet_example?
RSpec::Puppet::EventListener.rspec_puppet_example?
end
module Puppetlabs
module RSpecPuppet
def self.rspec_puppet_example?
Puppetlabs::RSpecPuppet::EventListener.rspec_puppet_example?
end

def self.current_example
RSpec::Puppet::EventListener.current_example
def self.current_example
Puppetlabs::RSpecPuppet::EventListener.current_example
end
end
end

require 'rspec-puppet/monkey_patches'
require 'puppetlabs/rspec-puppet/monkey_patches'

RSpec.configure do |c|
c.add_setting :environmentpath, default: Puppet::Util::Platform.actually_windows? ? 'c:/nul/' : '/dev/null'
Expand Down Expand Up @@ -59,7 +61,7 @@ def self.current_example
c.add_setting :fallback_to_default_hiera, default: true

c.before(:all) do
RSpec::Puppet::Setup.safe_setup_directories(nil, false) if RSpec.configuration.setup_fixtures?
Puppetlabs::RSpecPuppet::Setup.safe_setup_directories(nil, false) if RSpec.configuration.setup_fixtures?
end

if defined?(Puppet::Test::TestHelper)
Expand Down Expand Up @@ -93,15 +95,15 @@ def self.current_example
end

c.before :each do
if RSpec::Puppet.rspec_puppet_example?
@adapter = RSpec::Puppet::Adapters.get
if Puppetlabs::RSpecPuppet.rspec_puppet_example?
@adapter = Puppetlabs::RSpecPuppet::Adapters.get
@adapter.setup_puppet(self)
c.adapter = adapter
end
end

c.before :each do |example|
if RSpec::Puppet.rspec_puppet_example?
if Puppetlabs::RSpecPuppet.rspec_puppet_example?
Puppet::Util::Platform.pretend_to_be RSpec.configuration.platform
stub_file_consts(example) if respond_to?(:stub_file_consts)

Expand All @@ -116,6 +118,6 @@ def self.current_example
end

c.after(:each) do
RSpec::Puppet::Consts.restore_consts if RSpec::Puppet.rspec_puppet_example?
Puppetlabs::RSpecPuppet::Consts.restore_consts if Puppetlabs::RSpecPuppet.rspec_puppet_example?
end
end
Loading

0 comments on commit f0d253f

Please sign in to comment.