Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined method 'assign_to' after updating shoulda-matchers

I updated 'shoulda-matchers' in the Gemfile in my rails project from version 1.4.2 to 2.0.0 and now when I run my rspec tests, it is giving me the following error

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

Was this method removed in the new 2.0.0 release?

like image 245
Ryan Avatar asked Apr 15 '13 22:04

Ryan


1 Answers

Yes, the following methods were deprecated in version 1.5.0 and removed in version 2.0.0 of shoulda-matchers.

  • assign_to
  • respond_with_content_type
  • query_the_database
  • validate_format_of
  • have_sent_email
  • permit (strong parameters matcher)
  • delegate_method

The developers recommend testing the code in another way if you are currently using these methods.

For a brief list of changes you can visit https://github.com/thoughtbot/shoulda-matchers/blob/master/NEWS.md#v-200.

For a more detailed list of changes and reasons to why these methods were removed you can visit their blog http://robots.thoughtbot.com/post/47031676783/shoulda-matchers-2-0.

like image 145
Ryan Avatar answered Nov 11 '22 18:11

Ryan