Sha256: baf51228a53e7b61b609255a03a2c34dfc733fcecbc4f4e3b431b65a3a99db3f
Contents?: true
Size: 1.34 KB
Versions: 2
Compression:
Stored size: 1.34 KB
Contents
require 'spec_helper' describe Deplomat::Node do describe "logging" do before(:each) do @fixtures_dir = Dir.pwd + "/spec/fixtures" @node = Deplomat::Node.new(logfile: "#{@fixtures_dir}/deplomat.log", log_to: [:file, :stdout]) end after(:each) do @node.log_to = [] @node.remove("#{@fixtures_dir}/deplomat.log") end it "logs to the stdout" do expect($stdout).to receive(:print).exactly(4).times @node.execute("ls #{@fixtures_dir}/dir1") end it "logs to a log file" do @node.log_to = [:file] @node.execute("ls #{@fixtures_dir}/dir1") log = File.readlines("#{@fixtures_dir}/deplomat.log") expect(log.size).to eq(4) end it "puts additional messages into the terminal when required" do expect($stdout).to receive(:print).once.with("hello\n".white) expect($stdout).to receive(:print).once.with("--> ls /home/roman/Dropbox/Work/my_libs/deplomat/spec/fixtures/dir1\n".white) expect($stdout).to receive(:print).once.with(" file1\n".light_black) expect($stdout).to receive(:print).once.with(" file2\n".light_black) expect($stdout).to receive(:print).once.with(" subdir1\n".light_black) expect($stdout).to receive(:print).once.with("bye\n".white) @node.execute("ls #{@fixtures_dir}/dir1", message: ["hello", "bye"]) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
deplomat-0.1.3 | spec/node_spec.rb |
deplomat-0.1.1 | spec/node_spec.rb |