search for: test_validate

Displaying 8 results from an estimated 8 matches for "test_validate".

Did you mean: must_validate
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 tests only? I can change my assert_valid(State.first) into assert
2006 Mar 26
4
A unit test that should pass
Hi, I wonder why this unit test fails. The model : class Article < ActiveRecord::Base set_table_name "publish_articles" belongs_to :category validates_presence_of :title, :excerpt #snip end The test : def test_validate @article.title = nil @article.excerpt = nil assert !@article.save assert_equal 2, !@article.errors.count end !@article.errors.count returns ''false'' instead of 2 I tried also with @article.title = '''' Any idea ? -- Posted via http://www.ruby-for...
2006 May 05
7
Testing model: test becomes dependent on previous test
...duct.price end end ============================================================ it reports an error (<29.95> expected but was <99.95>)) in test_update2. it seems test_update2 becomes dependent on the previous test, which it should not. if i add new test methods (such as test_destroy, test_validate,...), they also become dependent on previous tests. but the book says "...the database is put back to its default state before the next test method is run." so how do i correct this? -- Posted via http://www.ruby-forum.com/.
2006 Sep 07
1
gem mysql buggy on Win32
Hi, Just running a simple unit test and trying to save an object gives me this error. test_validations(FriendTest): NoMethodError: undefined method `each'' for #<Mysql:0x38f60d0> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/mysql_a dapter.rb:292:in `columns'' .... .... Rails 1.1.6 mysql 5 mysql gem 2.71 After I
2006 Jul 06
0
problema con i test automatizzati
...    assert_equal 29.95, @product.prezzo         @product.prezzo = 99.99         assert @product.save, @product.errors.full_messages.join("; ")         @product.reload         assert_equal 99.99, @product.prezzo     end     def test_destroy         @product.destroy     end     def test_validate         assert_equal 29.95, @product.prezzo         @product.prezzo = 0.00         assert !@product.save         assert_equal 1, @product.errors.count         assert_equal "deve essere positivo", @product.errors.on(:prezzo)     end end Ora, da ciò che ho capito, per ogni metodo, R...
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 =>
2016 Dec 24
0
[PATCH] lib: Use a common function to validate strings.
--- python/Makefile.am | 5 ++++ src/appliance-kcmdline.c | 21 ++----------- src/drives.c | 65 +++++++---------------------------------- src/guestfs-internal-frontend.h | 3 ++ src/unit-tests.c | 40 +++++++++++++++++++++++++ src/utils.c | 50 +++++++++++++++++++++++++++++-- 6 files changed, 110 insertions(+), 74
2016 Dec 24
2
[PATCH] lib: Use a common function to validate strings.
As discussed in the thread on validating $TERM, it would be good to have a common function to do this. This is such a function. The main advantage is it includes unit tests which the previous functions did not. Rich.