Created
August 21, 2013 11:46
-
-
Save GregSutcliffe/6293472 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
require 'puppet/reports' | |
require 'webmock/rspec' | |
describe 'Foreman Report Processor' do | |
# TODO improve this parsing | |
@foreman_url = 'http://localhost:3000' | |
let(:foreman_url) { 'http://localhost:3000' } | |
# Parse ERB and create a file we can require - need an instance variable for ERB | |
template=File.join(File.dirname(__FILE__), '../..', 'templates', 'foreman-report.rb.erb') | |
output=File.join(File.dirname(__FILE__), '..', 'fixtures', 'foreman-report.rb') | |
File.write(output,ERB.new(File.read(template), nil, '-').result(binding)) | |
require File.join(File.dirname(__FILE__), '..', 'fixtures', 'foreman-report') | |
processor = Puppet::Reports.report(:foreman) | |
subject { Puppet::Transaction::Report.new("apply").extend(processor) } | |
describe "when making a request" do | |
it "should use the path specified by the 'foreman_url' setting" do | |
stub = stub_request(:post, "#{foreman_url}/reports/create?format=yml") | |
subject.process | |
stub.should have_been_requested.once | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment