search for: test_valid

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

Did you mean: desc_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 A...
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-...
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 uninstalle...
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...
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.
...guestfs_int_string_is_valid ((str), 1, SIZE_MAX, true, true, "-_") +#define VALID_DISK_LABEL(str) \ + guestfs_int_string_is_valid ((str), 1, 20, true, false, NULL) +#define VALID_HOSTNAME(str) \ + guestfs_int_string_is_valid ((str), 1, 255, true, true, "-.:[]") + +static void +test_valid (void) +{ + assert (!VALID_FORMAT_IFACE ("")); + assert (!VALID_DISK_LABEL ("")); + assert (!VALID_HOSTNAME ("")); + + assert (!VALID_DISK_LABEL ("012345678901234567890")); + + assert (VALID_FORMAT_IFACE ("abc")); + assert (VALID_FORMAT_IFACE...
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.