[STABLE] Fix failing tests. Needs some FE QA.

pull/305/head
Rick Carlino 2016-12-27 09:29:58 -06:00
parent f20f350536
commit aaf0fdb356
2 changed files with 3 additions and 13 deletions

View File

@ -17,7 +17,7 @@ module Api
if raw_json[:tools]
mutate Tools::BatchUpdate.run(raw_json, device: current_device)
else
mutate Tools::Create.run(create_params)
mutate Tools::Create.run(raw_json, device: current_device)
end
end
@ -33,16 +33,6 @@ private
output
end
def create_params
if @create_params
@create_params
else
@create_params = { name: params[:name],
device: current_device }
@create_params
end
end
def tools
Tool.where(device: current_device)
end

View File

@ -11,7 +11,7 @@ describe Api::ToolsController do
sign_in user
payload = { tool_slot_id: tool_slot.id, name: "wow" }
old_tool_count = Tool.count
post :create, params: payload
post :create, body: payload.to_json, params: {format: :json}
expect(response.status).to eq(200)
expect(Tool.count).to be > old_tool_count
expect(json[:name]).to eq("wow")
@ -21,7 +21,7 @@ describe Api::ToolsController do
sign_in user
payload = { name: "wow2" }
old_tool_count = Tool.count
post :create, params: payload
post :create, body: payload.to_json, params: {format: :json}
expect(response.status).to eq(200)
expect(Tool.count).to be > old_tool_count
end