Skip to content

Instantly share code, notes, and snippets.

View jordanmaguire's full-sized avatar

Jordan Maguire jordanmaguire

  • Down Under Software Consulting
  • Perth
  • 15:10 (UTC +08:00)
View GitHub Profile
@jordanmaguire
jordanmaguire / bad_rspec.rb
Created June 26, 2012 01:31
The issue that caused me to devise my newer RSpec pattern
let(:vehicle) { FactoryGirl.create(:vehicle, :vehicle_model => vehicle_model, :type_of_sale => type_of_sale) }
let(:vehicle_model) { nil }
let(:type_of_sale) { "New" }
@jordanmaguire
jordanmaguire / original_wizard.rb
Created November 2, 2012 12:50
Original Wizard
class OnlineEnquiryWizard < EnquiryWizard
# Called within the CapacityCheckController to find which step to go to
# if 'previous' is pressed on the first step of the first CapacityCheck
def step_before_capacity_check
if @object.vehicle_selection_method == "none"
"select_vehicle"
else
"duty_of_disclosure"
end
@jordanmaguire
jordanmaguire / erd_builder.rb
Created September 16, 2013 02:35
ERDBuilder using mother flipping ruby-graphviz
require 'rubygems'
require 'graphviz'
class ERDBuilder
attr_reader :name
def add_entity(name)
ERDEntity.new.tap do |entity|
entity.build(graph: graph, name: name)
erd = ERDBuilder.new
erd.begin_system("Infoamatica")
venue = erd.add_entity("Venue")
venue.attributes = {name: :string}
user = erd.add_entity("User")
user.attributes = {email: :string, password: :string}
erd.associate(user, venue, {association: :many_to_one, name: "Association"})