Introducing delegation for city and country name (Conference - Venue

Using ActiveSupport delegate macro.
This commit is contained in:
Espartaco Palma 2020-01-23 21:20:10 -08:00 committed by Henne Vogelsang
parent f50a92bf53
commit fd2635509f
No known key found for this signature in database
GPG key ID: 9D6164C2955FADE0
2 changed files with 45 additions and 0 deletions

View file

@ -7,6 +7,48 @@ describe Conference do
let(:subject) { create(:conference, start_date: Date.new(2014, 06, 30), end_date: Date.new(2014, 06, 30)) }
context 'Delegation' do
context 'Venue' do
context 'when venue has not been set' do
it do
expect(subject.city).to eq(nil)
end
it do
expect(subject.country_name).to eq(nil)
end
it do
expect(subject.venue_name).to eq(nil)
end
it do
expect(subject.venue_street).to eq(nil)
end
end
context 'when venue has been set' do
before(:each) do
subject.update(venue: venue)
end
let(:venue) do
FactoryBot.create(:venue)
end
it do
expect(subject.city).to eq(venue.city)
end
it do
expect(subject.country_name).to eq(venue.country_name)
end
it do
expect(subject.venue_name).to eq(venue.name)
end
it do
expect(subject.venue_street).to eq(venue.street)
end
end
end
end
describe '#write_event_distribution_to_db' do
it 'updates pending conferences' do