OpenID doesn’t solve the entire problem…

So it looks like I have to create the whole user model anyway. Blast.

I could use Facebook Connect or Twitter OAuth, but then users without a Facebook or Twitter account (they do exist- but mostly out of some *principal-based* logic) wouldn’t be able to grow moustaches for charity.

Posted: March 9th, 2010 | Author: jay | Filed under: Code | Tags: , , , , , , , | No Comments »

Testing helpers in Sinatra

How do you test your helper methods in a Sinatra::Base app?

1
2
3
4
5
6
7
module FundAStache
  module Helpers    
    def logged_in?
      false # you shall not pass...
    end
  end
end

Include them in your tests…

1
2
3
4
class FundastacheUserTest < Test::Unit::TestCase
  include Rack::Test::Methods
  include FundAStache::Helpers
  ...
Posted: March 9th, 2010 | Author: jay | Filed under: Code | Tags: , , , , , | No Comments »

Digging discoverable OpenID providers

Here’s a list of big-time OpenID providers that are discoverable. This means you don’t need an exact URL, which is cool…

  • Google: https://www.google.com/accounts/o8/id
  • Yahoo: http://yahoo.com
  • MySpace: http://myspace.com
  • myOpenID: hhttp://myopenid.com

Additionally, if you have Google Apps, you can craft an OpenID URL like this: https://www.google.com/accounts/o8/site-xrds?hd=example.com — Hmm, but it doesn’t seem to work… will update if I figure it out.

Posted: March 9th, 2010 | Author: jay | Filed under: Code | Tags: , , | No Comments »

Here’s what my test_helper.rb file looks like…

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require 'fundastache'
require 'test/unit'
require "rack/test"
require "rack/flash/test"
 
ENV['RACK_ENV'] = 'test'
 
# set test environment
set :environment, :test
set :run, false
set :raise_errors, true
set :logging, false
 
DataMapper.setup(:default, "sqlite3::memory:") 
DataMapper.auto_migrate!
Posted: March 9th, 2010 | Author: jay | Filed under: Code | Tags: , , , | No Comments »