RailsConf notes - Kevin Barnes - In Praise of Non-Fixtured data
Fixtures bad: Get highly unmanageable, especially when someone decides to import real data (:user_275, :user_276...) Live outside test. Can't change loaded values easily. Factories good: Let you use sensible labels and tweak the created data. They reduce dependence on external data (manipulate values right in the test). FactoryGirl: http://github.com/thoughtbot/factory_girl/tree/master spec/factories/first_model.rb second_model.rb... Code: Factory.define :user {|f| f.name 'Joe'; f.zip '34279'; f.association :employer} Factory(:user).should be_valid Factory(:user, :name => nil).should_not be_valid .association calls another factory (that you define) to generate associated model object. Object Daddy: http://github.com/flogic/object_daddy/tree/master spec/exemplars/*_exemplar.rb Code: class User generator_for :name => 'Test User' generator_for :ssn, :start => '12343214' do {|prev| prev.succ} end @user = User.generate! @user.should be_valid [Barnes likes ObjectDaddy. I don't 'cause of modificat Others: machinist foundry fixjourRead more...
Notes from RailsConf - ActiveScaffold BoF session...
Thanks to Mike Gaffney and Kenney Ortmann for hosting this session, and for writing a cool framework!
Install: script/plugin install git://github.com/activescaffold/active_scaffold.git Site says to pass -r rails-2.2 option; HEAD works fine for Rails 2.3. Setting up a quick test app in Rails 2.3: Create app/views/layouts/application.html.erb: Ensure it contains a default HTML document. Ensure it has in the body. Add these lines to the HEAD tag: Create a model with a few fields and a controller. On your controller, add: active_scaffold :model_name Go view the index for the model (no need to create index.html.erb, def index, etc.): You should have full CRUD, sorting by column, etc. Customizing: ActiveScaffold.set_defaults {|config| ...} in your application controller. Model-specific settings in individual controllers. Override ActiveScaffold's default views by creating a special folder in your views directory. Additional notes: Home page doesn't get updated as often as it should, but project is being actively maintained and used, and will support Rails 3.0 shortly after its release. For many-to-many relationships, you may need to have the view reference the join model. See the mailing list.
Had this up and running in 10 minutes:
Read more...Notes from Tomas Carillo on effective presentations...
Tomas Carillo spoke on speaking at Gangplank Academy Brownbag today. Here are my notes:
Read more...Just submitted a talk proposal for the next Desert Code Camp at DeVry on June 13:
Though many would argue it's far more elegant, Ruby was inspired in its early days in part by Perl. That heritage means it's an awesome environment for text parsing, file manipulation, and many other tedious daily chores faced by every developer on earth (and their Aunt Tillie, too). This session will cover some of the powerful features of the standard Ruby library - utilities that may already be installed on your Linux or OS X machine (and can easily be added to Windows). Learn to slice and dice files and directories, HTML, XML, shell commands, and more!Read more...
Bort with Rails 2.3, Authlogic, and Cucumber
We have a series of small new projects coming at work, and I hate project setup. We’d used Bort previously, but it uses Restful Authentication, and my boss was recommending Authlogic. I also didn’t want to have to set up Cucumber on five new code bases.
So, Git/GitHub being the wonderful platform it is, I forked the Bort repo and set to work:
Bort with Rails 2.3, Authlogic, and Cucumber
…I might have done better starting from scratch. Bits of Restful Auth kept disrupting my Authlogic setup, likewise Rails 2.2 code with 2.3.
But in the end I prevailed (I think). There may still be odd errors lurking in there. Those should be teased out by the many projects I hope to use it on, though.
Read more...