Skip to content

Instantly share code, notes, and snippets.

@jcotzin
jcotzin / ReadMe.md
Last active July 22, 2016 02:46 — forked from tjr05d/ReadMe.md
Activity for students to practice creating before and after filters

#Before and After Filters

##Instructions

  1. Fork the code from the following Gist.
  2. Create your own Gist with a refactored version of this users controller using filters(before_action, and after_action)
  3. Submit the Gist of your refactored code in the prompt on Goodmeasure week 5
  4. Good Luck!
.header {
border:1px dotted gray;
margin: 5px 5px 5px 5px;
padding: 5px 5px 5px 5px;
display: flex;
justify-content: space-between;
}
.header h1 {
margin-left: 29px;
class BankAccount
attr_accessor :balance, :name
@@minimum_balance = 200
@@overdraft_fee = 25
def self.overdraft_fee=(overdraft_fee)
@@overdraft_fee=overdraft_fee
end
require './bank_account'
describe BankAccount do
it "is created with an opening balance and the name of the client" do
account = BankAccount.new(500, "Sarah")
expect(account).to be_a(BankAccount) #be_a specifies that it's a certain class
end
it "can report it's balance" do
account = BankAccount.new(500, "Sarah")
expect(account.balance).to eq(500) #eq checks that they're equal
class UrlParser
def initialize(new_url)
@new_url=new_url
end
def scheme
@new_url.split(':')[0]
end
def domain
def game
puts "~~~~Welcome to the afterlife!~~~~~"
puts "Reincarnation sequence..."
puts "..."
puts "commence."
puts "In your previous life, were you GOOD or BAD?"
print ">"
behavior = gets.chomp.downcase
if behavior == "good"