search for: assert_raises

Displaying 20 results from an estimated 52 matches for "assert_raises".

2006 May 06
6
assert_raises --> how does it work?
Hi, I have this code fragment: def test_delete_concept assert_not_nil Concept.find(concepts(:entreprise).id) get :delete_concept, {:concept_id => concepts(:entreprise).id} assert_raises :RecordNotFound, Concept.find(concepts(:entreprise).id) end basicaly, on the first line, I make sure that the concept exist in the DB. On the second line I delete the concept fron the DB. Finaly, this is where I have a problem, on the third line, I want to see if the record was deleted. I th...
2006 Nov 22
1
Using assert_raise
When Im writing tests and I do: assert_raise RuntimeError, raise("raising") Then I run the test is says the test failed and I have 1 error: RuntimeError: hey Should assert_raise catch that error and say the test passed? Thanks for your time and help. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because
2006 Jul 18
2
Testing which RuntimeError is raised
I am just starting to use unit testing. Way cool. But I am not finding very clear docs on assert_raise. I have managed to write a test that tells me that the destroy I am trying to test fails with a RuntimeError (as it should). However, I would really like to test that it rails for the specific reason I have in my model. How can I get more specific? Am I going to have to create my own exception
2004 Feb 01
2
test_services test case
...r is unavailable" error message that was popping up on some systems. I couldn''t duplicate this on my XP Pro box, but it does show up on my Win2k box. Quick review - this is the test case from tc_service.rb def test_services assert_nothing_raised{ Service.services{ } } assert_raises(NotImplementedError){ Service.services } # no non-block a = [] Service.services{ |s| a.push(s) } assert_kind_of(Struct::Win32Service,a.first) end I added some more information to the error messages, and it turns out that the failure is caused by the call to OpenSCManager() in th...
2008 Oct 24
1
rescue_from and assert_raise
Since commit 5e3517ea7b9fbd460f772bffc9212d882011f2bc, rescue_from is now being handled in tests. I''ve been using rescue_from to handle custom exceptions and testing that those exceptions are raised in functional tests with assert_raise. This no longer works now. What''s the proper way to test this now? --~--~---------~--~----~------------~-------~--~----~ You received this
2006 Dec 28
0
problem with assert_raise in Unit Test
I''m running a simple unit test to validate that ActiveRecord raises an exception when I try and update a column with a duplicate foreign key. Inside the unit test, charge.time_logs << time_logs(:first) will generate ActiveRecord::StatementInvalid: Mysql::Error: #23000Duplicate entry ''20'' for key 2: UPDATE time_logs SET `task_id` = 1, `date_created` = NULL,
2006 Jan 28
1
Unit Tests Behavior
Hi, Working on unit tests and I have a few cascade delete constraints I am testing. The unit tests stop at the first assert_raise test. Is this typical? def test_destroy_all_cascade_delete assert_equal 1, Iep.find(:first).client_id assert_equal 1, Encounter.find(:first).client_id @client.destroy assert_raise(ActiveRecord::RecordNotFound) { Iep.find(1) } <--
2006 Mar 08
0
Unit tests dynamic finders
Hi all, I am having a problem with unit tests. Whenever I have a dependency between two models (B depends on A) deleting A should also delete B. This is simple with the dependent parameter in the model file of A. But when I write a test the dependency seems to work, I can''t find the answer with id 1 anymore(Answer.find(1)). But I appearently _do_ find it with
2009 Jul 08
1
[PATCH: host-browser replacement 0/3] replacement of host-browser on ovirt-server
The purpose of this patch is to replace the identify function in host-browser.rb with a new script, host-register.rb. host-register.rb is a qmf ruby console that interfaces with the newly added matahari qmf agent on the ovirt node. While it stores node data in the database with the same behavior as the original host-browser implementation, it acquires the data using the amqp protocol (and
2016 Feb 15
1
[PATCH] Start adding return values tests for bindings
...nc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +require File::join(File::dirname(__FILE__), 'test_helper') + +class TestLoad < MiniTest::Unit::TestCase + def test_rint + g = Guestfs::Guestfs.new() + + assert_equal 10, g.internal_test_rint("10") + + assert_raises(Guestfs::Error) { + g.internal_test_rinterr() + } + end + + def test_rint64 + g = Guestfs::Guestfs.new() + + assert_equal 10, g.internal_test_rint64("10") + + assert_raises(Guestfs::Error) { + g.internal_test_rint64err() + } + end + + def test_rbool + g = G...
2009 Jul 10
2
[PATCH: server 0/3] Add host-register.rb (replaces host-browser.rb in part)
Removes node identification functionality from host-browser.rb and adds a new script, host-register.rb, that takes over that functionality. The chief difference is that host-browser used a simple TCP server setup to get data from the node, while host-register uses the qpid bus to do so. Specifically, it communicates with the matahari qmf agent added to the node in two related patchsets to node
2017 Jun 15
0
[PATCH v6 10/41] mllib, v2v: Split out OCaml utils bindings ‘common/mlutils’.
...rinter 52 (drive_index "ba"); + assert_equal ~printer 701 (drive_index "zz"); + assert_equal ~printer 702 (drive_index "aaa"); + assert_equal ~printer 18277 (drive_index "zzz"); + let exn = Invalid_argument "drive_index: invalid parameter" in + assert_raises exn (fun () -> drive_index ""); + assert_raises exn (fun () -> drive_index "abc123"); + assert_raises exn (fun () -> drive_index "123"); + assert_raises exn (fun () -> drive_index "Z"); + assert_raises exn (fun () -> drive_index "aB&qu...
2009 Jun 29
0
[PATCH server] Add svc_vm_actions method to VmService.
Also includes a couple minor model changes to support better error reporting. This method was added so that a client could submit multiple vms to the service layer in one call and get back appropriate messages showing any failures without those failures also causing the entire call to fail, or forcing the client to implement handling (begin/rescue blocks) of these errors to continue through the
2006 May 17
0
teardown not cleaning the BD?
...).id, :limit => 1) #make sure it is present assert_not_nil ClientVariation.find_by_variation_id (first_variation.id) #delete the record from the DB get :delete_concept, {:concept_id => concepts(:entreprise).id} #search for the record, if not there, raises an exception assert_raises(ActiveRecord::RecordNotFound) { Concept.find(concepts(:entreprise).id) } #search for the variation, if not there, raises an exception #this is the line that generate the faillure assert_raises(ActiveRecord::RecordNotFound) { Variation.find_by_concept_id(concepts(:entreprise).id) }...
2009 Jun 29
2
One more fix
This resend includes the rebase, but fixes a problem I just noticed with nil/empty checks.
2009 Jun 29
2
Resend of Cloud UI/service patches
This is a resend of the 2-patch series from a week or so ago, needed to be rebased due to some commits on next
2009 Jun 22
2
Patch series for Cloud Vm Actions
The following two patches should be applied in the order: * [PATCH server] Add svc_vm_actions method to VmService. * [PATCH server] Cloud UI layer to initiate actions on vms. The service layer patch should work fine on its own (and not break anything), but cloud patch relies on service being there.
2012 Feb 23
1
Bug in nested_attributes_for: question about best way to patch
I''ve discovered what I''m pretty confident is unexpected behavior in accepts_nested_attributes_for, and am developing a patch, but I''ve encountered a question about how the core team would prefer the implementation to look. Here''s the bug: when assigning to a belongs_to relationship (and I believe one-to-one, but I haven''t verified yet) if you mark the
2004 Mar 09
6
win32-mmap test suite
...rt_equal("0.0.1",Mmap::VERSION,"Bad version") end def test_new assert_nothing_raised{ Mmap.new("Foo") } assert_nothing_raised{ Mmap.new("Foo",16*1024) } assert_nothing_raised{ Mmap.new("Foo",16*1024,"test") } assert_raises(ArgumentError){ Mmap.new("Foo",16*1024,"test",true,true,10,true) } assert_raises(TypeError){ Mmap.new("Foo",1) } end end _________________________________________________________________ Get business advice and resources to improve your work life, from bCen...
2019 Feb 25
0
[PATCH 2/3] v2v: add Var_expander
...+ () + +let test_list () = + assert_equal_string "x %{NONE}" (Var_expander.replace_list "%{FOO} %{NONE}" [("FOO", "x")]); + () + +let test_scan_variables () = + let assert_invalid_variable var = + let str = "%{" ^ var ^ "}" in + assert_raises (Var_expander.Invalid_variable var) + (fun () -> Var_expander.scan_variables str) + in + assert_equal_stringlist [] (Var_expander.scan_variables ""); + assert_equal_stringlist [] (Var_expander.scan_variables "foo"); + assert_equal_stringlist ["FOO&qu...