add booth_request factory
This commit is contained in:
parent
48a475ca12
commit
4f99584b28
3 changed files with 26 additions and 12 deletions
|
|
@ -54,7 +54,7 @@ describe Admin::BoothsController do
|
|||
end
|
||||
|
||||
describe 'POST #create' do
|
||||
# context 'successfully created' do
|
||||
context 'successfully created' do
|
||||
# it 'creates a new booth' do
|
||||
# expected = expect do
|
||||
# post :create, booth: attributes_for(:booth), conference_id: conference.short_title
|
||||
|
|
@ -67,12 +67,17 @@ describe Admin::BoothsController do
|
|||
# expect(response).to redirect_to(admin_conference_booths_path)
|
||||
# end
|
||||
#
|
||||
# it 'shows success message' do
|
||||
# it 'has responsibles' do
|
||||
# post :create, booth: attributes_for(:booth), conference_id: conference.short_title
|
||||
# expect(flash[:notice]).to match('Booth successfully created.')
|
||||
# end
|
||||
# expect(booth.responsibles.count).to eq(0)
|
||||
# end
|
||||
|
||||
it 'shows success message' do
|
||||
post :create, booth: attributes_for(:booth), conference_id: conference.short_title
|
||||
expect(flash[:error]).to match('Booth successfully created.')
|
||||
end
|
||||
end
|
||||
|
||||
context 'create action fails' do
|
||||
it 'does not create any record' do
|
||||
expected = expect do
|
||||
|
|
@ -119,7 +124,7 @@ describe Admin::BoothsController do
|
|||
context 'deletes successfully' do
|
||||
# it 'booth deleted' do
|
||||
# expected = expect do
|
||||
# delete :destroy, id: booth.iddelete :destroy, id: booth.id, conference_id: conference.short_title
|
||||
# delete :destroy, id: booth.id, conference_id: conference.short_title
|
||||
# end
|
||||
# expected.to change { Booth.count }.by(-1)
|
||||
# end
|
||||
|
|
|
|||
8
spec/factories/booth_request.rb
Normal file
8
spec/factories/booth_request.rb
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
FactoryGirl.define do
|
||||
factory :booth_request do
|
||||
booth
|
||||
user
|
||||
role 'responsible'
|
||||
|
||||
end
|
||||
end
|
||||
|
|
@ -9,7 +9,8 @@ FactoryGirl.define do
|
|||
conference
|
||||
|
||||
after(:build) do |booth|
|
||||
booth.responsibles << create(:user)
|
||||
booth.responsibles << create(:booth_request).user
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue