Sah*_*har 4 ruby rspec ruby-on-rails
我的课程结构如下:
class Abc
ONE_CLASS_LEVEL_CONSTANT_BEING_READ_FROM_DB = GloablAttributeValue.read_from_db
def some_method_that_use_above_constant
# this function behaves differently for different values of ONE_CLASS_LEVEL_CONSTANT_BEING_READ_FROM_DB
end
end
Run Code Online (Sandbox Code Playgroud)
现在我想基于不同的值ONE_CLASS_LEVEL_CONSTANT_BEING_READ_FROM_DB对some_method_that_use_above_constant进行单元测试.这是否可以存根ONE_CLASS_LEVEL_CONSTANT_BEING_READ_FROM_DB的值,以便我可以测试它的不同值rspec?
| 归档时间: |
|
| 查看次数: |
734 次 |
| 最近记录: |