Set default `planted_at` value
parent
9f35dd9992
commit
87c22d4a96
|
@ -1,6 +1,10 @@
|
|||
class PlantSerializer < BasePointSerializer
|
||||
attributes :openfarm_slug, :plant_stage, :planted_at, :radius, :meta
|
||||
|
||||
def planted_at
|
||||
object.planted_at || object.created_at
|
||||
end
|
||||
|
||||
def x
|
||||
object.x.round
|
||||
end
|
||||
|
|
|
@ -130,6 +130,7 @@ describe Api::PointsController do
|
|||
get :index
|
||||
expect(response.status).to eq(200)
|
||||
expect(json.length).to eq(3)
|
||||
json.map { |json| expect(json[:created_at]).to eq(json[:planted_at]) }
|
||||
end
|
||||
it "lists all tool slots" do
|
||||
Point.destroy_all
|
||||
|
|
Loading…
Reference in New Issue