similar to: Reload data inside a test?

Displaying 20 results from an estimated 50000 matches similar to: "Reload data inside a test?"

2006 Jan 10
1
Can somebody explain when to reload an ActiveRecord
Hi all, I''ve the following test method in my controller_test which increment the ''qty'' attribute in a has_many association, ''sa_report_products''. The ''item_count'' method returns the sum of all qty''s in ''sa_report_products'': def test_add_product_to_report sa_rpt = SaReport.find(1) assert_equal 3,
2006 May 05
7
Testing model: test becomes dependent on previous test
Im having trouble with Testing models. im following the tutorials in the book Agile Web Development with Rails. if i execute the code product_test.rb, i get this error: ============================================================ 1) Failure: test_update2(ProductTest) [test/unit/product_test.rb:30]: <29.95> expected but was <99.95>. 3 tests, 11 assertions, 1 failures, 0 errors
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 22
1
How to write unit tests with respect to model callbacks?
Hello, I am exploring the "Testing" part of Rails, but It seems some things work differently than I thought it would. Consider the following model: class Client < ActiveRecord::Base has_one :project def after_create Project.new(:name => self.name, :is_client => true, :client_id => self.id).save end def after_update
2006 Feb 22
3
Unit test failure - nil object?
I''m following instructions in the Agile book, page 146 for testing an object update to the database. Here''s my code: def test_update assert_equal "jack@smiths.com", @user.email @user.email = "jack@smiths.org" assert @user.save, @user.errors.full_messages.join("; ") @user.reload assert_equal @user.email,
2006 Jul 06
0
problema con i test automatizzati
ciao a tutti.     come al solito, sto andando avanti a piccoli passi nel creare l''applicazione depot del libro "Sviluppare Applicazioni Web con Rails". Ora mi trovo nella fase di creazione dei test automatizzati. Ma c''è una cosa che proprio non capisco: Ho la seguente classe in ~/depot/test/unit/product_test.rb require File.dirname(__FILE__) +
2007 Jan 29
0
Rails 1.2.1 reload of active record changed?
Hi All, I have a following test case: def test_update_settings assert @unit.setting!=nil assert_equal @unit.setting,@current_setting @unit.setting.mode = true assert @unit.save @unit.reload assert @unit.setting.mode end Which worked (and still works on 1.1.6) pretty well before the upgrade to 1.2.1 and now the last assertion fails. Any ideas? -- Posted via
2006 Apr 21
2
destory Test Case Messes up all tests
I am trying to create unit tests for my users model but when I add a test that destroys a user, that user is not available in any of the other test. If I remove the test that destroys the user all my other tests work again. All the fixtures are suppose be reloaded between tests right? Here is my testcase : require File.dirname(__FILE__) + ''/../test_helper'' class UserTest
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 May 04
2
Testing associations
I have a pretty simple model, articles and users. class Article belongs_to :user end class User has_many :articles end In my unit tests I want to ensure that the associations work properly. What''s the best way to do this? The obvious thing to do is a test in each model. # user_test.rb def test_add_post u = users(:first) before_articles = u.articles.count u.articles
2018 Feb 06
0
GPOs not Working!
Thanks for help, this is a new domain controller without any modifcations, except one GPO. I have the "Default Domain Policy" and created an addtional GPO, named "test_something". Both are linked at the top of the domain. I configured at the "test_something" GPO: # Interactive logon: Do not require CTRL + ALT + DEL -> activate # Interactive login: Do not
2006 May 15
0
acts_as_list, move_higher, odd indexing behaviour?
Hi, [reposting to list, posting via google groups apparently didn''t work] I''m trying to use acts_as_list for the first time. Can anyone confirm the odd behaviour reported here? http://blog.nominet.org.uk/tech/Web/2006/03/06/Using_acts_as_list_in_... i.e. element access and move_higher require an odd indexing scheme to work. I''m personally finding that I
2006 Mar 20
2
Testing Models And Fixtures
I have finally decided to look into testing and I am going through the examples in the AWDWR book and I tried the following and it does not work... even though I don''t see why it shouldn''t. =========== posts.yml =========== basic_post: id: 1 title: Title body: Body created_at: 2006-02-01 00:00:00 updated_at: 2006_02-02 00:00:00
2009 May 24
6
belongs_to not saving foreign key
Under Rails 2.3.2 using a completely brand new project, I have 2 models: class Author < ActiveRecord::Base # name:string end class Book < ActiveRecord::Base # title:string belongs_to :author # author_id end And a simple test where i create a Book with an Author using the belongs_to and then update the foreign key directly: require ''test_helper'' class BookTest
2006 Apr 13
0
Globalize not with Rails 1.1.2
Does anybody have the latest Globalize (r184) working with Rails 1.1.2? I can''t seem to get a very simple example to work: ----- ruby test/unit/news_item_test.rb Loaded suite test/unit/news_item_test Started F. Finished in 0.10109 seconds. 1) Failure: test_add_content_translations(NewsItemTest) [test/unit/news_item_test.rb:49]: <"US Title"> expected but was
2018 Jan 19
1
samba_dlz shutting down on named reload
On 17 January 2018 at 16:00, Kristján Valur Jónsson via samba < samba at lists.samba.org> wrote: > Well, I had a cursory glance dlz_bind9.c and also the bind9 source code I > could find ( > http://users.isc.org/~each/doxygen/bind9/dlz__dlopen__driver > _8c-source.html) > and didn´t see any provision for 'reload' in there. > bind is clearly calling the dlz_destroy()
2018 Feb 06
1
GPOs not Working!
now, im on a phone and no browser, so limit help. first thing i see.   CN=Bj”rn <User>,CN=Users,DC=rootrudi,DC=de Bj”rn ?  is your system set to utf8? i dont know, but this does not look right. i see, wifi? yes, try utp. langsame Verbindung:500 kbps and do try the ignore systemacl.  that solves the user/group “nt authority\system” problems the easy way. greetz Louis Op 6 feb. 2018
2008 May 07
1
Assigning to the foreign key on a belongs_to association
I''ve encountered what seems like an odd omission in the behaviour of belongs_to associations: if you assign to the foreign key attribute, it doesn''t update the associated object (or mark a previously loaded one as stale) until you explicitly save or reload it. Let''s say we have a Company model, which belongs_to :city : >> torchbox =
2006 Nov 04
0
Functional test issue for testing newbie
Hi there I''m having difficulty succesfully updating attributes via a post request in a functional test. Here''s some pastes: ###################################### # account_controller.rb def edit_details @user = User.find(self.current_user.id) return unless request.post? if @user.update_attributes(params[:user]) flash[:notice_good] = ''Your account details
2006 Mar 01
3
console doesn''t reload app
When using scripts/console, changes made to any classes/methods in my application files do not reflect in the console until i restart it. I verified that RAILS_ENV is indeed set to development. Isn''t that supposed to reload the app on every call? is the console different? Thanks, Sebastian