- Grocery Shopping
- Go to the shops
- Get shopping
- Return home
- Put shopping in fridge
- Receive Fridge Delivery
- Wait for Curry's delivery
- Receive fridge from delivery
- Install fridge
This file contains hidden or 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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
class Header extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = {favouritecolour: "red"}; | |
} | |
This file contains hidden or 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
var shops = { | |
items: ["ham", "eggs", "spam"] | |
}; | |
var home = { | |
fridge: null | |
}; | |
var delivery = { | |
fridge: { |
This file contains hidden or 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
function groceryShopping() { | |
goToShops() | |
let shoppingBags = [...shops.items] | |
goHome() | |
setTimeout(() => { | |
home.fridge.contents = [...shoppingBags] | |
console.log("Shopping is in the fridge") | |
}, 0); | |
} |
This file contains hidden or 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
// Some variables to handle | |
var shops = { | |
items: ["ham", "eggs", "spam"] | |
} | |
var home = { | |
fridge: null | |
} |
This file contains hidden or 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 'sinatra/base' | |
class Echo < Sinatra::Base | |
get '/' do | |
erb :index | |
end | |
post '/echo' do | |
param['echo'] # I hope this does not contain an error! | |
end |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Echo</title> | |
</head> | |
<body> | |
<h1>Echo Generator</h1> |
This file contains hidden or 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
feature 'Echo' do | |
scenario 'Entering Hello echos Hello' do | |
visit '/' | |
expect(page).to have_content 'Echo Generator' | |
fill_in('echo', with: "Hello") | |
click_on 'Shout' | |
expect(page).to have_content 'Hello' | |
end | |
end |
This file contains hidden or 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
Rspec.describe Journey do | |
let(:method_of_transport_class_double) { double(:method_of_transport, new: method_of_transport_instance_double) } | |
let(:method_of_transport_instance_double) { double(:method_of_transport) } | |
let(:isolated_journey) { described_class.new("the shops", method_of_transport_class_double) } | |
it '#start calls start on the object contained in @method_of_transport' do | |
expect(method_of_transport_instance_double).to receive(:start) | |
isolated_journey.start |
This file contains hidden or 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
class Journey | |
def initialize(destination, mode_of_transport = Walk) | |
@destination = destination | |
@mode_of_transport = mode_of_transport.new | |
end | |
def start | |
@mode_of_transport.start(@destination) | |
end | |
NewerOlder