4
我班不變的結構是這樣的:打樁一類水平rspec的
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
現在我想單元測試some_method_that_use_above_constant不同的值ONE_CLASS_LEVEL_CONSTANT_BEING_READ_FROM_DB的基礎上。 是否可以將ONE_CLASS_LEVEL_CONSTANT_BEING_READ_FROM_DB的值剔除,以便我可以在rspec
中測試不同的值?
感謝,聽起來有希望讓我試試,我會更新一次測試。 –
這個作品很神奇!謝謝。我已將它標記爲預期的答案! –