Sha256: b06789d4949ec4b411d810187bc6164b8bdf6bcc0808f4cfe2ffbbea310936ce
Contents?: true
Size: 1001 Bytes
Versions: 3
Compression:
Stored size: 1001 Bytes
Contents
require 'spec_helper' describe Snapme::Snapper do let(:host) { 'http://example.com' } let(:interval){ double :interval } let(:command) { double :command } subject(:snapper){ described_class.new(host, interval, command) } describe '#run' do it 'takes a snapshot' do expect(command).to receive(:call).with(snapper.filename) snapper.run(false) # do not loop end it 'posts the snapshot to the web' do allow(command).to receive(:call) curl = double 'Curl::Easy' file = double 'Curl::PostField' # Hint: The number of mocks here is probably a hint that we're missing an # object. I'm willing to accept this for now... expect(Curl::Easy).to receive(:new).with(snapper.endpoint_url).and_return(curl) expect(Curl::PostField).to receive(:file) .with(snapper.field_name, snapper.filename) .and_return(file) expect(curl).to receive(:http_post).with(file) snapper.run(false) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
snapme-0.1.2 | spec/lib/snapme/snapper_spec.rb |
snapme-0.1.1 | spec/lib/snapme/snapper_spec.rb |
snapme-0.1.0 | spec/lib/snapme/snapper_spec.rb |