I’ve been updating the muck gems to work with Rails 3. The change is significant and painful but in a good way. For the most part the change consists of deleting all the code you used to hack into the Rails framework and adding subclass of ‘::Rails::Engine’. I’ll try to put together a detailed post…
Tag: shoulda
Interesting testing issue with Rails 2.3.3
I’m not sure if this applies to all the versions of Rails, but right now I’m using the latest 2.3.3. I’m using shoulda to do testing and my code looks like this: context “GET show” do setup do @feed = Factory(:feed) get :show, :id => @feed.to_param end should_not_set_the_flash should_respond_with :success should_render_template :show end </pre> The…
Shoulda Craps out on Rails 2.2.2
I tried the latest shoulda on luvfoo a while back and it died on the internationalization stuff so we gave up. Turns out that with the new internationalization in Rails 2.2.2 shoulda is dying again. I know the code is free and shoulda really is a great project, but I think this shows why you…
Using Shoulda to test login – should_require_login
I’ve had my problems with shoulda, but one very powerful component of the testing framework is the ability to create macros. Here’s one that checks to make sure a user has to be logged in to access an action. Put it into test/shoulda_macros/authentication.rb. (You can name the file anything you want I just thought authentication.rb…
Shoulda Doesn’t like ‘Status’
One of the models in a project I am working on right now ends in ‘status’. Rails handles that just find but in my tests I started noticing an odd error: test: Lookup should belong_to lookup_status. (LookupTest): NameError: uninitialized constant LookupStatu </pre> The Shoulda test looks like this: should_belong_to :lookup_status </pre> Nothing to complicated there….
Shoulda, assert_sent_email and Unreal Users
I have been banging my head against a problem in my testing. Using the UI everything worked as expected, but my tests were failing when I tried to see if emails were being sent in a specific case. Here’s the test I was trying to run using Shoulda: context “reset password for user that has…
Tip for Testing Email with Ruby on Rails and Shoulda
Shoulda comes with a great method for testing email called ‘assert_sent_email’. (If you try it and get a method missing error update Shoulda. Not that anyone wouldn’t know to just do that). No matter what you use to test email as long as you are in test mode your emails will be placed into an…