Displaying 3 results from an estimated 3 matches for "should_be_valid".
2007 Apr 09
10
changes in 0.8 and greater - should_
Has the should_... syntax changed? I''m getting errors when running
the following:
should_render(:index)
should_be_valid
should_not_be_valid
should_respond_to
should_be
should_render
I thought the syntax changed to something like the following:
obj.should render(:index)
but this doesn''t seem to work.
Scott
2007 Jan 01
5
Validations based on associations
...;A Registration with a User and Tournament" do
setup do
@user = User.new
@user.save false
@tournament = Tournament.new
@tournament.save false
@reg = Registration.new(:user => @user, :tournament => @tournament)
end
specify "should be valid" do
@reg.should_be_valid
end
specify "should not be valid if a registration with the same details
already exists" do
@reg.save
Registration.new(:user => @user, :tournament =>
@tournament).should_not_be_valid
end
end
Well actually that''s obviously pretty easy :) Is it bad that I'...
2007 Apr 26
0
Shouldn't this spec fail?
...be the right way of doing this, but before_create or any of the
other things don''t make the first test pass.
specify "should provide a default name when none is given" do
@emailer.attributes = valid_emailer_attributes.except(:name)
@emailer.name.should_not_be_nil
@emailer.should_be_valid
end
specify "should not replace name if one is given" do
@emailer.attributes = valid_emailer_attributes # valid name attribute is
"bill"
(@emailer.name=="bill").should_be_true
end
class Emailer < ActiveRecord::Base
def after_initialize
self.name...