gitlab-org--gitlab-foss/spec/support/track_untracked_uploads_helpers.rb

21 lines
677 B
Ruby
Raw Normal View History

2017-11-08 18:05:08 -05:00
module TrackUntrackedUploadsHelpers
2017-11-15 02:15:30 -05:00
def uploaded_file
fixture_path = Rails.root.join('spec', 'fixtures', 'rails_sample.jpg')
fixture_file_upload(fixture_path)
2017-11-08 18:05:08 -05:00
end
def ensure_temporary_tracking_table_exists
Gitlab::BackgroundMigration::PrepareUntrackedUploads.new.send(:ensure_temporary_tracking_table_exists)
end
def drop_temp_table_if_exists
ActiveRecord::Base.connection.drop_table(:untracked_files_for_uploads) if ActiveRecord::Base.connection.table_exists?(:untracked_files_for_uploads)
end
def create_or_update_appearance(attrs)
a = Appearance.first_or_initialize(title: 'foo', description: 'bar')
a.update!(attrs)
a
end
2017-11-08 18:05:08 -05:00
end