Displaying 20 results from an estimated 312 matches for "assert_equ".
Did you mean:
assert_eq
2007 May 30
4
aaf and dynamic attrs: a bug?
...ethod. 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 Contact.find(:first).respond_to?(:first_name_to_ferret)
assert_equal 1, Contact.find_by_contents(''Y*'').total_hits
assert_equal 1, Contact.find_by_contents(''first_name:Y*'').total_hits
Contact.aaf_index.close
FileUtils.rm_rf ''index''
Contact.acts_as_ferret :fields => [ :first_name, :last_name ]...
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 ''deleted'', words(:one).status
end
It fails on the last with: <"deleted"> expected but was <"published">.
//My...
2007 Oct 21
0
Taking a stab at a pure Ruby Dir.glob
...c a2.cpp a3.h a4.rb/
FileUtils.mkdir_p(''foo/bar/baz'')
Dir.chdir(''foo''){ @foo_files.each{ |f| FileUtils.touch(f) } }
Dir.chdir(''foo/bar''){ @bar_files.each{ |f| FileUtils.touch(f) } }
end
def test_glob_pattern
assert_equal(%w/a.c a.cpp b.c b.h bar d g.rb/,
base(MyDir.glob(''foo/{*}'')))
assert_equal(%w/g.rb/, base(MyDir.glob(''foo/{*.rb}'')))
assert_equal(%w/a.cpp g.rb/, base(MyDir.glob(''foo/*.{rb,cpp}'')))
assert_equal(%w/a.cpp g.rb/, base(MyDi...
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 ++--
ruby/tests/tc_210_setvalue.rb | 20 +...
2005 Dec 31
2
Test Unit Problem
...wing product_test.rb file to test the fixture
above:
require File.dirname(__FILE__) + ''/../test_helper''
class ProductTest < Test::Unit::TestCase
fixtures :products
def setup
@product = Product.find(1)
end
def test_fixtures
assert_kind_of Product, @product
assert_equal 1, @product.id
assert_equal "Dell PC", @product.title
assert_equal "Dell PC", @product.description
assert_equal "http://.../pc_image.jpg", @product.image_url
puts "class of @product.price = #{@product.price.class}"
puts "value of @product.pri...
2017 Jun 15
0
[PATCH v6 10/41] mllib, v2v: Split out OCaml utils bindings ‘common/mlutils’.
...Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *)
+
+(* This file tests individual OCaml bindings for C utility functions. *)
+
+open Printf
+
+open OUnit2
+
+open Std_utils
+open C_utils
+
+let test_drive_name ctx =
+ let printer = identity in
+ assert_equal ~printer "a" (drive_name 0);
+ assert_equal ~printer "z" (drive_name 25);
+ assert_equal ~printer "aa" (drive_name 26);
+ assert_equal ~printer "ab" (drive_name 27);
+ assert_equal ~printer "az" (drive_name 51);
+ assert_equal ~printer "...
2006 Apr 16
5
Newbie Problems with pluralization
...me(__FILE__) + ''/../test_helper''
class TaxGroupTest < Test::Unit::TestCase
fixtures :taxes, :tax_groups, :taxes_tax_groups
# Replace this with your real tests.
def setup
@taxgroup = TaxGroup.find(1)
end
# Replace this with your real tests.
def test_create
assert_equal 1, @taxgroup.id
assert_equal "Ontario", @taxgroup.name
assert_equal "Ontario w/ pst", @taxgroup.description
assert_equal "GST", @taxgroup.taxes[1].name
end
end
in which i get the following error:
1) Error:
test_create(TaxGroupTest):
ActiveRecord::St...
2006 Sep 29
1
yielding consecutive values
...ults.shift } )
...
end
So I made these changes...
Index: test/mocha/expectation_test.rb
===================================================================
--- test/mocha/expectation_test.rb (revision 62)
+++ test/mocha/expectation_test.rb (working copy)
@@ -91,6 +91,11 @@
assert_equal parameters_for_yield, yielded_parameters
end
+ def test_should_yield_with_block_result
+ expectation = new_expectation.yields( lambda { ''lambda return
value'' } )
+ expectation.invoke() { |*parameters| assert_equal [''lambda
return value''], parame...
2005 Mar 09
9
Unit testing + instance variables
...create_fixtures "recipes"
create_fixtures "categories"
end
def test_list
get :list
# This step seems exessively complex, and took me a while to figure out
my_inst_vars = @controller.instance_variable_get "@assigns"
assert_equal( 5, my_inst_vars["recipes"].size )
assert_equal( 8, my_inst_vars["categories"].size )
end
end
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 recei...
2006 Apr 21
2
NoMethodError with test_read_with_hash
...ile evaluating nil.[]
test/unit/product_test.rb:39:in `test_read_with_hash''
4 tests, 15 assertions, 0 failures, 1 errors
Below is my code for the the method:
def test_read_with_hash
assert_kind_of Product, @product
vc_book = @products["version_control_book"]
assert_equal vc_book["id"], @product.id
assert_equal vc_book["title"], @product.title
assert_equal vc_book["description"], @product.description
assert_equal vc_book["image_url"], @product.price
assert_equal vc_book["price"], @product.price...
2010 Aug 06
1
New bie question: Why use assert_equal when there are comparison operators in Rspec?
...me related material to put BDD
in my new rails app.
I have also checked out Ryan Bates'' railscasts on rspec (that''s how I
got to know about Mocha).
Reading up on the Rspec''s main site, the main example in
http://rspec.rubyforge.org/rspec/1.3.0/ does not show any use of
assert_equals. Rather it just uses the "==" comparison operators.
Here''s an extract:
============ Extract begin ===========================
it "reduces its balance by the transfer amount" do
source = Account.new(50, :USD)
target = stub(''target account&...
2006 Jul 06
0
problema con i test automatizzati
...e File.dirname(__FILE__) + ''/../test_helper''
class ProductTest < Test::Unit::TestCase
fixtures :products
def setup
@product = Product.find(1)
end
# Replace this with your real tests.
def test_create
assert_kind_of Product, @product
assert_equal 1, @product.id
assert_equal "Pragmatic Version Control", @product.titolo
assert_equal "Come utilizzare il controllo di versione",
@product.descrizione
assert_equal 29.95, @product.prezzo
assert_equal "http://www.alfonsomartone.itb.it/ye...
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 st...
2006 Jan 16
2
My first test - named fixture not autoloading instance variable
...=========
require File.dirname(__FILE__) + ''/../test_helper''
class CaseTest < Test::Unit::TestCase
fixtures :cases
def setup
@case = Case.find(1)
end
# Replace this with your real tests.
def test_verify_schema_has_correct_fields
assert_kind_of Case, @case
assert_equal 1, @case.id
assert_equal "F-06-101", @case.case_number
assert_equal @first.case_number, @case.case_number
end
=====
The first 2 assert_equal statements are working fine and demonstrate
the basic table logic is fine and that my fixture is working.
The third one is failing beca...
2019 Jan 16
1
Re: [PATCH 3/5] mltools: add simple tests for external_command
...++
> 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
> +++ b/common/mltools/tools_utils_tests.ml
> @@ -28,6 +28,7 @@ let assert_equal_string = assert_equal ~printer:(fun x -> x)
> let assert_equal_int = assert_equal ~printer:(fun x -> string_of_int x)
> let assert_equal_int64 = assert_equal ~printer:(fun x -> Int64.to_string x)
> let assert_equal_intlist = assert_equal ~printer:(fun x -> "(" ^...
2006 Jan 22
23
calculate users age
i know it''s probably really simple, how do i work out someone''s age if i
have their d.o.b. stored as a date in my db.
cheers
--
Posted via http://www.ruby-forum.com/.
2007 Jan 02
4
allow stubbing of previously defined methods such as "id"
...ethod_name
end
expectations.last
end
Index: test/mocha/auto_verify_test.rb
===================================================================
--- test/mocha/auto_verify_test.rb (revision 1114)
+++ test/mocha/auto_verify_test.rb (working copy)
@@ -155,6 +155,11 @@
assert_equal ''named_stub'', stub.__mock_name
end
+ def test_stub_should_respond_to_already_defined_method
+ stub = test_case.stub(:id=>"id")
+ assert_equal "id", stub.id
+ end
+
def test_should_create_greedy_stub_with_name
greedy_stub = test_case.stu...
2009 Jul 01
1
[PATCH server] fixed expected status messages that were failing unit/functional tests.
...oller_test.rb
+++ b/src/test/functional/cloud/instance_controller_test.rb
@@ -50,7 +50,7 @@ class Cloud::InstanceControllerTest < ActionController::TestCase
def test_add_valid_task
post(:index,{:submit_for_list => 'Shutdown', :ids => [vms(:production_mysqld_vm).id]})
- assert_equal('shutdown_vm successful.', flash[:notice])
+ assert_equal('shutdown_vm submitted.', flash[:notice])
assert_redirected_to :action => :index, :ids => vms(:production_mysqld_vm).id
end
diff --git a/src/test/unit/vm_service_test.rb b/src/test/unit/vm_service_test.rb...
2006 Mar 04
2
unittest, not loading yml data
...rsion_control_book in my
product_test.rb script
here is my test_product.rb
require File.dirname(__FILE__) + ''/../test_helper''
class ProductTest < Test::Unit::TestCase
fixtures :products
def setup
@product = Product.find(1)
end
def test_load_yml
assert_equal nil, @products
assert_equal nil, @version_control_book
assert_equal nil, @automation_book
end
end
And here is what I am getting from product_test.rb,
[beeplove@localhost depot]$ ruby test/unit/product_test.rb
Loaded suite test/unit/product_test
Started
.
Finished in 0.143878...