Ruby on rails gem是否应该允许使用价值法
旧规范rbRuby on rails gem是否应该允许使用价值法,ruby-on-rails,rspec,shoulda,Ruby On Rails,Rspec,Shoulda,旧规范rb 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) } 我在我的规范文
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) }
我在我的规范文件中有这些代码,我像下面那样转换它们
新规范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) }
根据对
如何确保
包含的描述,您不需要明确阻止其他值
当然,这将是非常容易为自己检查这个