Skip to content

Commit

Permalink
Add skeleton for rspec/travis tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrakowitzer committed Mar 27, 2014
1 parent 36e7422 commit 1ab44cf
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 14 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: ruby
rvm:
- 1.9.3
script: "rake spec"
env:
- PUPPET_VERSION=3.4.2
notifications:
email:
- [email protected]
29 changes: 29 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
require 'rake'
require 'rspec/core/rake_task'

desc "Run all RSpec code examples"
RSpec::Core::RakeTask.new(:rspec) do |t|
t.rspec_opts = File.read("spec/spec.opts").chomp || ""
end

SPEC_SUITES = (Dir.entries('spec') - ['.', '..','fixtures']).select {|e| File.directory? "spec/#{e}" }
namespace :rspec do
SPEC_SUITES.each do |suite|
desc "Run #{suite} RSpec code examples"
RSpec::Core::RakeTask.new(suite) do |t|
t.pattern = "spec/#{suite}/**/*_spec.rb"
t.rspec_opts = File.read("spec/spec.opts").chomp || ""
end
end
end
task :default => :rspec

begin
if Gem::Specification::find_by_name('puppet-lint')
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"]
task :default => [:rspec, :lint]
end
rescue Gem::LoadError
end
Empty file added spec/fixtures/manifests/site.pp
Empty file.
1 change: 1 addition & 0 deletions spec/fixtures/modules/confluence/manifests
1 change: 1 addition & 0 deletions spec/fixtures/modules/confluence/templates
Empty file added spec/spec.opts
Empty file.
19 changes: 5 additions & 14 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
dir = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift File.join(dir, 'lib')
require 'rspec-puppet'

require 'mocha'
require 'puppet'
require 'rspec'
require 'spec/autorun'
fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))

Spec::Runner.configure do |config|
config.mock_with :mocha
end

# We need this because the RAL uses 'should' as a method. This
# allows us the same behaviour but with a different method name.
class Object
alias :must :should
RSpec.configure do |c|
c.module_path = File.join(fixture_path, 'modules')
c.manifest_dir = File.join(fixture_path, 'manifests')
end

0 comments on commit 1ab44cf

Please sign in to comment.