2013-04-15 36 views
6

我更新'shoulda-matchers'我的rails項目中的Gemfile從版本1.4.2到2.0.0,現在當我運行我的rspec測試時,它給了我以下錯誤未定義的方法'assign_to'更新後shoulda-matchers

undefined method `assign_to' for #<RSpec::Core::ExampleGroup::Nested_4::Nested_1::Nested_4::Nested_1:0x007fc96eaaaf48> 

在新的2.0.0版本中刪除了這種方法嗎?

回答

13

是的,以下方法在版本1.5.0中已棄用,並在版本2.0.0的shoulda-matchers中刪除。

  • assign_to
  • respond_with_content_type
  • query_the_database
  • validate_format_of
  • have_sent_email
  • permit(強參數匹配)
  • delegate_method

如果您正在使用這些方法,開發人員建議以另一種方式測試代碼。

有關更改的簡要列表,您可以訪問https://github.com/thoughtbot/shoulda-matchers/blob/master/NEWS.md#v-200

有關這些方法被刪除的更改和原因的更詳細列表,您可以訪問他們的博客http://robots.thoughtbot.com/post/47031676783/shoulda-matchers-2-0

相關問題