Sha256: 5485cf82f929c8f79ae523cbf8b1444e2bc033344f51ba7ae38af40a61ba135d
Contents?: true
Size: 779 Bytes
Versions: 1
Compression:
Stored size: 779 Bytes
Contents
require "test_helper" class ActiveSupport::TestCase def self.test_data_mode(mode) case mode when :factory_bot require "factory_bot_rails" include FactoryBot::Syntax::Methods setup do TestData.truncate end teardown do TestData.rollback(:after_data_truncate) end when :test_data setup do TestData.load end teardown do TestData.rollback end end end end class SomeFactoryUsingTest < ActiveSupport::TestCase test_data_mode :factory_bot def test_boops create(:boop) assert_equal 1, Boop.count end end class SomeTestDataUsingTest < ActionDispatch::IntegrationTest test_data_mode :test_data def test_boops assert_equal 10, Boop.count end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
test_data-0.0.2 | example/test/integration/better_mode_switching_demo_test.rb |