Sha256: ff918db74e69efcdaa0a00408678ad98ad97bf6c47b9828b444d174e91f76065
Contents?: true
Size: 1.11 KB
Versions: 15
Compression:
Stored size: 1.11 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Actions::PrintTitle do context '#initialize' do it 'requires a title' do expect { Actions::PrintTitle.new('title') }.not_to raise_error end it 'accepts a title width as well' do expect { Actions::PrintTitle.new('title', 25) }.not_to raise_error end end context '#run' do it 'prints a title' do action = Actions::PrintTitle.new('Hello World') result = capture(:stdout) do action.run end expect(result).to include('Hello World') end it 'prints a title with #' do action = Actions::PrintTitle.new('Hello World' ) result = capture(:stdout) do action.run end expect(result).to eq("###############\n# Hello World #\n###############\n\n") end it 'prints a title with 25 #' do action = Actions::PrintTitle.new('Hello World', 25 ) result = capture(:stdout) do action.run end expect(result).to eq("###########################\n####### Hello World #######\n###########################\n\n") end end end
Version data entries
15 entries across 15 versions & 1 rubygems