User/Person models merge
This commit is contained in:
parent
66b84e3660
commit
23bf55b66c
80 changed files with 1064 additions and 1221 deletions
|
|
@ -1,10 +1,10 @@
|
|||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :event_person do
|
||||
person
|
||||
factory :event_user do
|
||||
user
|
||||
|
||||
Hash[EventPerson::ROLES].values.each do |role|
|
||||
Hash[EventUser::ROLES].values.each do |role|
|
||||
factory role do
|
||||
event_role role
|
||||
end
|
||||
|
|
@ -33,7 +33,7 @@ FactoryGirl.define do
|
|||
libero quis porta ultricies. Fusce pulvinar accumsan lobortis.
|
||||
EOS
|
||||
after(:build) do |event|
|
||||
event.event_people << build(:submitter, event: event)
|
||||
event.event_users << build(:submitter, event: event)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :person do
|
||||
first_name 'Pat'
|
||||
last_name 'Jones'
|
||||
email 'pjones@nowhere.net'
|
||||
biography <<-EOS
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus enim
|
||||
nunc, venenatis non sapien convallis, dictum suscipit purus. Vestibulum
|
||||
sed tincidunt tortor. Fusce viverra nisi nisi, quis congue dui faucibus
|
||||
nec. Sed sodales suscipit nulla, accumsan porttitor augue ultrices vel.
|
||||
Quisque cursus facilisis consequat. Etiam volutpat ligula turpis, at
|
||||
gravida.
|
||||
EOS
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
FactoryGirl.define do
|
||||
factory :registration do
|
||||
person
|
||||
user
|
||||
conference
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,9 +2,18 @@
|
|||
FactoryGirl.define do
|
||||
factory :user do
|
||||
sequence(:email) { |n| "example#{n}@example.com" }
|
||||
sequence(:name) { |n| "name#{n}" }
|
||||
password 'changeme'
|
||||
password_confirmation 'changeme'
|
||||
confirmed_at Time.now
|
||||
biography <<-EOS
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus enim
|
||||
nunc, venenatis non sapien convallis, dictum suscipit purus. Vestibulum
|
||||
sed tincidunt tortor. Fusce viverra nisi nisi, quis congue dui faucibus
|
||||
nec. Sed sodales suscipit nulla, accumsan porttitor augue ultrices vel.
|
||||
Quisque cursus facilisis consequat. Etiam volutpat ligula turpis, at
|
||||
gravida.
|
||||
EOS
|
||||
|
||||
factory :participant do
|
||||
after(:create) { |user| user.role_ids = create(:participant_role).id }
|
||||
|
|
|
|||
|
|
@ -36,20 +36,11 @@ feature Event do
|
|||
select('YouTube', from: 'event[media_type]')
|
||||
fill_in 'event_media_id', with: '123456'
|
||||
|
||||
fill_in 'person_biography', with: 'Lorem ipsum biography'
|
||||
fill_in 'person_public_name', with: 'Example User'
|
||||
fill_in 'user_biography', with: 'Lorem ipsum biography'
|
||||
fill_in 'user_name', with: 'Example User'
|
||||
|
||||
click_button 'Submit Session'
|
||||
expect(current_path).to eq(edit_user_registration_path)
|
||||
|
||||
fill_in 'user_person_attributes_first_name', with: 'Example'
|
||||
fill_in 'user_person_attributes_last_name', with: 'User'
|
||||
fill_in 'user_person_attributes_biography', with: 'Lorem ipsum biography'
|
||||
|
||||
click_button 'Update'
|
||||
|
||||
expect(flash).
|
||||
to eq('You updated your account successfully.')
|
||||
expect(current_path).to eq(register_conference_path(conference.short_title))
|
||||
|
||||
expect(Event.count).to eq(expected_count)
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ describe Conference do
|
|||
e3 = create(:event, conference: subject)
|
||||
e4 = create(:event, conference: subject)
|
||||
|
||||
e3.event_people = [create(:event_person, person: e2.submitter, event_role: 'submitter')]
|
||||
e4.event_people = [create(:event_person, person: e2.submitter, event_role: 'submitter')]
|
||||
e3.event_users = [create(:event_user, user: e2.submitter, event_role: 'submitter')]
|
||||
e4.event_users = [create(:event_user, user: e2.submitter, event_role: 'submitter')]
|
||||
|
||||
expect(subject.get_top_submitter.values).to eq([3, 1])
|
||||
expect(subject.get_top_submitter.keys).to eq([e2.submitter, e1.submitter])
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ module OmniauthMacros
|
|||
provider: 'google',
|
||||
uid: 'google-test-uid-1',
|
||||
info: {
|
||||
name: 'new user name',
|
||||
email: 'test-1@gmail.com'
|
||||
},
|
||||
credentials: {
|
||||
|
|
@ -28,6 +29,7 @@ module OmniauthMacros
|
|||
provider: 'google',
|
||||
uid: 'facebook-test-uid-1',
|
||||
info: {
|
||||
name: 'new user fb name',
|
||||
email: 'test-1@gmail.com'
|
||||
},
|
||||
credentials: {
|
||||
|
|
@ -45,6 +47,7 @@ module OmniauthMacros
|
|||
provider: 'google',
|
||||
uid: 'google-test-uid-participant-1',
|
||||
info: {
|
||||
name: 'existing user participant name',
|
||||
email: 'test-participant-1@google.com'
|
||||
},
|
||||
credentials: {
|
||||
|
|
@ -62,6 +65,7 @@ module OmniauthMacros
|
|||
provider: 'google',
|
||||
uid: 'google-test-uid-admin-1',
|
||||
info: {
|
||||
name: 'existing user admin name',
|
||||
email: 'test-admin-1@google.com'
|
||||
},
|
||||
credentials: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue