ruby on rails - Fixtures not loaded using minitest to test services -
ruby on rails - Fixtures not loaded using minitest to test services -
i have added /app/services directory in rails app set business logic not related specific db table and/or may phone call external apis.
i added rakefile :
namespace :test desc "test tests/services/* code" rails::testtask.new(:services) |t| t.pattern = 'test/services/**/*_test.rb' end end rake::task['test:run'].enhance ["test:services"]
as can see, tests located within "/test/services".
now tests can performed using "spring rake test", except fixtures aren't loaded @ services. worst, if seek adding "fixtures :all" @ top of service test class, "undefined method `fixture' #
do have thought how can load fixtures tests located in non regular directory ?
yeah, chris kottom you've got reply ! trick utilize :
require 'test_helper' class vattest < activesupport::testcase # test code end
instead of :
require 'test_helper' describe vat # test code end
although latest way writing test works, not load fixtures.
ruby-on-rails unit-testing minitest
Comments
Post a Comment