30 June, 2007

ActsAsAuthenticated in test_spec_on_rails

I was having trouble getting "login_as" from the ActsAsAuthenticated plugin to work with test/spec on Rails.

TechnoWeenie suggested doing a def login_as... within each context. (It no longer does; I've put the code from this post into that page now.) That didn't seem very DRY, so I tried including ActsAsAuthenticated all over the place. Nothing worked...

Until I realized the problem: each "context" block creates a new instance of Test::Unit::TestCase. I had assumed it created a new instance of XxxControllerTest. Alas. Easy to fix. Just putTest::Unit::TestCase.send(:include, AuthenticatedTestHelper) before the opening of your XxxControllerTest.

For example:

require File.dirname(__FILE__) + '/../test_helper'
require 'welcome_controller'

Test::Unit::TestCase.send(:include, AuthenticatedTestHelper)

# Re-raise errors caught by the controller.
class WelcomeController; def rescue_action(e) raise e end; end

class WelcomeControllerTest < Test::Unit::TestCase
  fixtures :people
  def setup
    @controller = WelcomeController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
  end
  context "A logged-in person" do
    setup do
      use_controller WelcomeController
      login_as :yvette_moore
    end
     ...
  end
end

29 June, 2007

My Keirsey Profile

According to Keirsey, I'm an ENTP: The Inventor. II. NT, the RATIONALIST (6% of population) GENERAL DESCRIPTION:

  • Technology-oriented / Motto: Knowledge is power
  • Strategists: Designers and executers of a plan
  • NTs are task oriented; they determine how things get done
  • Curious yet skeptical; “Why?” drives their actions
  • Objective, logical, and analytical
  • Detached
  • Focus on things; ideas
  • NTs eat, sleep, and breathe answers to a single question
  • Uncompromising quest for competence, excellence, to be at the top - not near the top)
  • Worst thing for NTs: to be normal
  • Set extremely high standards / high bar
  • Also interested in making you competent; has little tolerance for incompetence; you are no longer of any value to them; probably a large number of people are placed in the non-value category
  • Seek to lift up the level of the environment / the organization
  • Strong need for predictability
  • Visionary – constantly brainstorming about taking things to the next level of competence/excellence
  • There is always something wrong with today – NTs are self-correcting either mentally or through maneuvers
  • Perceive that they are teetering on the brink of disaster
  • Fear of not succeeding is greater than the fear of failing
  • They have the gift to get people to see where they are today and where they are going
DOWNSIDE:
  • Encoded is an unreasonable bar of excellence
  • Great facility with words
  • Plagued with the fear of being found out: there may be a crack in the armor
  • NTs may never discover that the earlier tapes played in their heads (one’s value as a human being is determined by one’s level of excellence) are not the truth.
  • They have this internal competency check list that is, all too often, uncompromising.
  • By failing the internal competency checklist … bad things will happen. Likely that there are a large number of people who question: are you competent by my criteria / very few people will fit into their inner core of close and acceptable associates
  • Always upping the bar
  • They go to jobs that they know they will be good at
  • Theoretically, they don’t finish anything; it’s always in a state of improvement, modification, expanding
  • If they conceptualize something beyond their perceived capacity, they disengage or / they will focus on ways to get their arms around it to make it manageable
  • NTs won’t lie; they will word-smith the truth
Needs a Sensing Type to ...
  • bring up pertinent facts
  • apply experience to problems
  • read the fine print in a contract
  • notice what needs attention now
  • have patience
  • keep track of essential details
  • face difficulties with realism
  • remind them that the joys in the present are important
Needs a Feeling Type to...
  • persuade
  • conciliate
  • forecast how others will feel
  • arouse enthusiasm
  • teach
  • sell
  • advertise
  • appreciate the thinker
CAREERS: Leans toward science and technology; systems analysts, research and development INTELLIGENCE: Strategic intelligence; everything must be analyzed in terms of its how and why RULES: Challenge all rules and dismiss any that do not make sense SEARCHES FOR TWO THINGS: To be a part of a team yet maintain a level of detachment / autonomy

21 June, 2007

Some Band/Album Names

Some possibly great band or album names:

  • Jerome Sheffield and the Wrong Goldfish
  • Three Halves Make a Whole Turquoise Sandwich
  • Eight Full Sundays
  • The Standards
  • Octothorp
  • Prefixes to Problems
Some really bad ones:
  • If, But, When, ...
  • Intricate and Restful
  • Refurbished Pickles
  • Yessiree, I Am Indeed a Proctologist
  • Teh H4x0r5
  • Fiends with Hairnets
  • Big Buttresses
  • Nothing to See Here; Move Along

Problems with a Democratic Republic

Scott Adams writes that he thinks Michael Bloomberg might be the man to stop this inane, barbaric feast upon "flip-floppers." I hope it's true.

But it's not the only problem with representative democracy. The Federalist Papers make many great arguments why our system is the best that humans can achieve, but it really fails in one area: public bias.

This past week, the Economist had a great story on public bias. The author lists four biases: "first, people do not understand how the pursuit of private profits often yields public benefits: they have an anti-market bias. Second, they underestimate the benefits of interactions with foreigners: they have and anti-foreign bias. Third, they equate prosperity with employment rather than production: Mr Caplan calls this the "make-work bias". Finally, they tend to think economic conditions are worse than they are, a bias towards pessimism."

I am now extremely disheartened that any politician would be able to convince the public that his or her policies are good given these biases. Congress and the President have done some astounding work (and some necessary compromises) to build a strong piece of legislation on immigration reform, but the public hates it . . . and it isn't helping Congress's report card.

Maybe the immigration bill isn't perfect. Maybe it's even downright bad. Certainly with all this bias, though, there have to be plenty of instances where the people disagree with a good idea.