Skip to content

Instantly share code, notes, and snippets.

require 'test_helper'
class EntriesAdminControllerTest < ActionController::TestCase
tests Admin::EntriesController
include Devise::TestHelpers
def setup
@admin = Factory.create(:user)
end
@jslag
jslag / factories.rb
Created June 23, 2011 20:28
create an admin in refinerycms
Factory.define :role do |r|
end
Factory.define :user do |u|
u.username 'admin'
u.email 'admin@example.com'
u.password 'password'
u.password_confirmation 'password'
u.roles {|r| [ (r.association :role, :title => 'Refinery'),
(r.association :role, :title => 'Superuser')] }
before_filter :refinery_use_ssl
def refinery_use_ssl
if (request.fullpath =~ /^\/refinery/) && (ENV['RAILS_ENV'] == 'production')
ssl_rewrites = {
'mysite-dev.mydomain.com' => 'mysite-dev.heroku.com',
'mysite-stage.mydomain.com' => 'mysite-stage.heroku.com',
'mysite.com' => 'mysite.heroku.com',
}
if ssl_rewrites[request.host] && (request.port != 443)
@jslag
jslag / web2py_proxy.py
Created January 23, 2010 20:11
beginnings of a proxy for web2py. See http://trac.sahanapy.org/wiki/BluePrintGISProxy for more
# coding: utf8
def index():
"""Based on http://trac.openlayers.org/browser/trunk/openlayers/examples/proxy.cgi
This is a blind proxy that we use to get around browser
restrictions that prevent the Javascript from loading pages not on the
same server as the Javascript. This has several problems: it's less
efficient, it might break some sites, and it's a security risk because
people can use this proxy to browse the web and possibly do bad stuff
with it. It only loads pages via http and https, but it can load any
content type. It supports GET and POST requests."""