similar to: A unit test that should pass

Displaying 20 results from an estimated 1000 matches similar to: "A unit test that should pass"

2006 Mar 24
2
before_destroy not called
Hello, I''m trying to intercept delete call in my model but before_destroy callback is never called... Somebody knows why ? Thanks The controller : def delete Image.delete(params[:id]) redirect_to :action => "list" end The model : class Image < ActiveRecord::Base set_table_name "publish_images" belongs_to :article before_destroy :on_destroy
2006 Apr 01
1
set_table_name and fixtures
Hello, I''ve encountered a fixtures really frustrating bug : model, YAML file and db table names must be the same because of the fixture library ignoring the set_table_name provided in the model. Is there anything to do ? Thanks -- Posted via http://www.ruby-forum.com/.
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
2006 Mar 26
0
Another test problem
I hope there''s not a typo this time ;-) With self.use_instantiated_fixtures = false in test_helper.rb (default since 1.0 version) I want on demand instances. This @publish_articles[''article_linux''] return a Fixture object (breakpointed, I see the data of fixture fields). So I assume that publish_articles is well populated with fixture datas This assert_equal
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__) +
2006 Mar 23
5
Custom date format
Hi, I''ve followed these directions : http://railswiki.pdxruby.org/HowToDefineYourOwnDateFormat.html It seems pretty straightforward but obviously it doesn''t work for me... article.date_edited.to_formatted_s(:my_format_1) produce a default formatted date, not the one I''ve defined in environment.rb : ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(
2006 Jul 22
3
Extend dynamically a model
Hello, I''ve a model defined as class Account < ActiveRecord::Base end This maps a mysql table Accounts. I want to be a able to dynamically change this model. During the life of my app, the table Accounts may change name, how do I do a set_table_name not within account.rb? -- Posted via http://www.ruby-forum.com/.
2006 Mar 25
4
dynamic set_table_name for achives
How can I pass something to set_table_name so that I can switch tables on the fly for accessing archive data? If I could access sessions inside a model I would do something like: if @session[:current_period] set_table_name "statistics_" + @session[:archive_year] else set_table_name "statistics_" + Date.now.year end But since I cannot access the session from within a
2006 Mar 30
5
Re: How to Password Protect a Controller
Sure, have a look to the login generator (gem install login_generator) -, then script/generate It''s very easy to use. -- Posted via http://www.ruby-forum.com/.
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
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
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 ++--
2016 Jul 28
2
Eliminar filas al principio y final de un .csv en R
Muchas gracias Carlos, la lógica es perfecta pero no se como identificar con código las lineas en blanco entre el bloque 2 y el bloque 3. Para de esta forma quedarme solo con el bloque 2. Tienes alguna idea? Muchas gracias. Joan 2016-07-28 17:00 GMT+02:00 Carlos Ortega <cof en qualityexcellence.es>: > Hola, > > Se me ocurre esta solución en pseudo-código...: > > >
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
2007 Jan 14
2
rspec and set_table_name?
Hi there I have a Value class in my Rails app; however ''values'' is a reserved word in MySQL so in my value.rb file, I''ve declared set_table_name as ''vals''. However, in setting up my specs for this model, I''m hitting errors that seem to be resulting from rspec not seeing the set_table_name declaration in my model file. For instance,
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
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 Apr 07
6
Foreign Key naming convention override
I am working with an existing database and have to keep all table and field names as they are. ''tblcustomers'' and ''tblitems'' are linked by the ''tblcustomers'' id field ''tblcustomersid''. In ''tblitems'', the foreign key is called ''txtcustomerid''. I have already set the customers model to
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 ActionController tests only? I can change my assert_valid(State.first) into assert
2006 Apr 18
7
Connecting to multiple databases
Hi Everyone, I am trying to connect to multiple databases and followed along the Recipe in Chad Fowlers ''Rails Recipes'' book (which basically is about establishing the connection in a subclass of ActiveRecord::Base, and inheriting all classes in need of this connection from this class) Chad Fowler says: "You won''t be able to instantiate an External, of course,