Create a factory for organizer

Refactor organizer user creation in tests

Fixes https://github.com/openSUSE/osem/issues/2398
This commit is contained in:
cyrille 2019-03-13 10:31:42 +01:00
parent 0197ed3c46
commit 35ec178beb
31 changed files with 48 additions and 68 deletions

View file

@ -4,8 +4,7 @@ require 'spec_helper'
describe Admin::EventsController do
let(:conference) { create(:conference) }
let(:organizer_role) { Role.find_by(name: 'organizer', resource: conference) }
let(:organizer) { create(:user, role_ids: organizer_role.id) }
let!(:organizer) { create(:organizer, resource: conference) }
# The where_object() and where_object_changes() methods of paper_trail gem are broken when having:
# an Event with ID 1, an Event with ID 2, and a commercial with ID 1, for event with ID 2
# (the numbers could be different as long as there is this matching of IDs).