Topic: Testing scopes 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.
What I have:
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
endI get the following error:
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 without using rspec.