Skip to content

Commit

Permalink
Missing ':through' option for has_many association.
Browse files Browse the repository at this point in the history
  • Loading branch information
vsppedro committed May 23, 2021
1 parent c7a5747 commit deaaaa5
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -885,8 +885,16 @@ def belonging_to_non_existent_class(model_name, assoc_name, options = {})
end

it 'accepts an association with a valid :source option' do
expect(having_many_children(source: :user)).
to have_many(:children).source(:user)
define_model(:author) do
has_many :books
has_many :paperbacks, through: :books, source: :format, source_type: "Paperback"
end
define_model(:book, format_id: :integer) do
belongs_to :format, polymorphic: true
end
define_model(:paperback)

expect(Author.new).to have_many(:paperbacks).source(:format)
end

it 'rejects an association with a bad :source option' do
Expand Down

0 comments on commit deaaaa5

Please sign in to comment.