ruby on rails - When I run the test "rspec spec "In the console, I'll get a deprecation warning -
describe item 'calculates price according special formula' item = item.new('kettle', price: 200) item.price.should == 212 end end deprecation warnings:
using should rspec-expectations' old :should syntax without explicitly enabling syntax deprecated. use new :expect syntax or explicitly enable :should config.expect_with(:rspec) { |c| c.syntax = :should } instead. called e:/work/storeapp/spec/item_spec.rb:9:in `block (2 levels) in '.
if need more of backtrace of these deprecations identify make necessary changes, can configure config.raise_errors_for_deprecations!, , turn deprecation warnings errors, giving full backtrace.
1 deprecation warning total
finished in 0.00505 seconds (files took 0.17058 seconds load) 1 example, 0 failures
how warning can avoided?
write test in new style:
expect(item.price).to eq 212 btw. seems might doing sth quite risk/confusing. once assign 200 attribute, more confusing see value returned getter same name. have considered leaving original method alone , defining new 1 instead (like price_with_vat)?
Comments
Post a Comment