add basic tests

This commit is contained in:
miha 2021-03-29 10:52:02 +02:00
parent 11284d3b87
commit 8f0713229a

View file

@ -103,4 +103,27 @@ describe Activity, type: :model do
end
end
end
describe '.notifiable?' do
context 'Creating notifiable activity' do
let(:activity) do
create :activity,
subject: (create :task_comment),
type_of: 'add_comment_to_module', subject_type: 'MyModule'
end
it 'is notifiable when when creating comment' do
expect(activity.send(:notifiable?)).to be true
end
end
context 'Creating non-notifiable activity' do
let(:activity) do
create :activity,
subject: (create :my_module),
type_of: 'create_module', subject_type: 'MyModule'
end
it 'is not notifiable when when creating new task' do
expect(activity.send(:notifiable?)).to be false
end
end
end
end