Initial commit of new pdxspurs for Rails 4, starting from scratch
Doing it test-driven. Letting the tests tell me each line of code I have to write,
rather than trying to port an entire project from Rails 3 to 4.
Getting somewhere. Tests don't pass, but they are telling me what to add to the minimalist codebase I now have.
It's working. Instead of porting a complete app, start a new one and, with TDD driving you along, gradually import the old project in bits.
I don't know why I thought the tests were passing. Turns out that create_user tries to use user_name instead of email.
Moved username to email. Now test fails because roles don't exist yet. Getting somewhere.
Getting along nicely
start-app on 3001
Beginnings of integration tests
Gradually building up the app with TDD. Latest is - it doesn't know what 'current_user' is. Import Authlogic code from pdxspurs.
Now the test says UserSession is an unknown class. I'm going to start importing code (like user_session.rb) from a working Rails 3 app, rather than pdxspurs.
It looks like webrat assumes it should be using action_controller/integration, because when you call
the fill_in method, it explodes with "LoadError: cannot load such file -- action_controller/integration"
Getting further. Found advice on why fill_in was raising some complaint about not finding action controller integration or something, so I did this:
require 'webrat/core/matchers'
include Webrat::Methods
Webrat.configure do |config|
  config.mode = :rack # not :rails - http://paikialog.wordpress.com/2012/02/11/webrat-no-such-file-to-load-action_controllerintegration/
end
Getting further - it can't find field 'user_session_email' which is fair enough. Got those wierd
'wrong no. of argument' errors randomly when doing User.create or User.find_by_email. Someone is
overwriting basic Rails methods. Authlogic?
Now we're getting somewhere. Complaining about the lack of a UserSessionsController. That's easy to fix - I've got a few of those.
Got the user_sessions_controller, added the require_user etc. filters in application_controller, now it's looking for the user_session erb files.
Not logging in yet
`
Tring RSpec to find errors in logging in - 'wrong no. of arguments'
Back to this error:
     Failure/Error: 2.times { FactoryGirl.create( :user ) }
     ArgumentError:
       wrong number of arguments (2 for 1)
     # /Users/rod/dev/edge/activerecord/lib/active_record/dynamic_matchers.rb:76:in `find_by_persistence_token'
A mystery
Tried replacing FactoryGirl.create :user with a create_user method - but got the same mysterious 'wrong no. of arguments' error in the
middle of active record, when it's doing a find by persistence token