Shoulda-matchers: DEPRECATION WARNING: #tables currently returns both tables and views.

Created on 12 Jun 2016  路  12Comments  路  Source: thoughtbot/shoulda-matchers

With a spec

it { is_expected.to have_and_belong_to_many :teams }

The following deprecation warning is issued with Rails 5.0.0.RC1

DEPRECATION WARNING: #tables currently returns both tables and views. This behavior is deprecated and will be changed with Rails 5.1 to only return tables. Use #data_sources instead. (called from block (3 levels) in

馃洡 Rails 5

All 12 comments

+1

+1

+1

+1

Was this fixed in 15fe03052f6cf3b525fec6e25ab3f4905a956068? Will this fix be released in a new version?

Yes. The original PR was merged yesterday.
We are developing the Rails 5.0 support in the rails-5 branch, so I recommend using this branch in your Gemfile.

```ruby
gem 'shoulda-matchers', git: 'https://github.com/thoughtbot/shoulda-matchers.git', branch: 'rails-5'
````

Fixed by #943

@guialbuk is there anything we can do to contribute to the rails-5 branch? I'd love to see it merged into master, but not sure what still needs to be done to get it ready for that.

Hi, @jademcgough .
Sure! I'm adding the Rails 5 tag to some issues.
Another way to start contribution is taking a look at rails-5 branch failing tests.
Thanks!

Hi guys. Question about this. I was originally including just the shoulda gem:
gem 'shoulda', require: false

Then I upgraded to Rails 5.0 and I got the deprecation warning from shoulda-matchers. So, since shoulda says it doesn't have any code of its own, it's just shoulda-context + shoulda-matchers, I thought I could just replace that one gem statement with two:

gem 'shoulda-context'
gem 'shoulda-matchers', git: 'https://github.com/thoughtbot/shoulda-matchers.git', branch: 'rails-5'

My tests fail when I do this because it seems there really is stuff in the shoulda gem. At least it seems my app does stuff that relies on the shoulda gem.

Including all three gems also causes problems. Maybe I am doing something wrong, but is there a preferred way for me to use the main shoulda, the main shoulda-context but the Rails 5 branch of shoulda-matchers?

Hey @jasonperrone,

I'm assuming you're using Minitest, is that true? If that's true... shoulda-context is a little messed up right now. 馃槙 When I released shoulda-matchers 3.0, it broke support for shoulda-context. I documented the issue here: https://github.com/thoughtbot/shoulda-context/issues/53. I meant to address that then, but I haven't been able to in the past due to other priorities. Now that we're trying to get 4.0 out the door, we have an opportunity to address this now, but I wanted to get 4.0 in a state to where all of the Rails 5 issues were taken care of and that way anyone trying to use shoulda-context wouldn't run into them and open any new issues that were actually old issues. So as it stands, there is not a way to use shoulda-matchers master along with shoulda-context, but rest assured I know about this already and I will address this soon.

Understood. For now I am going to just include the master branch of the shoulda gem. The only negative effect I see thus far are deprecation warnings, so I'll just keep my eye out for updates to the main branch.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings