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
|
end
|
||||||
|
|
||||||
describe 'POST #create' do
|
describe 'POST #create' do
|
||||||
# context 'successfully created' do
|
context 'successfully created' do
|
||||||
# it 'creates a new booth' do
|
# it 'creates a new booth' do
|
||||||
# expected = expect do
|
# expected = expect do
|
||||||
# post :create, booth: attributes_for(:booth), conference_id: conference.short_title
|
# post :create, booth: attributes_for(:booth), conference_id: conference.short_title
|
||||||
|
|
@ -62,16 +62,21 @@ describe Admin::BoothsController do
|
||||||
# expected.to change { Booth.count }.by(1)
|
# expected.to change { Booth.count }.by(1)
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# it 'redirects to admin booth index' do
|
# it 'redirects to admin booth index' do
|
||||||
# post :create, booth: attributes_for(:booth), conference_id: conference.short_title
|
# post :create, booth: attributes_for(:booth), conference_id: conference.short_title
|
||||||
# expect(response).to redirect_to(admin_conference_booths_path)
|
# expect(response).to redirect_to(admin_conference_booths_path)
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# it 'shows success message' do
|
# it 'has responsibles' do
|
||||||
# post :create, booth: attributes_for(:booth), conference_id: conference.short_title
|
# post :create, booth: attributes_for(:booth), conference_id: conference.short_title
|
||||||
# expect(flash[:notice]).to match('Booth successfully created.')
|
# expect(booth.responsibles.count).to eq(0)
|
||||||
# end
|
# end
|
||||||
# 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
|
context 'create action fails' do
|
||||||
it 'does not create any record' do
|
it 'does not create any record' do
|
||||||
|
|
@ -119,7 +124,7 @@ describe Admin::BoothsController do
|
||||||
context 'deletes successfully' do
|
context 'deletes successfully' do
|
||||||
# it 'booth deleted' do
|
# it 'booth deleted' do
|
||||||
# expected = expect 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
|
# end
|
||||||
# expected.to change { Booth.count }.by(-1)
|
# expected.to change { Booth.count }.by(-1)
|
||||||
# end
|
# 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
|
conference
|
||||||
|
|
||||||
after(:build) do |booth|
|
after(:build) do |booth|
|
||||||
booth.responsibles << create(:user)
|
booth.responsibles << create(:booth_request).user
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue