You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thank you for providing this great gem! :)
It seems I have an issue when I try to use a "have_and_belongs_to_many" matcher in an inherited model.
My models:
class User < ActiveRecord::Base
end
class Partner < ActiveRecord::Base
has_and_belongs_to_many :customers
end
class Customer < User
has_and_belongs_to_many :partners
end
My rspec tests:
RSpec.describe Customer, type: :model do
it { should have_and_belongs_to_many(:partners) }
end
The it { should have_and_belongs_to_many(:partners) } raise me that failure: expected #<Customer:0x00000006278818> to respond tohas_and_belongs_to_many?`
I have the same failure when trying to use it the partner model: expected #<Partner:0x00000008e9b8c8> to respond tohas_and_belongs_to_many?`
RSpec.describe Partner, :type => :model do
it { should have_and_belongs_to_many :customers }
end
I tried with a has_one and has_many association, the matchers seems to work fine.
The text was updated successfully, but these errors were encountered:
Arpsara
changed the title
shoulda-matchers and inherited models?
has_and_belongs_to_many and inherited models?
Mar 10, 2016
Arpsara
changed the title
has_and_belongs_to_many and inherited models?
have_and_belongs_to_many and inherited models?
Mar 10, 2016
Hi!
First of all, thank you for providing this great gem! :)
It seems I have an issue when I try to use a "have_and_belongs_to_many" matcher in an inherited model.
My models:
My rspec tests:
The it { should have_and_belongs_to_many(:partners) } raise me that failure:
expected #<Customer:0x00000006278818> to respond to
has_and_belongs_to_many?`I have the same failure when trying to use it the partner model:
expected #<Partner:0x00000008e9b8c8> to respond to
has_and_belongs_to_many?`I tried with a has_one and has_many association, the matchers seems to work fine.
The text was updated successfully, but these errors were encountered: