spec/lib/formats/console_spec.rb in hieracles-0.2.0 vs spec/lib/formats/console_spec.rb in hieracles-0.2.1

- old
+ new

@@ -14,32 +14,53 @@ { 'Node' => 'fqdn', 'Farm' => 'farm' } ) + allow(node).to receive(:notifications).and_return(nil) } it "outputs proper text" do - expect(console_format.info nil).to eq expected + expect(console_format.info []).to eq expected end end + describe ".facts" do + let(:expected) { + "\e[97mNode \e[0m fqdn\n" + + "\e[97mFarm \e[0m farm\n" + } + before { + allow(node).to receive(:facts).and_return( + { + 'Node' => 'fqdn', + 'Farm' => 'farm' + } + ) + allow(node).to receive(:notifications).and_return(nil) + } + it "outputs proper text" do + expect(console_format.facts []).to eq expected + end + end + + describe ".files" do let(:expected) { "path1\npath2\n" } before { allow(node).to receive(:files).and_return(['path1', 'path2']) } it "outputs proper text" do - expect(console_format.files nil).to eq expected + expect(console_format.files []).to eq expected end end describe ".paths" do let(:expected) { "path1\npath2\n" } before { allow(node).to receive(:paths).and_return(['path1', 'path2']) } it "outputs proper text" do - expect(console_format.paths nil).to eq expected + expect(console_format.paths []).to eq expected end end describe ".build_head" do let(:expected) { "[-] (merged)\n\e[31m[0] path1\e[0m\n\e[32m[1] path2\e[0m\n\n" }