scinote-web/spec/controllers/results_controller_spec.rb

35 lines
714 B
Ruby
Raw Normal View History

2019-03-14 02:05:29 +08:00
# frozen_string_literal: true
require 'rails_helper'
describe ResultsController, type: :controller do
login_user
include_context 'reference_project_structure', {
result_text: true
}
2021-09-09 21:41:42 +08:00
describe 'DELETE destroy' do
let(:action) { delete :destroy, params: params }
2019-03-14 02:05:29 +08:00
let(:params) do
{ id: result_text.result.id }
end
before do
result_text.result.archive!(user)
2019-03-14 02:05:29 +08:00
end
it 'calls create activity service' do
expect(Activities::CreateActivityService).to receive(:call)
.with(hash_including(activity_type: :destroy_result))
action
end
2019-03-14 02:05:29 +08:00
it 'adds activity in DB' do
expect { action }
.to(change { Activity.count })
2019-03-14 02:05:29 +08:00
end
end
end