Skip to content

Instantly share code, notes, and snippets.

View mattb20's full-sized avatar

Matthew Burgoyne mattb20

  • Usecure
  • Leeds, UK
View GitHub Profile
while true do
puts 'Enter north or south:'
user_input = gets.chomp
if user_input == 'north'
puts 'You are in a scary cave.'
puts 'Enter north or south:'
user_input = gets.chomp
if user_input == 'north'
puts 'You walk into sunlight.'
break
sum = 0
puts "Please enter a number:"
input = gets.chomp
while input != "Stop"
if input.to_i.class ==
Integer
sum += input.to_i
puts "Please enter a number:"
input = gets.chomp
else
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
class Printer
def initialize
end
def output(bank)
bank.transaction_history.each do |transaction|
puts transaction.join( ' || ')
end
end
end
@mattb20
mattb20 / ruby_books.md
Created July 5, 2018 10:59 — forked from baweaver/ruby_books.md
A list of books for learning and expanding on your Ruby knowledge.

Ruby Book List

Learning Ruby

You're taking your first steps into Ruby

A good introduction to programming in general. Easy on newer programmers.

it 'has a method that will call the transaction class' do
bank.send(:make_deposit, 5);
Transaction.should_receive(:new);
end
def make_deposit(amount)
Transaction.new(self, 'deposit', amount);
end
{
"src_folders" : ["./spec/features"],
"output_folder" : "reports",
"custom_commands_path" : "",
"custom_assertions_path" : "",
"page_objects_path" : "",
"selenium" : {
"start_process": false,
var MongoClient = require('mongodb').MongoClient;
var uri = "mongodb+srv://kay:myRealPassword@cluster0.mongodb.net/test";
MongoClient.connect(uri, function(err, client) {
const collection = client.db("test").collection("devices");
// perform actions on the collection object
client.close();
});
create_table "walls", force: :cascade do |t|
t.bigint "user_id"
t.index ["user_id"], name: "index_walls_on_user_id"
end