is the study of how
contributes to meaning
var n = 21; function timesTwo() { n = n * 2; } timesTwo();
console.log(n); > 42
function timesTwo() { var n = 21; n = n * 2; } timesTwo();
console.log(n); > Uncaught ReferenceError: n is not defined
virus = Virus.new computer.destroy_with(virus)
ice_creams = [chocolate, strawberry] shawna.devour(chocolate) shawna.devour(strawberry) ice_creams.each do |ice_cream| shawna.devour(ice_cream) end
describe BankAccount do let(:account) { BankAccount.new } it 'has a $1000 withdrawal limit' do account.withdraw(5) expect(account.withdraw(1000)).to raise_error end end
describe BankAccount do let(:account) { BankAccount.new } it 'has a $1000 withdrawal limit' do account.withdraw(5) expect(account.withdraw(1000)).to raise_error end end
describe BankAccount do let(:account) { BankAccount.new } it 'has a $1000 withdrawal limit' do account.withdraw(5) expect(account.withdraw(1000)).to raise_error end end
describe BankAccount do
let(:account) { BankAccount.new }
it 'has a $1000 withdrawal limit' do
account.withdraw(5)
expect(account.withdraw(1000)).to raise_error
end
end
describe BankAccount do
let(:account) { BankAccount.new }
it 'has a $1000 withdrawal limit' do
account.withdraw(5)
expect(account.withdraw(1000)).to raise_error
end
end
describe BankAccount do
let(:account) { BankAccount.new }
it 'has a $1000 withdrawal limit' do
account.withdraw(5)
expect(account.withdraw(1000)).to raise_error
end
end
describe BankAccount do
let(:account) { BankAccount.new }
it 'has a $1000 withdrawal limit' do
account.withdraw(999)
expect(account.withdraw(1)).to raise_error
end
end
describe Employee do let(:employee) { Employee.new } it 'rejects expired toppings' do caramel = Topping.new('8 oz', '.5 oz', 'caramel', .25, 1.00, '01/01/2012') expect(employee.approve(caramel)).to be false end end
describe Employee do
let(:employee) { Employee.new }
it 'rejects expired toppings' do
caramel = Topping.new('8 oz', '.5 oz', 'caramel', .25, 1.00, '01/01/2012')
expect(employee.approve(caramel)).to be false
end
end
describe Employee do
let(:employee) { Employee.new }
it 'rejects expired toppings' do
caramel = Topping.new('8 oz', '.5 oz', 'caramel', .25, 1.00, '01/01/2012')
expect(employee.approve(caramel)).to be false
end
end
describe Employee do
let(:employee) { Employee.new }
it 'rejects expired toppings' do
caramel = Topping.new('8 oz', '.5 oz', 'caramel', .25, 1.00, '01/01/2012')
expect(employee.approve(caramel)).to be false
end
end
describe Employee do
let(:employee) { Employee.new }
it 'rejects expired toppings' do
caramel = Topping.new('8 oz', '.5 oz', 'caramel', .25, 1.00, '01/01/2012')
expect(employee.approve(caramel)).to be false
end
end
describe Employee do
let(:employee) { Employee.new }
it 'rejects expired toppings' do
topping = double(:topping)
allow(topping).to receive(:expired?) { true }
expect(employee.approve(topping)).to be false
end
end
describe IceCreamSundae do let(:chocolate) { Flavor.new } let(:sundae) { Sundae.new(chocolate) } let(:caramel) { Topping.new("caramel") } let(:hot_fudge) { Topping.new("hot fudge") } let(:whipped_cream) { Topping.new("whipped cream") } it 'should have a cherry on top' do first_scoop = Scoop.new(caramel) second_scoop = Scoop.new(hot_fudge) third_scoop = Scoop.new(whipped_cream) sundae.add_scoop(first_scoop) sundae.add_scoop(second_scoop) sundae.add_scoop(third_scoop) expect(sundae.valid?).to be false end end
describe IceCreamSundae do it 'should have a cherry on top' do sundae = build(:sundae, cherry: nil) expect(sundae.valid?).to be false end end
describe Scoop do it 'has valid toppings' do scoop = Scoop.new("bourbon salted caramel") expect(scoop.valid?).to be false end end
describe Scoop do
it 'has valid toppings' do
scoop = Scoop.new("bourbon salted caramel")
expect(scoop.valid?).to be false
end
end
describe Scoop do
it 'has valid toppings' do
scoop = Scoop.new("bourbon salted caramel")
expect(scoop.valid?).to be false
end
end
describe Scoop do
it 'has valid toppings' do
long_topping_name = "bourbon salted caramel"
scoop = Scoop.new(long_topping_name)
expect(scoop.valid?).to be false
end
end
describe Sundae do it 'should have valid toppings' it 'should have at least one scoop' it 'is 10% off on Sundae Sundae Sunday' it 'should have no more than 3 scoops' it 'has a cherry on top' it 'has only one topping per scoop' it 'has free sprinkles on Sundae Sundae Sunday' end
describe Sundae do describe 'scoop requirements' do it 'should have at least one scoop' end describe 'valid toppings' do it 'has a cherry on top' it 'has only one topping per scoop' end context 'on Sundae Sundae Sunday' do it 'is 10% off' it 'has free sprinkles' end end
it 'has a $1000 withdrawal limit'
it 'has a $1000 (exclusive) withdrawal limit'
it 'has valid toppings'
it 'has toppings with valid length names'
Mark McDonald
Geoff Geysmann
David Edwards