Skip to content

Commit 1eba6bd

Browse files
committed
Mise en place de l'environnement de test.
1 parent a9ef4a2 commit 1eba6bd

File tree

5 files changed

+38
-0
lines changed

5 files changed

+38
-0
lines changed

Rakefile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
require 'rake'
2+
require 'rspec/core/rake_task'
3+
4+
desc "Run all RSpec code examples"
5+
RSpec::Core::RakeTask.new(:rspec) do |t|
6+
t.rspec_opts = File.read("spec/spec.opts").chomp || ""
7+
end
8+
9+
SPEC_SUITES = (Dir.entries('spec') - ['.', '..','fixtures']).select {|e| File.directory? "spec/#{e}" }
10+
namespace :rspec do
11+
SPEC_SUITES.each do |suite|
12+
desc "Run #{suite} RSpec code examples"
13+
RSpec::Core::RakeTask.new(suite) do |t|
14+
t.pattern = "spec/#{suite}/**/*_spec.rb"
15+
t.rspec_opts = File.read("spec/spec.opts").chomp || ""
16+
end
17+
end
18+
end
19+
task :default => :rspec
20+
21+
begin
22+
if Gem::Specification::find_by_name('puppet-lint')
23+
require 'puppet-lint/tasks/puppet-lint'
24+
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"]
25+
task :default => [:rspec, :lint]
26+
end
27+
rescue Gem::LoadError
28+
end

spec/fixtures/manifests/site.pp

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../manifests
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../templates

spec/spec_helper.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
require 'rspec-puppet'
2+
3+
fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
4+
5+
RSpec.configure do |c|
6+
c.module_path = File.join(fixture_path, 'modules')
7+
c.manifest_dir = File.join(fixture_path, 'manifests')
8+
end

0 commit comments

Comments
 (0)