Added device jobs model
This commit is contained in:
38
test/controllers/device_jobs_controller_test.rb
Normal file
38
test/controllers/device_jobs_controller_test.rb
Normal file
@@ -0,0 +1,38 @@
|
||||
require "test_helper"
|
||||
|
||||
class DeviceJobsControllerTest < ActionDispatch::IntegrationTest
|
||||
setup do
|
||||
@device_job = device_jobs(:one)
|
||||
end
|
||||
|
||||
test "should get index" do
|
||||
get device_jobs_url, as: :json
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should create device_job" do
|
||||
assert_difference('DeviceJob.count') do
|
||||
post device_jobs_url, params: { device_job: { device_id: @device_job.device_id, id: @device_job.id, job_id: @device_job.job_id, references: @device_job.references } }, as: :json
|
||||
end
|
||||
|
||||
assert_response 201
|
||||
end
|
||||
|
||||
test "should show device_job" do
|
||||
get device_job_url(@device_job), as: :json
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
test "should update device_job" do
|
||||
patch device_job_url(@device_job), params: { device_job: { device_id: @device_job.device_id, id: @device_job.id, job_id: @device_job.job_id, references: @device_job.references } }, as: :json
|
||||
assert_response 200
|
||||
end
|
||||
|
||||
test "should destroy device_job" do
|
||||
assert_difference('DeviceJob.count', -1) do
|
||||
delete device_job_url(@device_job), as: :json
|
||||
end
|
||||
|
||||
assert_response 204
|
||||
end
|
||||
end
|
||||
15
test/fixtures/device_jobs.yml
vendored
Normal file
15
test/fixtures/device_jobs.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
references:
|
||||
references:
|
||||
id:
|
||||
job_id: 1
|
||||
device_id: 1
|
||||
|
||||
two:
|
||||
references:
|
||||
references:
|
||||
id:
|
||||
job_id: 1
|
||||
device_id: 1
|
||||
7
test/models/device_job_test.rb
Normal file
7
test/models/device_job_test.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
require "test_helper"
|
||||
|
||||
class DeviceJobTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
||||
Reference in New Issue
Block a user