Skip to content

Instantly share code, notes, and snippets.

require 'test_helper'
class HostsControllerTest < ActionController::TestCase
context "Logged in as admin" do
setup do
@user = Factory.build(:admin_user) ## build, not create since it won't hit the database then
HostsController.any_instance.stubs(:current_user).returns(@user)
end
context "on INDEX action" do
Factory.define :admin_user, :class => "user" do |f|
f.email "daniel.mcnevin@something.com"
f.first_name "Daniel"
f.last_name "McNevin"
end
class ApplicationController < ActionController::Base
include Esc::Authentication
before_filter :require_user
before_filter :set_user
end
class User < ActiveRecord::Base
establish_connection(
YAML.load_file("#{Rails.root}/config/sessions_database.yml")[Rails.env]
)
end
rvm install jruby
rvm use jruby
gem install redcar
function rc() {
rvm jruby -S ~/.rvm/gems/jruby-1.5.1/bin/redcar $@ 1> /dev/null 2>&1 &
}
ActionController::Base.session = {
:key => '_sso_session',
:secret => 'a really long hex string'
}
config.action_controller.session = {
:domain => ".rails.local"
}
Rails.application.config.session_store :cookie_store, {
:domain => '.rails.local',
:key => '_sso_session',
:secret => 'the same really long hex string'
}
Rails.application.config.session_store :cookie_store, {
:domain => '.rails.local',
:key => '_sso_session'
}
Rails.application.config.secret_token = 'the same really long hex string'