diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a7514f19..c968a091 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -434,7 +434,7 @@ Metrics/BlockNesting: # Offense count: 13 # Configuration parameters: CountComments. Metrics/ClassLength: - Max: 650 + Max: 652 # Offense count: 33 Metrics/CyclomaticComplexity: diff --git a/spec/models/conference_spec.rb b/spec/models/conference_spec.rb index b04869c6..1c3ecb3b 100755 --- a/spec/models/conference_spec.rb +++ b/spec/models/conference_spec.rb @@ -3,51 +3,37 @@ # frozen_string_literal: true require 'spec_helper' -describe Conference do +context 'Delegation' do + subject do + FactoryBot.create(:conference, start_date: 1.month.from_now, end_date: 2.month.from_now) + end - 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 + context 'Venue' do + context 'when venue has not been set' do + it 'the accessors should be nil' do + expect(subject.city).to eq(nil) + expect(subject.country_name).to eq(nil) + expect(subject.venue_name).to eq(nil) + 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 + context 'when venue has been set' do + it 'should delegate to venue' do + venue = FactoryBot.create(:venue) + subject.update(venue: venue) + expect(subject.city).to eq(venue.city) + expect(subject.country_name).to eq(venue.country_name) + expect(subject.venue_name).to eq(venue.name) + expect(subject.venue_street).to eq(venue.street) end end end +end + +describe Conference do + + let(:subject) { create(:conference, start_date: Date.new(2014, 06, 30), end_date: Date.new(2014, 06, 30)) } describe '#write_event_distribution_to_db' do