undefined method 'assign_to' after updating shoulda-matchers
Asked Answered
H

1

6

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?

Hyaline answered 15/4, 2013 at 22:21 Comment(0)
H
14

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.

Hyaline answered 15/4, 2013 at 22:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.