Sha256: ed7555e63c5519673022a065f81084801acfbc2dddd96ff561725cb1b6a546eb

Contents?: true

Size: 756 Bytes

Versions: 4

Compression:

Stored size: 756 Bytes

Contents

require 'spec_helper'
require 'webmock/rspec'
require 'puppet-herald/client'

describe PuppetHerald::Client, '.process' do
  let(:payload) { { :zz => 65, :yh => 12 } }
  let(:expected) { payload.to_yaml }
  before :each do
    stub_request(:post, "#{address}/api/v1/reports").with(:body => expected).
      to_return(:body => "{id: 1}", :status => 201)
  end
  subject { client.process payload }
  context 'on defaults' do
    let(:address) { 'localhost:11303' }
    let(:client) { PuppetHerald::Client.new }
    it { expect(subject).to be_truthy }
  end
  context 'on other host:port' do
    let(:address) { 'master.secure.vm:8082' }
    let(:client) { PuppetHerald::Client.new('master.secure.vm', 8082) }
    it { expect(subject).to be_truthy }
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
puppet-herald-client-1.0.0 spec/unit/puppet-herald/client_spec.rb
puppet-herald-0.8.1 spec/unit/puppet-herald/client_spec.rb
puppet-herald-0.8.0 spec/unit/puppet-herald/client_spec.rb
puppet-herald-0.2.0 spec/unit/puppet-herald/client_spec.rb