Skip to content

Instantly share code, notes, and snippets.

@mattb20
Created July 5, 2018 13:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattb20/c50851f5b3abe7ef0ada62af7d800136 to your computer and use it in GitHub Desktop.
Save mattb20/c50851f5b3abe7ef0ada62af7d800136 to your computer and use it in GitHub Desktop.
class Printer
def initialize
end
def output(bank)
bank.transaction_history.each do |transaction|
puts transaction.join( ' || ')
end
end
end
require 'printer'
require 'date'
describe Printer do
let(:printer) { described_class.new }
let(:bank) { double 'bank', :transaction_history [["date || credit || debit || balance"],["22/05/2018", '10.00', " ", '10.00']] }
it 'will print something as expected' do
expect(STDOUT).to receive(:puts).with("date || credit || debit || balance\n22/05/2018 || 10.00 || || 10.00\n");
printer.output(bank);
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment