Skip to content

Instantly share code, notes, and snippets.

View RobAWilkinson's full-sized avatar

Rob Wilkinson RobAWilkinson

  • @oddballio
  • Austin, TX
View GitHub Profile
class Bird
attr_reader :name
@@count = 0
def initialize(name)
@name = name
@@count += 1
end
def self.count
@@count
end

#Rails Helpers and Helper Spec

LEARNING OBJECTIVES

  • Understand and explain what helper methods are.
  • How to create custom helper methods.
  • Learn how to test helpers and create them using TDD.

Definition: is a module which contains methods that are vital for the simplification and the dryness of your views.

Factory Girl

Update Your Gemfile

gem "factory_girl_rails", "~> 4.0"
Fruit.create([
{ name: "banana" },
{ name: "orange" },
{ name: "mango" },
{ name: "strawberry" },
{ name: "blueberry" },
{ name: "papaya" },
{ name: "wheatgrass"},
{ name: "pineapple"}
])
require 'rails_helper'
RSpec.describe Dog, :type => :model do
let(:subject) { Dog.new(name: 'Beethoven', nickname: 'The Master', current_shelter: 1, shots: ['rabbies', 'distemper']) }
describe '#name' do
it 'responds to name' do
expect(subject).to respond_to :name
end

#Ruby Rspec

Let's dig into some really groovy testing with Rspec!

##Rspec & Ruby

###Learning Objectives

  • Understand & articulate the value of testing in programming
  • Be able to setup Rspec in a project

#Ruby Rspec

Let's dig into some really groovy testing with Rspec!

##Rspec & Ruby

###Learning Objectives

  • Understand & articulate the value of testing in programming
  • Be able to setup Rspec in a project
@RobAWilkinson
RobAWilkinson / Ruby.rb
Created April 17, 2015 15:47
Ruby quiz
class Rubyists
def stuff
end
end

#Title: Rental App

###Type:

  • Lab / Homeowrk

###Time Required:

  • 2 hours+

###Prerequisites:

  • Ruby