I have the factory
FactoryBot.define do
factory :activity_fit_file do
association :user, factory: :user
activity_type {:cycling}
after(:build) do |activity|
activity.original_activity_log_file.attach(
io: File.open("#{Rails.root}/spec/files/example_fit_file.fit"),
filename: 'example_fit_file.fit',
content_type: 'application/vnd.ant.fit'
)
end
end
end
and in my spec I have
require 'rails_helper'
RSpec.describe "Activity upload fixer" do
it 'converts fit files to gpx' do
activity = FactoryBot.create(:activity_fit_file)
end
end
Running the spec gives the error
NameError:
uninitialized constant ActivityFitFile
Not quite sure what is wrong because it seems the same as other working factories.
ActivityFitFile
? – Broadtail