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
FactoryBot.define do
factory :item do
...
end
trait :carrying_votes do
after(:create) do |item|
create_list(:vote, 2, votable: item)
end
end
end
FactoryBot.define do
factory :vote, class: ActsAsVotable::Vote do
association :votable, factory: :item
association :voter, factory: :user
end
end
The test itself fails if the comment hash is removed...
it 'lists items with votes' do
item = create(:item, :carrying_votes)
get root_path
expect(response.body).to include(item.voter_names)
# expect(response.body).to include('2 votes')
end
What am I missing?
Thank you.
The text was updated successfully, but these errors were encountered:
Using factory bot to create vote and votable in tests does not give the expected '2 votes' result from this view:
Here is the factory for item and vote
The test itself fails if the comment hash is removed...
What am I missing?
Thank you.
The text was updated successfully, but these errors were encountered: