Skip to content

Instantly share code, notes, and snippets.

@elle
elle / gist:3970695
Created October 29, 2012 00:39
STI and circular referencial association
FactoryGirl.define do
sequence :first_name { |n| "John #{n}" }
sequence :email { |n| "john#{n}@example.com" }
factory :employee do
first_name { generate(:first_name) }
last_name 'Smith'
email { generate(:email) }
@elle
elle / gist:4710618
Last active December 12, 2015 03:58 — forked from anonymous/gist:4705398
# Minitest examples
# wishful
describe Person do
describe 'indirect' do
subject { Person.new({pet: true}) }
it { must_be :pet? }
end
end
@elle
elle / letters.rb
Last active December 14, 2015 02:18
#! /usr/bin/env ruby
require 'minitest/autorun'
require 'minitest/spec'
class Letters
WORDS = %w.cat bat bath baths.
attr_accessor :letters
# Friday run sheet for Sydney workshop
--------------------------------------------------
## 5:00
Setup
- Eventbrite registration setup
- Name badges
- Setup projector screen
- Ensure wifi is working
- Setup sponsor banners
@elle
elle / Shakshuka
Last active March 30, 2020 19:41
Shakshuka recipes
# Shakshuka by Gilboa:
- Chopped onion
- Chopped red capcisum
- Chopped tomatoes
Fry for a few minutes till soft. Then add:
- Tomato paste in garlic or chilli flavour
- Crushed garlic
- a bit of salt, pepper and sweet paprika
Then add the eggs, with either chopped parsley or chopped coriander.
@elle
elle / test_helper.rb
Created November 19, 2013 10:22
test_helper.rb
ENV['RAILS_ENV'] = 'test'
require File.expand_path('../dummy/config/environment.rb', __FILE__)
require 'rails/test_help'
require 'minitest/autorun'
require 'minitest/spec'
require 'minitest/mock'
require 'capybara/rails'
require 'valid_attribute'
require 'debugger'
@elle
elle / minitest.rake
Created December 17, 2013 01:59
We use Rake::TestTask to create a new task. This task will also run the db:test:prepare task so that we don’t need to worry about running it manually when we create further migrations. The code for this task adds the test directory to the load paths and then runs any file under the test directory whose filename ends in _test.rb. Finally we set t…
# /lib/tasks/minitest.rake
require "rake/testtask"
Rake::TestTask.new(:test => "db:test:prepare") do |t|
t.libs << "test"
t.pattern = "test/**/*_test.rb"
end
task :default => :test
# ===================================================================================================================
# Template for generating a no-frills Rails application with support for Elasticsearch full-text search via Tire
# ===================================================================================================================
#
# This file creates a basic, fully working Rails application with support for Elasticsearch full-text search
# via the Tire gem [http://github.com/karmi/tire].
#
# You DON'T NEED ELASTICSEARCH INSTALLED, it is installed and launched automatically by this script.
#
# Requirements
@elle
elle / interaction_design_books.md
Created March 11, 2014 11:03
Interaction design reading list by Chris Murphy [https://github.com/fehler/curriculum]

Combined Reading List

We'd recommend the following books are read in alignment with the respective module content, however, this list provides an overview of the BDes (Hons) Interaction Design course reading list, broken down by year.

##Year 1

# instead of debugger, you could use byebug gem
# and then you do not need to require debugger
group :development, :test do
gem 'minitest'
gem 'awesome_print'
gem 'capybara'
gem 'database_cleaner', '~> 1.0'
gem 'debugger'
gem 'factory_girl_rails'
gem 'hirb'