Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dislocated parent tasks in FactoryBot - Part 1 #13604

Merged
merged 6 commits into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec/controllers/judge_assign_tasks_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
let!(:judge_staff) { create(:staff, :judge_role, sdomainid: judge.css_id) }
let!(:second_judge_staff) { create(:staff, :judge_role, sdomainid: second_judge.css_id) }

let!(:assign_tasks) { create_list(:ama_judge_task, 3, assigned_to: judge, parent: create(:root_task)) }
let!(:assign_tasks) { Array.new(3) { create(:ama_judge_task, assigned_to: judge, parent: create(:root_task)) } }
let!(:assignee) { attorney }
let!(:params) do
assign_tasks.map do |assign_task|
Expand Down
10 changes: 4 additions & 6 deletions spec/controllers/tasks_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
end

get :index, params: { user_id: user.id, role: "unknown" }
expect(response).to have_http_status(:success)
expect(response).to be_successful

data = JSON.parse(response.body)["tasks"]["data"]

Expand Down Expand Up @@ -634,16 +634,14 @@

it "updates status to completed" do
expect(admin_action.versions.length).to be 0
expect(admin_action.parent.versions.length).to be 1
patch :update, params: { task: { status: Constants.TASK_STATUSES.completed }, id: admin_action.id }
expect(response.status).to eq 200
response_body = JSON.parse(response.body)["tasks"]["data"]
expect(response_body.first["attributes"]["status"]).to eq Constants.TASK_STATUSES.completed
expect(response_body.first["attributes"]["closed_at"]).to_not be nil
expect(admin_action.reload.versions.length).to eq 1
expect(admin_action.parent.versions.length).to eq 2
versions = PaperTrail::Version.where(request_id: admin_action.versions.first.request_id)
expect(versions.length).to eq 3
expect(versions.length).to eq 1
end

context "when some other user updates another user's task" do
Expand Down Expand Up @@ -801,7 +799,7 @@

assert_response :success
response_body = JSON.parse(response.body)
expect(response_body["tasks"].length).to eq 2
expect(response_body["tasks"].length).to eq 3

colocated_task = response_body["tasks"].find { |task| task["attributes"]["type"] == "IhpColocatedTask" }
expect(colocated_task).to_not be_nil
Expand All @@ -828,7 +826,7 @@
expect(task["attributes"]["assigned_to"]["css_id"]).to eq vso_user.css_id
expect(task["attributes"]["appeal_id"]).to eq appeal.id

expect(appeal.tasks.size).to eq 3
expect(appeal.tasks.size).to eq 5
end
end
end
Expand Down
Loading