-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Integration: Minitest
Maxim Perepelitsa edited this page Jul 2, 2024
·
2 revisions
class Minitest::Test
include FactoryBot::Syntax::Methods
end
Including FactoryBot::Syntax::Methods
gives you access to build
, build_list
, create
, create_list
, and attributes_for
directly in your tests, such as:
def test_renders_itself
user = create(:user, articles: build_list(:article, 2)) # not FactoryBot.create or FactoryBot.build_list
writer = build(:writer) # not FactoryBot.build
user.render(writer)
assert_equal writer.to_s, "User with two articles"
end