mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Merge pull request #1245 from AEtherC0r3/fix_id
Find correct event id in versions
This commit is contained in:
commit
845c9234e9
2 changed files with 21 additions and 5 deletions
|
|
@ -45,7 +45,7 @@
|
|||
- when 'EventsRegistration', 'Comment', 'Vote', 'Event'
|
||||
= 'event'
|
||||
- object = current_or_last_object_state(version.item_type, version.item_id)
|
||||
- event_id = object.try(:id) || object.try(:event_id) || object.commentable_id
|
||||
- event_id = object.try(:event_id) || object.try(:commentable_id) || object.id
|
||||
= link_to (current_or_last_object_state('Event', event_id).try(:title) || 'deleted event'),
|
||||
admin_conference_program_event_path(conference_id: Conference.find(version.conference_id).short_title, id: event_id)
|
||||
|
||||
|
|
|
|||
|
|
@ -298,8 +298,9 @@ feature 'Version' do
|
|||
end
|
||||
|
||||
scenario 'display changes in event registration', feature: true, versioning: true, js: true do
|
||||
create(:event, program: conference.program, title: 'My first event')
|
||||
registration = Registration.create(user: organizer, conference: conference)
|
||||
event = create(:event, program: conference.program)
|
||||
event = create(:event, program: conference.program, title: 'My second event')
|
||||
EventsRegistration.create(registration: registration, event: event)
|
||||
EventsRegistration.first.update_attributes(attended: true)
|
||||
EventsRegistration.last.destroy
|
||||
|
|
@ -307,7 +308,7 @@ feature 'Version' do
|
|||
registration.destroy
|
||||
|
||||
visit admin_revision_history_path
|
||||
expect(page).to have_text("Someone (probably via the console) registered #{organizer.name} to event #{event.title} in conference #{conference.short_title}")
|
||||
expect(page).to have_text("Someone (probably via the console) registered #{organizer.name} to event My second event in conference #{conference.short_title}")
|
||||
expect(page).to have_text("Someone (probably via the console) updated attended of #{organizer.name}'s registration for event #{event.title} in conference #{conference.short_title}")
|
||||
expect(page).to have_text("Someone (probably via the console) unregistered #{organizer.name} from event #{event.title} in conference #{conference.short_title}")
|
||||
end
|
||||
|
|
@ -324,7 +325,8 @@ feature 'Version' do
|
|||
end
|
||||
|
||||
scenario 'display changes in comment', feature: true, versioning: true, js: true do
|
||||
event = create(:event, program: conference.program)
|
||||
create(:event, program: conference.program, title: 'My first event')
|
||||
event = create(:event, program: conference.program, title: 'My second event')
|
||||
visit admin_conference_program_event_path(conference_id: conference.short_title, id: event.id)
|
||||
click_link 'Comments (0)'
|
||||
fill_in 'comment_body', with: 'Sample comment'
|
||||
|
|
@ -333,11 +335,25 @@ feature 'Version' do
|
|||
PaperTrail::Version.last.reify.save
|
||||
|
||||
visit admin_revision_history_path
|
||||
expect(page).to have_text("#{organizer.name} commented on event #{event.title} in conference #{conference.short_title}")
|
||||
expect(page).to have_text("#{organizer.name} commented on event My second event in conference #{conference.short_title}")
|
||||
expect(page).to have_text("Someone (probably via the console) deleted #{organizer.name}'s comment on event #{event.title} in conference #{conference.short_title}")
|
||||
expect(page).to have_text("Someone (probably via the console) re-added #{organizer.name}'s comment on event #{event.title} in conference #{conference.short_title}")
|
||||
end
|
||||
|
||||
scenario 'display changes in vote', feature: true, versioning: true, js: true do
|
||||
conference.program.rating = 1
|
||||
create(:event, program: conference.program, title: 'My first event')
|
||||
event = create(:event, program: conference.program, title: 'My second event')
|
||||
create(:vote, user: organizer, event: event)
|
||||
Vote.last.destroy
|
||||
PaperTrail::Version.last.reify.save
|
||||
|
||||
visit admin_revision_history_path
|
||||
expect(page).to have_text("Someone (probably via the console) voted on event My second event in conference #{conference.short_title}")
|
||||
expect(page).to have_text("Someone (probably via the console) deleted #{organizer.name}'s vote on event #{event.title} in conference #{conference.short_title}")
|
||||
expect(page).to have_text("Someone (probably via the console) re-added #{organizer.name}'s vote on event #{event.title} in conference #{conference.short_title}")
|
||||
end
|
||||
|
||||
scenario 'display changes in campaign', feature: true, versioning: true, js: true do
|
||||
campaign = create(:campaign, conference: conference, name: 'Test Campaign', utm_campaign: 'campaign')
|
||||
campaign.update_attributes(utm_source: 'source', utm_medium: 'medium', utm_term: 'term', utm_content: 'content')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue