0
old_spec.rb早该宝石allow_value方法
it { should allow_value(:nil).for(:invoice_type) }
it { should allow_value(:customer_invoice).for(:invoice_type) }
it { should allow_value(:creative_invoice).for(:invoice_type) }
it { should_not allow_value(:other).for(:invoice_type) }
我在规范文件中的这些代码,我将它们转换像下面。
new_spec.rb
it { should ensure_inclusion_of(:invoice_type).in_array(
[:nil,:customer_invoice,:creative_invoice]) }
我想知道的是,在第二个文件(new_spec.rb)我必须在此线。
it { should_not allow_value(:other).for(:invoice_type) }