Merge branch 'master' of https://github.com/openSUSE/osem into feature_tests2

This commit is contained in:
Chrisbr 2014-05-13 15:59:44 +02:00
commit 81a022776b
5 changed files with 26 additions and 14 deletions

View file

@ -29,15 +29,8 @@ class User < ActiveRecord::Base
end
def setup_role
if User.count == 0
admin = Role.where(name: 'Admin').first
self.role_ids = [admin.id] unless admin.nil?
end
if self.role_ids.empty?
participant = Role.where(name: 'Participant').first
self.role_ids = [participant.id] unless participant.nil?
end
roles << Role.find_by(name: 'Admin') if User.count == 0
roles << Role.find_by(name: 'Participant') if roles.empty?
end
def popup_details
@ -56,9 +49,9 @@ class User < ActiveRecord::Base
end
private
def create_person
# TODO Search people for existing email address, add to their account
build_person(:email => self.email) if person.nil?
true
end
def create_person
# TODO Search people for existing email address, add to their account
build_person(email: email) if person.nil?
true
end
end

View file

@ -2,6 +2,11 @@ require 'spec_helper'
describe Admin::ConferenceController do
# It is necessary to use bang version of let to build roles before user
let!(:organizer_role) { create(:organizer_role) }
let!(:participant_role) { create(:participant_role) }
let!(:admin_role) { create(:admin_role) }
let(:conference) { create(:conference) }
let(:admin) { create(:admin) }
let(:organizer) { create(:organizer) }

View file

@ -2,6 +2,11 @@ require 'spec_helper'
feature Conference do
# It is necessary to use bang version of let to build roles before user
let!(:organizer_role) { create(:organizer_role) }
let!(:participant_role) { create(:participant_role) }
let!(:admin_role) { create(:admin_role) }
shared_examples 'add and update conference' do |user|
scenario 'adds a new conference', feature: true, js: true do
expected_count = Conference.count + 1

View file

@ -1,6 +1,10 @@
require 'spec_helper'
feature Event do
# It is necessary to use bang version of let to build roles before user
let!(:organizer_role) { create(:organizer_role) }
let!(:participant_role) { create(:participant_role) }
let!(:admin_role) { create(:admin_role) }
shared_examples 'proposal workflow' do
scenario 'submitts a new proposal, accepts and confirms', feature: true, js: true do

View file

@ -52,6 +52,11 @@ describe Conference do
describe '#user_registered?' do
# It is necessary to use bang version of let to build roles before user
let!(:organizer_role) { create(:organizer_role) }
let!(:participant_role) { create(:participant_role) }
let!(:admin_role) { create(:admin_role) }
let(:user) { create(:user) }
context 'user not registered' do