Skip to content

Commit

Permalink
Merge pull request #122 from dylanratcliffe/issue_121
Browse files Browse the repository at this point in the history
Fix Issue 121
  • Loading branch information
dylanratcliffe authored Aug 29, 2017
2 parents 91f72e7 + e885b78 commit 4a58f75
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "spec/fixtures/puppet_controlrepo"]
path = spec/fixtures/puppet_controlrepo
url = https://github.com/dylanratcliffe/puppet_controlrepo.git
branch = production
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ language: ruby

cache:
bundler: true
directories:
- 'spec/fixtures/puppet_controlrepo/.onceover' # Onceover cache

script: bundler exec rake test
bundler_args: --path vendor/bundle
Expand Down
4 changes: 3 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ require 'rubygems/tasks'
require 'rspec/core/rake_task'
Gem::Tasks.new

RSpec::Core::RakeTask.new(:spec)
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = '--pattern spec/\*/\*_spec.rb'
end

task default: :test

Expand Down
1 change: 0 additions & 1 deletion lib/onceover/controlrepo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,6 @@ def self.evaluate_template(template_name,bind)
logger.debug "Evaluating template #{template_name}"
template_dir = File.expand_path('../../templates',File.dirname(__FILE__))
template = File.read(File.expand_path("./#{template_name}",template_dir))
logger.debug "Binding variables #{bind.local_variables}"
ERB.new(template, nil, '-').result(bind)
end

Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions spec/fixtures/puppet_controlrepo
Submodule puppet_controlrepo added at cdefff
49 changes: 41 additions & 8 deletions spec/onceover/controlrepo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,50 @@
require 'onceover/controlrepo'

describe "Onceover::Controlrepo" do
before do
@repo = Onceover::Controlrepo.new(
{
path:'spec/fixtures/controlrepo'
}
)
end
context "in a barebones controlrepo" do
before do
@repo = Onceover::Controlrepo.new(
{
path:'spec/fixtures/controlrepo_basic'
}
)
end

context ".hiera_config_file_relative_path" do
context "without hiera.yaml" do
it { expect(@repo.hiera_config_file_relative_path).to be_nil }
end
end

context "in a complex repo" do
before do
@repo = Onceover::Controlrepo.new(
{
path:'spec/fixtures/puppet_controlrepo'
}
)
end

context "when initialising the object" do
it { expect(@repo).not_to be_nil }
end

context "when running the tests" do
it "doesn't die horribly" do
expect{
Dir.chdir('spec/fixtures/puppet_controlrepo') do
require 'onceover/controlrepo'
require 'onceover/cli'
require 'onceover/runner'
require 'onceover/testconfig'
require 'onceover/logger'

repo = Onceover::Controlrepo.new({})
runner = Onceover::Runner.new(repo,Onceover::TestConfig.new(repo.onceover_yaml, {}), :spec)
runner.prepare!
runner.run_spec!
end
}.not_to raise_error
end
end
end
end

0 comments on commit 4a58f75

Please sign in to comment.