Displaying 20 results from an estimated 1200 matches similar to: "Bizarre ActiveRecord::Errors/validation problem"
2019 Jan 17
1
[hivex PATCH] ruby: improve test functions
Use better functions to check for proper values instead of assert:
- refute_nil for non-null functions
- assert_equal for checking equality
Also, make sure that the parameters for assert_equal are correct:
expected value, then got value.
---
ruby/tests/tc_120_rlenvalue.rb | 4 ++--
ruby/tests/tc_130_special.rb | 12 ++++++------
ruby/tests/tc_200_write.rb | 4 ++--
2007 May 30
4
aaf and dynamic attrs: a bug?
Hi!
I faced some issue while using it for dynamic attrs indexing/search.
Maybe I made something wrong. Here is test method. Everything works just
fine until last line http://pastie.caboo.se/66274 . Tested on both
stable and trunk of aaf and ferret 0.11.4.
the short version of code below:
Contact.acts_as_ferret :fields => [ :first_name ]
assert
2005 Dec 31
2
Test Unit Problem
Hello All,
I am experiencing the following test unit error working with Rails that
I can''t fathom.
I have a products.yml file which holds the following test fixture for
the products table:
dell_pc:
id: 1
title: Dell PC
description: Dell PC
image_url: http://.../pc_image.jpg
price: 15000.00
date_available: 2005-12-31 06:53:00
I also have the following product_test.rb file to
2006 Sep 29
1
yielding consecutive values
I''m not sure if someone has already addressed this issue, but if not,
here goes.
I need the following behavior:
def test_generate(documentation = ''/test_documentation/'',
destination = ''/destination/'')
yield_results = [''/'', ''filename.yaml'', ''blah.xml'']
2006 Apr 21
2
NoMethodError with test_read_with_hash
While running the product_test.rb test fixture in the Agile Web
Development book (p. 148), but when I run
ruby test/unit/product_test.rb, I get the following error:
1) Error:
test_read_with_hash(ProductTest):
NoMethodError: You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]
2019 Jan 16
1
Re: [PATCH 3/5] mltools: add simple tests for external_command
On Wed, Jan 16, 2019 at 03:17:33PM +0100, Pino Toscano wrote:
> ---
> common/mltools/tools_utils_tests.ml | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/common/mltools/tools_utils_tests.ml b/common/mltools/tools_utils_tests.ml
> index 1489fe699..f3c39514d 100644
> --- a/common/mltools/tools_utils_tests.ml
> +++
2006 Jan 16
2
My first test - named fixture not autoloading instance variable
I''m trying to write a test like the one at the bottom of page 148 in
Agile Rails.
I''m using rails 1.0
I''ve created the fixture correctly I''m pretty sure because the test
database table is being populated per the fixture.
I have what I think is a simple unit test:
=========
require File.dirname(__FILE__) + ''/../test_helper''
class CaseTest
2006 Apr 16
5
Newbie Problems with pluralization
Hi,
I have a many to many relationship incorporating the following tables:
taxes --> taxes_tax_groups --> tax_groups
I have a model named tax with the following declaration:
has_and_belongs_to_many :tax_groups
and I have a model named tax_group with the following declaration:
has_and_belongs_to_many :taxes
I am attempting to run the following unit test:
require
2006 Mar 04
2
unittest, not loading yml data
Here is my products.yml
version_control_book:
id: 1
title: Pragmatic Version Control
description: How to use version control
image_url: /images/sk_svn_small.jpg
price: 29.95
date_available: 2005-01-26 00:00:00
automation_book:
id: 2
title: Pragmatic Project Automation
description: How to automate your project
2007 Jul 06
3
assert_equal - problems returning value from controller
Hi,
I have the following assert_equal that is returning false.
@q seems to be returning niil, but is set in the controller, how can I
get hold of this value in my tests?
assert_equal ''derby'', @q
Thanks
Mark
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
2007 Jan 02
4
allow stubbing of previously defined methods such as "id"
On my current project I needed to create a stub that responded
correctly to the id message. Here''s the change I put into my copy of
head.
Index: lib/mocha/mock_methods.rb
===================================================================
--- lib/mocha/mock_methods.rb (revision 1114)
+++ lib/mocha/mock_methods.rb (working copy)
@@ -68,6 +68,7 @@
method_names =
2005 Mar 09
9
Unit testing + instance variables
After *much* digging and playing around, I finally figured out how to
unit test instance variables that are created by actions. It was
more difficult than I expected. It seems like there should have been
a more straight forward way to do this. Can someone enlighten me? A
simplified and somewhat contrived example of what I am current doing:
Thanks.
Matt
>>
# My Controller of interest
2009 Sep 01
13
Function Testing Reloading Fixtures before assertion
Hey Everyone,
I have a function test the is failing (despite the fact the function
actually works in the application). I was looking for some debug
advice on how to find my problem.
Here is the test:
def test_should_delete_word
assert_equal ''published'', words(:one).status
debugger
delete :destroy, :id => words(:one).to_param
assert_equal
2005 Dec 15
2
Error: [Object]Controller: missing default helper path [controller]_helper
Hello,
I seem to have run into a problem that I can''t seem to make any
headway on. I''ve searched the mailing archives, google''d for the
appropriate keywords and have checked up with the folks on IRC but I
can''t seem to find a solution.
My problem is as such. I have a web application that has various
controllers which work fine. I''ve added a
2010 Nov 14
2
Question re assert_equal
In Agile Web Development with Rails, the following statement is given:
assert_equal "has already been taken", product.errors[:title].join('';
'')
My question is: Why is the join(...) needed and what exactly does it
do here?
If it does what I assume, join an array of strings and use "; " as the
separator, then I wonder how the assert_equal statement could ever
2006 Sep 22
2
foo.expects(:blah).returns(10).then(11) syntax
I recently needed the behavior of my object to change on subsequent
method calls so I added the syntax above.
Here''s the diff of changes I made:
Index: test/mocha/expectation_test.rb
===================================================================
--- test/mocha/expectation_test.rb (revision 854)
+++ test/mocha/expectation_test.rb (working copy)
@@ -95,6 +95,12 @@
2006 Dec 02
3
Scoping expectations and more ...
Hello!
I''m new to Mocha and through experimentation I found out something
that is not explicitly stated in the documentation: If you need to
mock the same function call with different parameters and results, you
can set the scope of expectations with a begin ... end block.
I also made up an example on how to expect more than one function call
with different parameters and return values.
2006 May 19
3
new to rails; problem with testing section in Agile book
Hello, I should give the expected disclaimer that I am brand new to
rails and am going through the Agile web development with Rails book
right now. I am in the testing section and I can''t get past an error.
this is my cart_test.rb test file:
require File.dirname(__FILE__) + ''/../test_helper''
class CartTest < Test::Unit::TestCase
fixtures :products
def setup
2008 Mar 10
3
Only 5 tests out of 376 currently failing!
Good news! SuperRedCloth is down to just five failing tests! I was
down to 10 or so in mid-February but then I added test cases from
"The official reference manual for Textile 2", which added 97 new
tests, many of them failing. I''m happy to say, they''re almost all
passing now.
Four of these last five I just need to check with you on before I
deviate from
2006 Mar 19
2
Unit test confusion
Hey all,
I''m following along with AWDWR, specifically the unit testing.
On page 148, it shows you how Test::Unit::TestCase will automatically
define instance variables based on your fixtures.
It doesn''t seem to actually work, though. It seems that both @artists
["beatles"]["name"] and @beatles.name are nil objects in my test,
where as