How to test a scope in Rails 3

前端 未结 6 537
夕颜
夕颜 2020-12-24 14:16

What\'s the best way to test scopes in Rails 3. In rails 2, I would do something like:

Rspec:

it \'should have a top_level scope\' do
  Category.top         


        
6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-24 14:36

    FWIW, I agree with your original method (Rails 2). Creating models just for testing them makes your tests way too slow to run in continuous testing, so another approach is needed. Loving Rails 3, but definitely missing the convenience of proxy_options!

提交回复
热议问题