Skip to content

Instantly share code, notes, and snippets.

View hyperbolic-motion's full-sized avatar

hyperbolic-motion

View GitHub Profile
@hyperbolic-motion
hyperbolic-motion / gist:2456238
Created April 22, 2012 05:18
Test: add factory_girl syntax methods to test case
class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting
# fixtures :all
# Shortcut for Factory girl
include FactoryGirl::Syntax::Methods
@hyperbolic-motion
hyperbolic-motion / _vertical_menu.html.erb
Created April 16, 2012 14:13
Helper: active_link_to - is_active_link?
is_active_link?(self.send(ci.url), [ci.slashed_controller, ci.actions.split(" ") ])
@hyperbolic-motion
hyperbolic-motion / gist:2388654
Created April 14, 2012 23:33
Comment: standard description
# ----------------------------------------------------------------------
# Description
# ----------------------------------------------------------------------
# TEST: Pending
# ----------------------------------------------------------------------
@hyperbolic-motion
hyperbolic-motion / gist:2381065
Created April 13, 2012 23:54
Rails: the opposite of blank?
present?
@hyperbolic-motion
hyperbolic-motion / gist:2380657
Created April 13, 2012 22:52
Rspec: test factory works as advertised
require 'spec_helper'
# -------------------------------------------------
# Just build a model instance using a factory
# and assert that it is valid
#
# Model => model class
# @base_model => model instance
# :model => factory name
#
@hyperbolic-motion
hyperbolic-motion / gist:2380619
Created April 13, 2012 22:45
Rails: basic crud controller conent
# --------------------------------------------------------------------------
# Basic rails CRUD controller snippet
# Find all:
# model => replace with the instance variable
# Model => replace with the class name
# --------------------------------------------------------------------------
def index
@models = Model.all
end