Testing scopes with proxy_options in Rails 3

Greetings I'm converting an rails 2 app to rails 3 and am having a time trying to update tests on some named_scopes. I've search and searched and cannot find anything that explains what I need to do. We are not using rspec so I need to know if there is another way to convert these named scopes.

The problem seems to be with the proxy_options.

My Test:

class ClassInstructorTest < ActiveSupport::TestCase   test "named_scope :find_instructor_for_a_course" do     expected = { :select => "instr_id, netid",               :conditions => ["crs_no = ? AND                                term = ? AND                                class_type = ? AND                                class_no = ?", 'HA5503', 'F10', 'LEC', 1] }     assert_equal expected, ClassInstructor.find_instructor_for_a_course('HA5503', 'F10', 'LEC', 1).proxy_options    end end

I get the following error when running my test:

1) Error: test_named_scope_:find_instructor_for_a_course(ClassInstructorTest): NoMethodError: undefined method `proxy_options' for [#<ClassInstructor instr_id: "SMITH", netid: "hms25">]:ActiveRecord::Relation     /test/unit/class_instructor_test.rb:10:in `test_named_scope_:find_instructor_for_a_course'

Can anyone show me how to rewrite this test? Thanks in advance. --jc

I figured out that I needed to change how I was testing my scope. Another forum site had this post by a guy named Ian (thanks Ian).

Ideally your unit tests should treat models (classes) and instances thereof as

black boxes. After all, it's not really the implementation you care about but the behavior of the interface.

So instead of testing that the scope is implemented in a particular way (i.e.

with a particular set of conditions), try testing that it behaves correctly—that it returns instances it should and doesn't return instances it shouldn't.