Skip to content

Instantly share code, notes, and snippets.

View aeden's full-sized avatar

Anthony Eden aeden

View GitHub Profile
World(Rack::Test::Methods)
Given /^I am a valid API user$/ do
@user = Factory(:user)
authorize(@user.email, @user.password)
end
Given /^I send and accept XML$/ do
header 'Accept', 'text/xml'
header 'Content-Type', 'text/xml'
Given /^I send and accept JSON$/ do
header 'Accept', 'application/json'
header 'Content-Type', 'application/json'
end
Given /^I am a valid API user$/ do
@user = Factory(:user)
authorize(@user.email, @user.password)
end
World(Rack::Test::Methods)
@aeden
aeden / resque.rb
Created October 18, 2010 10:02
Place in features/support to make Resque workers execute immediately
Before do
module Resque
def self.enqueue(klass, *args)
klass.perform(*args)
end
end
end
ruby-1.8.7-p249 > Geokit::Bounds.from_point_and_radius([53.91848,-122.776584], 4993)
=> #<Geokit::Bounds:0x1050e7580 @ne=#<Geokit::LatLng:0x1050e8e08 @lat=53.897792470202, @lng=-43.4942376451051>, @sw=#<Geokit::LatLng:0x1050e8e58 @lat=-18.265247529798, @lng=-202.058930354895>>
ruby-1.8.7-p249 > Geokit::Bounds.from_point_and_radius([53.91848,-122.776584], 4997)
=> #<Geokit::Bounds:0x1050dee08 @ne=#<Geokit::LatLng:0x1050e0690 @lat=53.8399645290606, @lng=-43.4579700787395>, @sw=#<Geokit::LatLng:0x1050e06e0 @lat=-18.3230754709394, @lng=-202.09519792126>>
source :rubygems
gem "rails", "= 2.3.8"
gem "pg"
gem "acl9"
gem 'authlogic'
gem 'formtastic'
gem 'paperclip'
gem 'httparty'
gem "searchlogic"
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun_opts = rerun.to_s.strip.empty? ? "--format progress features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
std_opts = "#{rerun_opts} --format rerun --out rerun.txt --strict --tags ~@wip --tags ~@pending --color"
all_opts = "--format progress --strict --tags ~@wip --tags ~@pending --color"
%>
autotest: --format pretty --tags @wip --wip --tags ~@spreedly features
autotest-all: --format progress --tags ~@pending --tags ~@spreedly features
default: <%= std_opts %>
all: <%= all_opts %>
package org.jruby.util;
import com.martiansoftware.nailgun.NGContext;
import org.jruby.Main;
import org.jruby.RubyInstanceConfig;
import org.jruby.ast.executable.Script;
import org.jruby.exceptions.MainExitException;
import org.jruby.exceptions.ThreadKill;
public class NailMain {
class DubyApp < HttpServlet
def_edb(list, 'com/ribrdb/list.dhtml')
def doGet(request, response)
@posts = Post.all.run
response.getWriter.write(list)
end
def doPost(request, response)
post = Post.new