Search by type
parent
3bf9ea8416
commit
b49b128c60
|
@ -15,6 +15,7 @@ module Points
|
||||||
float :z
|
float :z
|
||||||
hstore :meta
|
hstore :meta
|
||||||
string :name
|
string :name
|
||||||
|
string :pointer_type, in: Point::POINTER_KINDS
|
||||||
end
|
end
|
||||||
|
|
||||||
def execute
|
def execute
|
||||||
|
|
|
@ -62,5 +62,20 @@ describe Api::PointsController do
|
||||||
expect(json).to be_kind_of(Array)
|
expect(json).to be_kind_of(Array)
|
||||||
expect(json.length).to eq(0)
|
expect(json.length).to eq(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'filters by point_type' do
|
||||||
|
sign_in user
|
||||||
|
d = user.device
|
||||||
|
tool_slot = FactoryBot.create(:tool_slot, device: d)
|
||||||
|
plant = FactoryBot.create(:plant, device: d)
|
||||||
|
generic_pointer = FactoryBot.create(:generic_pointer, device: d)
|
||||||
|
post :search,
|
||||||
|
body: { pointer_type: "Plant" }.to_json,
|
||||||
|
params: {format: :json }
|
||||||
|
expect(response.status).to eq(200)
|
||||||
|
expect(json).to be_kind_of(Array)
|
||||||
|
expect(json.length).to eq(1)
|
||||||
|
expect(json.first[:pointer_type]).to eq("Plant")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue