Skip to content

Instantly share code, notes, and snippets.

@dfmonaco
dfmonaco / _test.rb
Created November 30, 2012 14:40 — forked from jcoglan/_test.rb
$VERBOSE = nil
require File.expand_path('../rooby', __FILE__)
Person = Rooby::Class.new 'Person' do
define :initialize do |name|
@name = name
end
define :name do
@dfmonaco
dfmonaco / ejemplo.feature
Created November 27, 2012 00:05
cucumber in spanish
Característica: Controlar el Ingreso al sistema
Para evitar que cualquier persona use el sistema
Como dueño del laboratorio
Quiero dejar ingresar solo a usuarios registrados
Antecedentes:
Dado que existe el siguiente usuario registrado:
| Usuario | Contraseña |
| fabian | fabian_2012 |
@dfmonaco
dfmonaco / _readme.md
Created November 7, 2012 12:13 — forked from blowmage/_readme.md
Presenters in Rails, using modules

Presenters in Rails

I have bemoaned the lack of a ViewModel in Rails many times, and I prefer using Presenters to simulate a ViewModel. But it turns out there is an object that does represent the state of the view in Rails apps. Its an instance of ActionView::Base that the controller calls view_context. We don't have much control of this object, but it seems like a logical place to put our view-specific behavior.

This code is an attempt at creating Presenters using modules. The module will be mixed into the view_context object. This is very similar to how a Decorator module will be mixed into a model object, only instead of being specific to the model is it specific to the view.

This means that testing your presenter is no different than testing any other module. So relying on dependencies such as other methods or instance variables can make testing difficult.

@dfmonaco
dfmonaco / 1-session.sh
Created November 1, 2012 17:04 — forked from vjt/1-session.sh
vjt's tmux RVM + ViM IDE setup
#!/bin/sh
#
# IDE Session starter - you should save this script as ~/bin/session, make it
# executable with chmod +x ~/bin/session, and then make a symlink to it for
# every application you want to start.
# E.g. ln -s session ~/bin/members creates a "members" symlink, and when you'll issue
# "members" on the command line this script will:
# Check if a tmux session named "members" exists