← Back to Upcase

Please help with testing, data dependent logic

(Alex Lapchenko) #1

Hello everyone!
I’m working in Rails project with a lot of GPS Data. On my model is gps records grouped by hour and stored in JSON field in PostgreSQL record as hash:

# model
GpsLoggerDataItem(id: integer, hour_start: datetime, data_records: json)
# data looks like this
data_records = [{"lat"=>%latitude%, "long"=>%longitude%, "time"=>unix_timestamp}..]

And I have trouble with tests, with this gps data specific logic. I have to manually copy and paste gps records. And I don’t now how to pair all these gps data with Factories or automatically generate fixtures.

Do you ever had experience with gps data, how you tested such domain logic?
Is there is any way to generate fixtures from existing objects?
Any suggestions will be appreciated.

(Chris Toomey) #2

Hi @ozeron, could you share a specific test case that you want to clean up? I expect you should be able to use a combination of factories and helper methods to clean up the tests, but hard to say from a distance.