Created
July 5, 2018 15:45
-
-
Save mattb20/6eb5e9a388e356dc6be7a45f9e09ed5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
class Printer | |
def initialize | |
end | |
def output(bank) | |
bank.transaction_history.each do |transaction| | |
puts transaction.join( ' || ') | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment