Week 2 Homework Requirements

Hi everyone! I mentioned this in class and in the slides, but I’m going to post it on the blog again just in case.

In addition to getting my test cases to pass, I want to see more test cases. More tests in the units, and more in the functionals. Specifically in the functionals, I want to see tests which submit form data which would be considered invalid by the models and verifies that the user is notified of their mistakes.

Remember. Turn your homework in early and often! Week 2 homework is due on the 31st at midnight.

Tags:

2 Responses to “Week 2 Homework Requirements”

  1. Mark Holton says:

    since the mailing list is ‘on the fritz’:

    On Sun, Jan 25, 2009 at 9:26 PM, bill dussler wrote: > > billd$ script/console > Loading development environment (Rails 2.2.2) > >> ActiveRecord::Errors.default_error_messages[:blank] >> >> => “can’t be blank” >> >> or: >> >> >> I18n.translate(’activerecord.errors.messages.blank’) >> => “can’t be blank” >> >> Presumably ActiveRecord prepends the field_name to the error message >> when adding it to @errors >> >> I may simply be overthinking this, which wouldn’t be the first time ;) >> >> bill

    Hi Bill, I used a css selector via assert_select to check and see if a particular (expected) field was blank.

    E.g.: assert_select “div.fieldWithErrors > input#product_title”, :text => “”

    Hope that helps, :Mark

  2. Mark

    Not sure if you need to check if it’s blank. Shouldn’t the div class be enough as long as the input is inside it?

    assert “div.fieldWithErrors input#product_title”

    Seems like that would work just fine.

Leave a Reply