Still Loving Shoulda (macros)
09 Mar 2009
I’ve been using shoulda for one month and I am still loving it. Today I created my first macro:
def self.should_display_error_message()
should "do display error message" do
assert_tag :tag=>"div",
:attributes => {
:class => "errorExplanation",
:id => "errorExplanation"
}
end
end
context "post to :create with invalid parameters" do
setup do
post :create, :segment => {:name=>"", :match_type=>" OR "}
end
should_not_change "Segment.count"
should_assign_to :segment
should_respond_with :success
should_render_a_form
should_render_with_layout 'application'
should_render_template :new
should_display_error_message
end