add test for bulk action
This commit is contained in:
parent
02df70a935
commit
8fad871100
1 changed files with 24 additions and 4 deletions
|
|
@ -34,6 +34,8 @@ describe Admin::BoothsController do
|
||||||
describe 'GET index' do
|
describe 'GET index' do
|
||||||
before { get :index, params: { conference_id: conference.short_title } }
|
before { get :index, params: { conference_id: conference.short_title } }
|
||||||
|
|
||||||
|
context 'only viewing' do
|
||||||
|
|
||||||
it 'assigns attributes for booths' do
|
it 'assigns attributes for booths' do
|
||||||
expect(assigns(:booths)).to eq([booth])
|
expect(assigns(:booths)).to eq([booth])
|
||||||
end
|
end
|
||||||
|
|
@ -43,6 +45,24 @@ describe Admin::BoothsController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'changing bulk state' do
|
||||||
|
before(:example) do
|
||||||
|
post :create, params: { booth: attributes_for(:booth, title: 'example1'), conference_id: conference.short_title }
|
||||||
|
post :create, params: { booth: attributes_for(:booth, title: 'example2'), conference_id: conference.short_title }
|
||||||
|
get :index, params: { conference_id: conference.short_title }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'before selecting state' do
|
||||||
|
expect(Booth.where(title: ['example1', 'example2']).pluck(:state)).to eq(['new', 'new'])
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'after selecting state' do
|
||||||
|
post :booths_state, params: { booth: { current_booth_state: 'new', new_booth_state: 'Reject' }, conference_id: conference.short_title }
|
||||||
|
expect(Booth.where(title: ['example1', 'example2']).pluck(:state)).to eq(['rejected', 'rejected'])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'GET new' do
|
describe 'GET new' do
|
||||||
before { get :new, params: { conference_id: conference.short_title } }
|
before { get :new, params: { conference_id: conference.short_title } }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue