Added table jobs and devices

This commit is contained in:
2021-10-20 12:17:31 +02:00
parent 799f55335f
commit 842a55be5f
14 changed files with 266 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
require "test_helper"
class DevicesControllerTest < ActionDispatch::IntegrationTest
setup do
@device = devices(:one)
end
test "should get index" do
get devices_url, as: :json
assert_response :success
end
test "should create device" do
assert_difference('Device.count') do
post devices_url, params: { device: { device_id: @device.device_id } }, as: :json
end
assert_response 201
end
test "should show device" do
get device_url(@device), as: :json
assert_response :success
end
test "should update device" do
patch device_url(@device), params: { device: { device_id: @device.device_id } }, as: :json
assert_response 200
end
test "should destroy device" do
assert_difference('Device.count', -1) do
delete device_url(@device), as: :json
end
assert_response 204
end
end

View File

@@ -0,0 +1,38 @@
require "test_helper"
class JobsControllerTest < ActionDispatch::IntegrationTest
setup do
@job = jobs(:one)
end
test "should get index" do
get jobs_url, as: :json
assert_response :success
end
test "should create job" do
assert_difference('Job.count') do
post jobs_url, params: { job: { job_id: @job.job_id, params: @job.params, type: @job.type } }, as: :json
end
assert_response 201
end
test "should show job" do
get job_url(@job), as: :json
assert_response :success
end
test "should update job" do
patch job_url(@job), params: { job: { job_id: @job.job_id, params: @job.params, type: @job.type } }, as: :json
assert_response 200
end
test "should destroy job" do
assert_difference('Job.count', -1) do
delete job_url(@job), as: :json
end
assert_response 204
end
end