scinote-web/spec/controllers/repository_columns_controller_sepc.rb

35 lines
939 B
Ruby
Raw Normal View History

2019-03-07 16:05:35 +08:00
# frozen_string_literal: true
require 'rails_helper'
describe RepositoryColumnsController, type: :controller do
login_user
let(:user) { subject.current_user }
let(:team) { create :team, created_by: user }
let(:repository) { create :repository, created_by: user, team: team }
let(:repository_column) do
create :repository_column, created_by: user, repository: repository
end
describe 'DELETE destroy' do
2019-03-13 16:06:48 +08:00
let(:action) { delete :destroy, params: params, format: :json }
2019-03-07 16:05:35 +08:00
let(:params) do
{ repository_id: repository.id, id: repository_column.id }
end
it 'calls create activity for deleting inventory items' do
expect(Activities::CreateActivityService)
.to(receive(:call)
.with(hash_including(activity_type: :delete_column_inventory)))
2019-03-13 16:06:48 +08:00
action
end
it 'adds activity in DB' do
expect { action }
.to(change { Activity.count })
2019-03-07 16:05:35 +08:00
end
end
end