Merge branch 'master' into fix_markdown_hint

This commit is contained in:
Stella Rouzi 2017-06-27 17:57:46 +03:00 committed by GitHub
commit 0a2b085bfd
4 changed files with 8 additions and 16 deletions

View file

@ -288,14 +288,6 @@ Style/ColonMethodCall:
- 'app/models/commercial.rb' - 'app/models/commercial.rb'
- 'app/models/contact.rb' - 'app/models/contact.rb'
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: Keywords.
# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW
Style/CommentAnnotation:
Exclude:
- 'app/models/event_user.rb'
# Offense count: 14 # Offense count: 14
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/CommentIndentation: Style/CommentIndentation:

View file

@ -1,5 +1,5 @@
class EventUser < ActiveRecord::Base class EventUser < ActiveRecord::Base
# TODO Do we need these roles? # TODO: Do we need these roles?
ROLES = [%w[Speaker speaker], %w[Submitter submitter], %w[Moderator moderator]] ROLES = [%w[Speaker speaker], %w[Submitter submitter], %w[Moderator moderator]]
belongs_to :event belongs_to :event

View file

@ -4,9 +4,13 @@ describe Admin::EventsController do
let(:conference) { create(:conference) } let(:conference) { create(:conference) }
let(:organizer_role) { Role.find_by(name: 'organizer', resource: conference) } let(:organizer_role) { Role.find_by(name: 'organizer', resource: conference) }
let(:organizer) { create(:user, role_ids: organizer_role.id) } let(:organizer) { create(:user, role_ids: organizer_role.id) }
let!(:event_without_commercial) { create(:event, program: conference.program) } # The where_object() and where_object_changes() methods of paper_trail gem are broken when having:
let!(:event_with_commercial) { create(:event, program: conference.program) } # an Event with ID 1, an Event with ID 2, and a commercial with ID 1, for event with ID 2
let!(:event_commercial) { create(:event_commercial, commercialable: event_with_commercial, url: 'https://www.youtube.com/watch?v=M9bq_alk-sw') } # (the numbers could be different as long as there is this matching of IDs).
# We implemented or own where method to solve this and those ids are for testing this case.
let!(:event_without_commercial) { create(:event, id: 1, program: conference.program) }
let!(:event_with_commercial) { create(:event, id: 2, program: conference.program) }
let!(:event_commercial) { create(:event_commercial, id: 1, commercialable: event_with_commercial, url: 'https://www.youtube.com/watch?v=M9bq_alk-sw') }
with_versioning do with_versioning do
describe 'GET #show' do describe 'GET #show' do
@ -17,8 +21,6 @@ describe Admin::EventsController do
it 'assigns versions' do it 'assigns versions' do
versions = event_without_commercial.versions versions = event_without_commercial.versions
expect(event_without_commercial.id).to eq event_commercial.id
expect(event_commercial.id).not_to eq event_commercial.commercialable_id
expect(assigns(:versions)).to eq versions expect(assigns(:versions)).to eq versions
end end
end end

View file

@ -286,8 +286,6 @@ feature 'Version' do
expect(page).to have_text('Someone (probably via the console) created new commercial') expect(page).to have_text('Someone (probably via the console) created new commercial')
visit admin_conference_program_event_path(conference.short_title, event_without_commercial) visit admin_conference_program_event_path(conference.short_title, event_without_commercial)
click_link 'History' click_link 'History'
expect(event_commercial.id).not_to eq event_commercial.commercialable_id
expect(event_without_commercial.id).to eq event_commercial.id
expect(page).to have_no_text('Someone (probably via the console) created new commercial') expect(page).to have_no_text('Someone (probably via the console) created new commercial')
end end