search for: assert_kind_of

Displaying 20 results from an estimated 22 matches for "assert_kind_of".

2007 Nov 13
4
question about activerecord test_numeric_fields in base_test.rb
...use_population => 3 ) assert m.save m1 = NumericData.find(m.id) assert_not_nil m1 # As with migration_test.rb, we should make world_population >= 2**62 # to cover 64-bit platforms and test it is a Bignum, but the main thing # is that it''s an Integer. assert_kind_of Integer, m1.world_population assert_equal 6000000000, m1.world_population assert_kind_of Fixnum, m1.my_house_population assert_equal 3, m1.my_house_population assert_kind_of BigDecimal, m1.bank_balance assert_equal BigDecimal("1586.43"), m1.bank_balance assert_k...
2006 Jun 08
1
fixtures instance variable naming
...s_releases.yml as a fixture with: first: id: 1 title: my first release body: this is still my first test of a news release publish: 0 date_publication: 2006-06-06 17:28:00 in news_release_test.rb, i have def setup @news_release = NewsRelease.find(1) end def test_create assert_kind_of NewsRelease, @news_release assert_equal @news_release["first"]["id"], @news_release.id end and i receive: "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.[]...
2006 May 03
1
Test not Reseting
...username => ''cwinslett'', :password => ''testpassword''}) @chris_logged_in = @chris_logged_in.try_to_login @sherri = User.find(2) @delete_victim = User.find(4) end # Replace this with your real tests. def test_truth assert_kind_of User, @chris_logged_in assert_kind_of User, @sherri assert_kind_of User, @investor end def test_destroy @delete_victim.destroy assert_raise(ActiveRecord::RecordNotFound){User.find(@delete_victim.id)} end def test_create_user @tom_lawyer = User.new @tom_l...
2006 Jan 16
2
My first test - named fixture not autoloading instance variable
...I think is a simple unit test: ========= 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. Th...
2005 Dec 31
2
Test Unit Problem
...-31 06:53:00 I also have the following 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}" p...
2004 Feb 01
2
test_services test case
...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 the services() function in service.c. As far as I can tell, the only reason for this to happen would have something to do with th...
2006 Apr 13
0
Globalize not with Rails 1.1.2
...ize_languages, :globalize_translations def test_add_content_translations NewsItem.delete_all Globalize::Locale.set_base_language(''en-US'') # create a row in the base language Globalize::Locale.set(''en-US'') assert_nothing_raised() do assert_kind_of NewsItem, NewsItem.create!(:title => ''US Title'', :excerpt => ''US excerpt'', :body => ''US body copy'') end assert_equal 1, NewsItem.fi...
2006 Apr 21
2
NoMethodError with test_read_with_hash
...u didn''t expect it! You might have expected an instance of Array. The error occured while 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_...
2006 Jan 03
3
Rails Noob Question
...into a hitch when it was saying that my fixture variable was nil: require File.dirname(__FILE__) + ''/../test_helper'' class MessageTest < Test::Unit::TestCase fixtures :messages, :tags, :messages_tags def setup @message = Message.find(1) end def test_create assert_kind_of Message, @message assert_not_nil @messages # assert_equal @messages["peace_message"].title, @message.title end end The three fixtures exist (messages, tags, messages_tags) and have data. Brute force tests (assert_equal "my message title", @message.title) pass. But the...
2006 Mar 20
2
Testing Models And Fixtures
...2006-02-01 00:00:00 updated_at: 2006_02-02 00:00:00 =========== post_test.rb =========== require File.dirname(__FILE__) + ''/../test_helper'' class PostTest < Test::Unit::TestCase fixtures :posts def setup @post = Post.find(1) end def test_create assert_kind_of Post, @basic_post assert_equal @basic_post.id, @post.id assert_equal @basic_post.title, @post.title assert_equal @basic_post.body, @post.body assert_equal @basic_post.created_at, @post.created_at_before_type_cast assert_equal @basic_post.updated_at,...
2006 Feb 08
0
Fixture access question
Hi, I want to add the basic model record create tests for my rails app as in the "Agile Web Development with Rails" example: i.e. (header stuff and boring repitition missed) def test_create assert_kind_of Requirement, requirements(:requirement_1) assert_equal <at>requirements["requirement_1"]["name"], requirements(:requirement_1).name end Now I''m not supposed to use <at>requirements since that''s slow but how do I now "get" to the Fixture...
2006 Jan 10
2
Default unit tests failing?
I''ve got a strange issue. My default unit tests are failing for two models. I haven''t changed _anything_ in the test. Here''s an example: Output: 1) Error: test_truth(ShippingCostTypeTest): 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.find
2006 Jul 06
0
problema con i test automatizzati
...~/depot/test/unit/product_test.rb require File.dirname(__FILE__) + ''/../test_helper'' class ProductTest &lt; 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 &qu...
2005 Dec 22
2
nonstandard postgresql sequence names
...st_helper'' class SponsorTest < Test::Unit::TestCase self.use_transactional_fixtures = true fixture :sponsors, :table_name => "sponsor" fixture :eligibilities, :table_name => "topic_eligibility" # Replace this with your real tests. def test_truth assert_kind_of Sponsor, sponsors(:first) end end (The "fixture" method comes from a patch that allows me to specify non-standard table names--the table in this case is called sponsor, not sponsors). The sponsor table''s primary key column is called "sponsor_key" instead of id, a...
2006 Nov 26
0
[758] trunk/wxruby2: i18n support: added Locale class, methods for get/set languages & encodings
...#39;'wx'' +class TestApp < Wx::App + attr_accessor :test_class + def on_init + Test::Unit::UI::Console::TestRunner.run(self.test_class) + end +end + +class TestInternationalisation < Test::Unit::TestCase + def test_encodings + default = Wx::Font.get_default_encoding + assert_kind_of(Integer, default) + assert_kind_of(String, Wx::Font.get_default_encoding_name) + assert_match(/\A[-A-Z0-9]+\z/, Wx::Font.get_default_encoding_name) + + Wx::Font.set_default_encoding(Wx::FONTENCODING_UTF8) + assert_equal(Wx::FONTENCODING_UTF8, Wx::Font.get_default_encoding) + assert_e...
2007 Jun 27
5
Mosquito Fixtures Won''t Load
...9;mosquito'' require File.dirname(__FILE__) + "/../tracker" Tracker.create include Tracker::Models ... class TestMeasurement < Camping::UnitTest fixtures :tracker_measurements, :tracker_projects ... def test_should_have_project measurement = Measurement.find 1 assert_kind_of Project, measurement.project # measurement.project is always nilClass assert_equal measurement.project_id, measurement.project.id end ... end The test.log shows that tracker_measurements.yml is loaded, but tracker_projects.yml never is touched. I know the relationship works because...
2005 Dec 22
1
How to write unit tests with respect to model callbacks?
...d) end def before_destroy self.project.destroy end end and the following test: require File.dirname(__FILE__) + '/../test_helper' class ClientTest < Test::Unit::TestCase fixtures :clients def setup @client = Client.find(1) end def test_create assert_kind_of Client, @client assert_equal 1, @client.id assert_equal clients(:elasto_client).name, @client.name end def test_update assert_equal clients(:elasto_client).description, @client.description @client.description = "TEST UPDATE DESCRIPTION" assert @client....
2006 May 05
7
Testing model: test becomes dependent on previous test
...==================================================== require 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 Programmer", @product.title assert_equal "Best book for the programmer", @product.description assert_equal "http://localhost:3000/images/pp.jpg", @product.image_url assert_equal 2...
2007 Jan 07
3
slow tests on an established project...
Hi all Hope this isn''t too far off-topic on this list, as I think it would largely go ignored on the main rails list. I''m looking for the most pragmatic way to speed up our test suite. This is on an established project, and lets just say that we used way too many fixtures when we started =). For example: Finished in 128.870144 seconds. =============== 392 tests, 2106
2006 Jan 03
20
Subversion AND Rails hosting
I''ve been scouring the net looking for different hosting solutions, but have so far only found one site that has what I''m looking for. I would like to be able to host both a subversion repository for development and my rails application(s) all in one location. So far, I''ve only found a company called AVLUX (http://avlux.net/host.php) that has this. Does anyone know of