1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/spec/interactors/merge_contact_lists_spec.rb

39 lines
819 B
Ruby
Raw Normal View History

2019-08-14 09:10:09 -04:00
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe MergeContactLists do
subject { described_class.call from: from, to: to }
let(:from) { create :some_contact_list }
let(:to) { create :some_contact_list }
specify do
expect { subject }.to \
change(from.contacts, :count)
.from(from.contacts.count)
.to(0)
end
specify do
expect { subject }.to \
change(to.contacts, :count)
.from(to.contacts.count)
.to(from.contacts.count + to.contacts.count)
end
specify do
expect { subject }.to \
change(from.contacts, :to_a)
.from(from.contacts.to_a)
.to([])
end
specify do
expect { subject }.to \
change(to.contacts, :to_a)
.from(to.contacts.to_a)
.to(to.contacts.to_a + from.contacts.to_a)
end
end