Skip to content

Instantly share code, notes, and snippets.

View joahking's full-sized avatar
🏠
Working from home

Joaquin Rivera Padron joahking

🏠
Working from home
View GitHub Profile
When /^I fill the captcha incorrectly$/ do
captcha_evaluates_to false
end
When /^I fill the captcha correctly$/ do
captcha_evaluates_to true
end
# if you move this method correctly to features/support/recaptcha_helper.rb and include it in World => you feature will fail!
def captcha_evaluates_to(result)
@joahking
joahking / devise_bdd_template.rb
Created January 9, 2010 15:43
template for rails with devise as auth, rspec and cucumber
# Delete unnecessary files
run 'rm README'
run 'rm public/index.html'
run 'rm public/favicon.ico'
run 'rm public/robots.txt'
run 'cp config/database.yml config/database.yml.example'
file '.gitignore', <<-END
log
# this is an AR model class
named_scope :privates, :conditions => { :public => false }
named_scope :named_like, lambda { |name| { :conditions => "name LIKE '#{name}%'" }}
# we want to concatenate named_scopes at later points in code
def self.by_privacy_and_name(privates = false, name = nil)
# we want a named_scope to concatenate other namescopes afterwards
gs = if privates
self.privates # with named_scopes everything runs fine
else
# now there is no metaprogramming involve, but finger saving it is indeed :-)
describe 'active ones' do
it 'should require required attributes' do
REQUIRED_ATTRS = [ :email, :name, :birthday, :phone, :address, :city,
:province, :postal_code,
:country, :nationality,
:employment_status ] unless defined?(REQUIRED_ATTRS)
Candidate.new.attribute_names.each do |attr|
require 'capitate'
require 'capitate/recipes'
set :project_root, File.dirname(__FILE__)
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
set :application, "misustento"
set :domain, "misustento.com"
set :domain_aliases, ["misustento.es"]
<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns:gml='http://www.opengis.net/gml' xmlns:georss='http://www.georss.org/georss' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:gCal='http://schemas.google.com/gCal/2005' xmlns:gd='http://schemas.google.com/g/2005' gd:etag='W/"A04BQH47eCp7I2A9WxJTFEQ."'><id>http://www.google.com/calendar/feeds/calendar%40minuevavida.es/private/full</id><updated>2009-04-23T15:19:11.000Z</updated><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2005#event'/><title>calendar@minuevavida.es</title><subtitle>Calendario de Reuniones de La Iglesia Evangelica Nueva Vida</subtitle><link rel='alternate' type='text/html' href='http://www.google.com/calendar/embed?src=calendar@minuevavida.es'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.google.com/calendar/feeds/calendar%40minuevavida.es/private/full'
insoshi searches_controller_spec.rb fail, are you seing this too?
$ git log -n1
commit 8764d0977c15fe360e34b82e54ca76639c73472f
Author: Michael Hartl <michael@michaelhartl.com>
Date: Thu Apr 9 12:06:26 2009 -0700
Switched to the MIT License
$ rake ultrasphinx:configure RAILS_ENV=test
@joahking
joahking / a bunch of celerity specs on GMap
Created March 8, 2009 15:36
does GMap breaks celerity/HtmlUnit ?
h1. We are spec-ing that celerity (HtmlUnit) does not break after a call to GMap API
Does specs pass for you??? any help would be appreciated :-)
on files you find the web app and the celerity specs.
h2. The rack app.
celerack.rb is a rack that returns a simple page with a form and 3 buttons:
# 1. submit one
#!/usr/bin/env jruby
# fast script for running javascript unit tests
# requires a bit of setup, as it uses jruby
# see http://celerity.rubyforge.org/
require "rubygems"
require "celerity"
module Javascript
# celerity is not getting the ajax response back
# this is a stack trace from http://github.com/joahking/cukes/tree/master/ where we are
# running cucumber features for webrat together with celerity
# please refer to project to see details
# we ran this:
$ cucumber -p celerity
(rdb:1) c
When I follow "ajax link" # features/step_definitions/culerity_steps.rb:40