Sha256: bb2681b423146181d77cf5389b84442d121f4032fe86cee563e5f9ad1c8a7cf7
Contents?: true
Size: 1.81 KB
Versions: 1
Compression:
Stored size: 1.81 KB
Contents
describe Vagrant::Notify::Server do let(:arguments) { "-- '20 examples, 1 failure\n10 seconds'" } let(:client) { StringIO.new(arguments) } subject { described_class.new('uuid') } before { subject.stub(:system => true, :download => true) } it 'runs notify-send with received data from client' do subject.should_receive(:system).with("notify-send #{arguments}") subject.receive_data(client) end it 'closes connection after reading data' do client.should_receive(:close) subject.receive_data(client) end context 'notification with an icon' do let(:arguments) { "-i 'foo/bar.jpg'" } context 'icon hasnt been downloaded before' do before { subject.receive_data(client) } it 'downloads icon file to host machine' do subject.should have_received(:download) end it 'rewrites icon path before sending the notification' do subject.should have_received(:system).with("notify-send -i '/tmp/vagrant-notify-uuid-foo-bar.jpg'") end end context 'icon file cache is present' do before do File.stub(:exists? => true) subject.receive_data(client) end it 'does not download icon if was already downloaded' do subject.should_not have_received(:download) end end end context 'incoming HTTP connections' do let(:client) do StringIO.new("GET some/path\n\n").tap { |s| s.stub(:close => true, :puts => true) } end before { subject.receive_data(client) } it 'responds with a friendly message' do client.should have_received(:puts).with(described_class::HTTP_RESPONSE) end it 'does not issue system commands' do subject.should_not have_received(:system) end it 'closes connection' do client.should have_received(:close) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vagrant-notify-0.1.0 | spec/server_spec.rb |