mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Track related fixes
Make the message in admin/Tracks form more visible by making it bold and adding links to venue and rooms Make papertrail track changes for all the track's attributes Add validation to require presence of description for self-organized tracks Add ID column to admin/Tracks#index Make the cfp inclusion column sortable Show success/error flash messages after toggling cfp inclusion
This commit is contained in:
parent
5f1ed7ce85
commit
b717018b31
9 changed files with 114 additions and 32 deletions
|
|
@ -228,16 +228,45 @@ describe Admin::TracksController do
|
|||
before :each do
|
||||
self_organized_track.cfp_active = false
|
||||
self_organized_track.save!
|
||||
patch :toggle_cfp_inclusion, conference_id: conference.short_title, id: self_organized_track.short_name
|
||||
self_organized_track.reload
|
||||
end
|
||||
|
||||
it 'assigns the correct track' do
|
||||
expect(assigns(:track)).to eq self_organized_track
|
||||
context 'toggles successfully' do
|
||||
before :each do
|
||||
patch :toggle_cfp_inclusion, conference_id: conference.short_title, id: self_organized_track.short_name, format: :js
|
||||
self_organized_track.reload
|
||||
end
|
||||
|
||||
it 'assigns the correct track' do
|
||||
expect(assigns(:track)).to eq self_organized_track
|
||||
end
|
||||
|
||||
it 'shows success message in flash notice' do
|
||||
expect(flash[:notice]).to match('Successfully changed cfp inclusion of My awesome track to true')
|
||||
end
|
||||
|
||||
it 'becomes true' do
|
||||
expect(self_organized_track.cfp_active).to eq true
|
||||
end
|
||||
end
|
||||
|
||||
it 'becomes true' do
|
||||
expect(self_organized_track.cfp_active).to eq true
|
||||
context 'save fails' do
|
||||
before :each do
|
||||
allow_any_instance_of(Track).to receive(:save).and_return(false)
|
||||
patch :toggle_cfp_inclusion, conference_id: conference.short_title, id: self_organized_track.short_name, format: :js
|
||||
self_organized_track.reload
|
||||
end
|
||||
|
||||
it 'assigns the correct track' do
|
||||
expect(assigns(:track)).to eq self_organized_track
|
||||
end
|
||||
|
||||
it 'shows error message in flash notice' do
|
||||
expect(flash[:error]).to match('Failed to toggle cfp inclusion of My awesome track to true')
|
||||
end
|
||||
|
||||
it 'stays false' do
|
||||
expect(self_organized_track.cfp_active).to eq false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -245,16 +274,45 @@ describe Admin::TracksController do
|
|||
before :each do
|
||||
self_organized_track.cfp_active = true
|
||||
self_organized_track.save!
|
||||
patch :toggle_cfp_inclusion, conference_id: conference.short_title, id: self_organized_track.short_name
|
||||
self_organized_track.reload
|
||||
end
|
||||
|
||||
it 'assigns the correct track' do
|
||||
expect(assigns(:track)).to eq self_organized_track
|
||||
context 'toggles successfully' do
|
||||
before :each do
|
||||
patch :toggle_cfp_inclusion, conference_id: conference.short_title, id: self_organized_track.short_name, format: :js
|
||||
self_organized_track.reload
|
||||
end
|
||||
|
||||
it 'assigns the correct track' do
|
||||
expect(assigns(:track)).to eq self_organized_track
|
||||
end
|
||||
|
||||
it 'shows success message in flash notice' do
|
||||
expect(flash[:notice]).to match('Successfully changed cfp inclusion of My awesome track to false')
|
||||
end
|
||||
|
||||
it 'becomes false' do
|
||||
expect(self_organized_track.cfp_active).to eq false
|
||||
end
|
||||
end
|
||||
|
||||
it 'becomes false' do
|
||||
expect(self_organized_track.cfp_active).to eq false
|
||||
context 'save fails' do
|
||||
before :each do
|
||||
allow_any_instance_of(Track).to receive(:save).and_return(false)
|
||||
patch :toggle_cfp_inclusion, conference_id: conference.short_title, id: self_organized_track.short_name, format: :js
|
||||
self_organized_track.reload
|
||||
end
|
||||
|
||||
it 'assigns the correct track' do
|
||||
expect(assigns(:track)).to eq self_organized_track
|
||||
end
|
||||
|
||||
it 'shows error message in flash notice' do
|
||||
expect(flash[:error]).to match('Failed to toggle cfp inclusion of My awesome track to false')
|
||||
end
|
||||
|
||||
it 'stays true' do
|
||||
expect(self_organized_track.cfp_active).to eq true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ describe Track do
|
|||
end
|
||||
|
||||
it { is_expected.to validate_presence_of(:relevance) }
|
||||
it { is_expected.to validate_presence_of(:description) }
|
||||
end
|
||||
|
||||
context 'when self_organized? returns false' do
|
||||
|
|
@ -62,6 +63,7 @@ describe Track do
|
|||
end
|
||||
|
||||
it { is_expected.to_not validate_presence_of(:relevance) }
|
||||
it { is_expected.to_not validate_presence_of(:description) }
|
||||
end
|
||||
|
||||
describe '#valid_dates' do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue