|
|
@ -34,6 +34,7 @@ RSpec.describe CaseLogsController, type: :request do |
|
|
|
let(:in_progress) { "in_progress" } |
|
|
|
let(:in_progress) { "in_progress" } |
|
|
|
let(:completed) { "completed" } |
|
|
|
let(:completed) { "completed" } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when API" do |
|
|
|
let(:params) do |
|
|
|
let(:params) do |
|
|
|
{ |
|
|
|
{ |
|
|
|
"owning_organisation_id": owning_organisation.id, |
|
|
|
"owning_organisation_id": owning_organisation.id, |
|
|
@ -116,6 +117,25 @@ RSpec.describe CaseLogsController, type: :request do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context "when UI" do |
|
|
|
|
|
|
|
let(:user) { FactoryBot.create(:user) } |
|
|
|
|
|
|
|
let(:headers) { { "Accept" => "text/html" } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
before do |
|
|
|
|
|
|
|
RequestHelper.stub_http_requests |
|
|
|
|
|
|
|
sign_in user |
|
|
|
|
|
|
|
post "/logs", headers: headers |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "tracks who created the record" do |
|
|
|
|
|
|
|
created_id = response.location.match(/[1-9]+/)[0] |
|
|
|
|
|
|
|
whodunnit_actor = CaseLog.find_by(id: created_id).versions.last.actor |
|
|
|
|
|
|
|
expect(whodunnit_actor).to be_a(User) |
|
|
|
|
|
|
|
expect(whodunnit_actor.id).to eq(user.id) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "GET" do |
|
|
|
describe "GET" do |
|
|
|
let(:user) { FactoryBot.create(:user) } |
|
|
|
let(:user) { FactoryBot.create(:user) } |
|
|
|
let(:organisation) { user.organisation } |
|
|
|
let(:organisation) { user.organisation } |
|
|
|