Displaying 7 results from an estimated 7 matches for "assert_valid".
2009 Apr 07
3
assert_valid in unit tests after upgrade to rails 2.3 doesn't work
def test_valid
assert_valid State.first
end
Error:
test_valid(StateTest):
NoMethodError: undefined method `assert_valid'' for #<StateTest:
0x7f0d60750318>
I see that test_valid is now in
ActionController::Assertions::ModelAssertions. Does this mean that
test_valid is designed to be used i ActionController t...
2007 May 06
1
validates_uniqueness_of (with :scope) doesn't seem to work?
...ss_of *:descr*,
*:scope* => "project_id"
Here''s the test that SHOULDN''T pass but it does
*def* test_should_fail_duplicate_descr
record1 = *@project*.agycodes.*new*(*:descr* => "description")
record2 = record1
assert record1.save, "Save Record"
assert_valid(record1)
assert record2.save, "Save Record"
assert_valid(record2)
*end*
By the way, do you know how one would write the opposite of "assert_valid"?
Thank you,
David
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to th...
2007 Feb 07
0
strange sqlite3 errors - validates_associated & failing activerecord unit tests
...tCase
fixtures :subscription_plans
fixtures :publications
def setup
@six_month_gold = subscription_plans(:six_month_gold)
@gold = publications(:gold)
end
def test_should_make_sure_record_can_be_created
sub_plan = create
pub = Publication.find(sub_plan.publication_id)
assert_valid pub, "publication errors: #{pub.errors}"
assert_valid sub_plan.publication, "sub_plan.publication.errors:
#{sub_plan.publication.errors}"
assert_equal sub_plan.publication_id, pub.id
assert_valid sub_plan, "errors: #{sub_plan.errors.to_yaml}"
end
privat...
2006 Sep 29
7
help needed in UNIT Testing
hi guys,
I needed help in Unit test. i just try to save new data intomy test
database.
but save method does not works for me. the result shows here
def test_new_avail
avail = Avail.new(:vendor_id => 1,
:last_mod_by => ''Murali'',
:updated_at => ''2006-08-17 13:14:59)
assert avail.valid?
assert avail.save
end
2006 Aug 15
2
Unit Testing Problem
I''m having a bit of difficulty when testing my models, I''ve read a few
times the testing chapter in Agile web development with rails and at
http://manuals.rubyonrails.com/read/chapter/27 but i''m still unsure of
what I should be testing.
Firstly I''d like to be able to test things like my email validation
using lines such as
assert User.new(:email =>
2006 Jul 24
1
Testing w/out DB connection
I have several plain ruby classes that do nothing but implement
algorithms. What is the prefferred way to run these w/out making a DB
connection every time?
Thanks,
Dennis Byrne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060724/5ff610dd/attachment.html
2006 Jul 11
4
assert fails with <false> is not true
Hi,
I have a simple model and written a testcase.
class Product < ActiveRecord::Base
validates_presense_of :name
end
-------------
class ProductTest < Test::Unit::TestCase
fixtures :products
def test_invalid
product = Product.new
assert !product.valid?
end
end
-------------
The testcase fails with a message,
<false> is not true.
What is wrong with the testcase? I