This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test_helper' | |
class EntriesAdminControllerTest < ActionController::TestCase | |
tests Admin::EntriesController | |
include Devise::TestHelpers | |
def setup | |
@admin = Factory.create(:user) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Factory.define :role do |r| | |
end | |
Factory.define :user do |u| | |
u.username 'admin' | |
u.email '[email protected]' | |
u.password 'password' | |
u.password_confirmation 'password' | |
u.roles {|r| [ (r.association :role, :title => 'Refinery'), | |
(r.association :role, :title => 'Superuser')] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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.""" |