search for: test_find

Displaying 3 results from an estimated 3 matches for "test_find".

2006 Jul 23
0
[PATCH] (+tests) with_scope :order doesn''t work with included associations
...Trac is down?) with_scope doesn''t support :order in the presence of :include. For example: {{{ # We''re testing the interaction between :order, :include, and with_scope. TEST_ORDER = ''tickets.created_at DESC'' TEST_INCLUDE = [''owner''] def test_find(opts1, opts2) Ticket.with_scope(:find => opts1) do Ticket.find(:all, opts2).map {|t| t.id } end end # In these examples, :order is respected. test_find({ :order => TEST_ORDER }, {}) test_find({}, { :include => TEST_INCLUDE, :order => TEST_ORDER }) test_find({ :include =>...
2006 Apr 28
2
Accessing fixtures from unit tests
...rubyonrails.org/classes/Fixtures.html admin: id: 1 username: admin password: admin pbarry: id: 2 username: pbarry I have a unit test for my user model: require File.dirname(__FILE__) + ''/../test_helper'' class UserTest < Test::Unit::TestCase fixtures :users def test_find user = User.find(@admin.id) assert_equals(@admin.id,user.id) end end When I run the test, I get this: C:\ruby\workspace\lms>ruby test/unit/user_test.rb Loaded suite test/unit/user_test Started E Finished in 0.156 seconds. 1) Error: test_find(UserTest): RuntimeError: Called id fo...
2006 Oct 05
0
Where to add ActiveRecord::Base#find! tests
...about a while ago now, and just wondering what''s the best way to add these tests in? My problem is that for 75% of the tests in finder_test.rb [1] I also want to ensure that find! or find_by_name! or find_by_sql! works alongside the regular finds. I can duplicate the tests: def test_find assert_equal(topics(:first).title, Topic.find(1).title) end def test_find_with_bang assert_equal(topics(:first).title, Topic.find!(1).title) end or I can just add the test in below the other one: def test_find assert_equal(topics(:first).title, Topic.find(1).title)...