Merge branch 'master' into fix_user_already_subscribed_exception
This commit is contained in:
commit
4160ac3c4e
9 changed files with 257 additions and 23 deletions
|
|
@ -90,3 +90,7 @@ p.comment-body {
|
||||||
.changeset{
|
.changeset{
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.box{
|
||||||
|
height: 230px;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ class Booth < ActiveRecord::Base
|
||||||
transitions to: :rejected, from: [:new, :to_reject]
|
transitions to: :rejected, from: [:new, :to_reject]
|
||||||
end
|
end
|
||||||
event :cancel do
|
event :cancel do
|
||||||
transitions to: :canceled, from: [:accepted, :rejected]
|
transitions to: :canceled, from: [:accepted, :rejected, :to_accept, :to_reject]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
.row
|
.row
|
||||||
.col-md-8
|
.col-md-8
|
||||||
= semantic_form_for(@booth, url: @booth.new_record? ? admin_conference_booths_path(@conference.short_title) : admin_conference_booth_path(@conference.short_title, @booth.id), html: { multipart: true }) do |f|
|
= semantic_form_for(@booth, url: @booth.new_record? ? admin_conference_booths_path(@conference.short_title) : admin_conference_booth_path(@conference.short_title, @booth.id), html: { multipart: true }) do |f|
|
||||||
= f.input :title, as: :string, required: true
|
= f.input :title, as: :string, autofocus: true, required: true
|
||||||
= f.input :description, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true,
|
= f.input :description, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true,
|
||||||
hint: 'This field becomes public upon request acceptance'
|
hint: 'This field becomes public upon request acceptance'
|
||||||
= f.input :reasoning, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true,
|
= f.input :reasoning, input_html: { rows: 5, data: { provide: 'markdown-editable' } }, required: true,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
.container
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
.page-header
|
||||||
|
%h1
|
||||||
|
Ticket for
|
||||||
|
= @conference.title
|
||||||
|
%p.text-muted
|
||||||
|
- if @conference.venue
|
||||||
|
at
|
||||||
|
%strong
|
||||||
|
#{@conference.venue.name},
|
||||||
|
#{@conference.venue.street},
|
||||||
|
#{@conference.venue.city} / #{@conference.venue.country_name}.
|
||||||
|
%small
|
||||||
|
= date_string(@conference.start_date, @conference.end_date)
|
||||||
|
.row
|
||||||
|
.col-md-5.box.well
|
||||||
|
%h3.text-center
|
||||||
|
Ticket Holder
|
||||||
|
%p.text-left
|
||||||
|
%strong
|
||||||
|
Name
|
||||||
|
%br
|
||||||
|
= @user.name
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
%strong
|
||||||
|
Email
|
||||||
|
%br
|
||||||
|
= @user.email
|
||||||
|
.col-md-5.col-md-offset-2.box.well
|
||||||
|
- if @conference.picture?
|
||||||
|
- width = @conference.picture.image[:width]
|
||||||
|
- height = @conference.picture.image[:height]
|
||||||
|
- if 10 * width > 15 * height
|
||||||
|
= image_tag(@conference.picture_url, width: '150')
|
||||||
|
- else
|
||||||
|
= image_tag(@conference.picture_url, height: '100')
|
||||||
|
- else
|
||||||
|
= image_tag('/img/osem-logo.png', class: 'img-responsive')
|
||||||
|
%p.text-left
|
||||||
|
%br
|
||||||
|
%strong
|
||||||
|
Organization
|
||||||
|
%br
|
||||||
|
= @conference.organization.name
|
||||||
|
.col-md-5.box.well
|
||||||
|
%p.text-left
|
||||||
|
%strong
|
||||||
|
Event
|
||||||
|
%br
|
||||||
|
= @conference.title
|
||||||
|
%br
|
||||||
|
= @conference.start_date.strftime('%B %d, %Y')
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
%strong
|
||||||
|
Ticket
|
||||||
|
%br
|
||||||
|
= @physical_ticket.ticket.title
|
||||||
|
%br
|
||||||
|
%br
|
||||||
|
%strong
|
||||||
|
Ticket Ref.
|
||||||
|
%br
|
||||||
|
= @physical_ticket.ticket_purchase.id
|
||||||
|
%br
|
||||||
|
.col-md-5.col-md-offset-2.box.well
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
%p.text-left
|
||||||
|
= link_to 'Generate PDF',
|
||||||
|
conference_physical_ticket_path(@conference.short_title,
|
||||||
|
@physical_ticket.id,
|
||||||
|
format: :pdf),
|
||||||
|
class: 'button btn btn-default btn-info'
|
||||||
148
spec/controllers/admin/booths_controller_spec.rb
Normal file
148
spec/controllers/admin/booths_controller_spec.rb
Normal file
|
|
@ -0,0 +1,148 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Admin::BoothsController do
|
||||||
|
|
||||||
|
let(:admin) { create(:admin) }
|
||||||
|
let(:conference) { create(:conference) }
|
||||||
|
let(:booth) { create(:booth, title: 'Title', conference: conference) }
|
||||||
|
let(:admin) { create(:admin) }
|
||||||
|
|
||||||
|
context 'not logged in user' do
|
||||||
|
|
||||||
|
describe 'GET index' do
|
||||||
|
it 'does not render admin/booths#index' do
|
||||||
|
get :index, conference_id: conference.short_title
|
||||||
|
expect(response).to redirect_to(user_session_path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'GET show' do
|
||||||
|
it 'does not render admin/booths#show' do
|
||||||
|
get :show, id: booth.id, conference_id: conference.short_title
|
||||||
|
expect(response).to redirect_to(user_session_path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'user is admin' do
|
||||||
|
before :each do
|
||||||
|
sign_in admin
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'GET index' do
|
||||||
|
before { get :index, conference_id: conference.short_title }
|
||||||
|
|
||||||
|
it 'assigns attributes for booths' do
|
||||||
|
expect(assigns(:booths)).to eq([booth])
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'renders index template' do
|
||||||
|
expect(response).to render_template('index')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'GET new' do
|
||||||
|
before { get :new, conference_id: conference.short_title }
|
||||||
|
|
||||||
|
it 'assigns attributes for booths' do
|
||||||
|
expect(assigns(:booth)).to be_a_new(Booth)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'renders new template' do
|
||||||
|
expect(response).to render_template('new')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'POST #create' do
|
||||||
|
context 'successfully created' do
|
||||||
|
before { post :create, booth: attributes_for(:booth), conference_id: conference.short_title }
|
||||||
|
|
||||||
|
it 'creates a new booth' do
|
||||||
|
expected = expect do
|
||||||
|
post :create, booth: attributes_for(:booth), conference_id: conference.short_title
|
||||||
|
end
|
||||||
|
expected.to change { Booth.count }.by(1)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'redirects to admin booth index' do
|
||||||
|
expect(response).to redirect_to(admin_conference_booths_path)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'has responsibles' do
|
||||||
|
expect(booth.responsibles.count).to_not eq(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'shows success message' do
|
||||||
|
expect(flash[:notice]).to match('Booth successfully created.')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'create action fails' do
|
||||||
|
before { post :create, booth: attributes_for(:booth, title: ''), conference_id: conference.short_title }
|
||||||
|
|
||||||
|
it 'does not create any record' do
|
||||||
|
expected = expect do
|
||||||
|
post :create, booth: attributes_for(:booth, title: ''), conference_id: conference.short_title
|
||||||
|
end
|
||||||
|
expected.to_not change(Booth, :count)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'redirects to new' do
|
||||||
|
expect(response).to render_template('new')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'shows flash message' do
|
||||||
|
expect(flash[:error]).to eq("Creating booth failed. Title can't be blank.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'GET #edit' do
|
||||||
|
before { get :edit, id: booth.id, conference_id: conference.short_title }
|
||||||
|
|
||||||
|
it 'renders edit template' do
|
||||||
|
expect(response).to render_template('edit')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'assigns booth variable' do
|
||||||
|
expect(assigns(:booth)).to eq booth
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'PATCH #update' do
|
||||||
|
context 'updates suchessfully' do
|
||||||
|
before { patch :update, id: booth.id, booth: attributes_for(:booth, title: 'different'), conference_id: conference.short_title }
|
||||||
|
it 'redirects to admin booth index path' do
|
||||||
|
expect(response).to redirect_to admin_conference_booths_path
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'shows success message' do
|
||||||
|
expect(flash[:notice]).to match 'Successfully updated booth.'
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'updates booth' do
|
||||||
|
booth.reload
|
||||||
|
expect(booth.title).to eq('different')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'DELETE #destroy' do
|
||||||
|
context 'deletes successfully' do
|
||||||
|
before { delete :destroy, id: booth.id, conference_id: conference.short_title }
|
||||||
|
|
||||||
|
it 'booth deleted' do
|
||||||
|
expect(Booth.count).to eq(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'redirects to admin booth index path' do
|
||||||
|
expect(response).to redirect_to(admin_conference_booths_path)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'show success message' do
|
||||||
|
expect(flash[:notice]).to match('Booth successfully destroyed.')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
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
|
||||||
|
|
@ -8,8 +8,6 @@ FactoryGirl.define do
|
||||||
|
|
||||||
conference
|
conference
|
||||||
|
|
||||||
after(:build) do |booth|
|
responsible_ids { [create(:user).id] }
|
||||||
booth.responsibles << create(:user)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -28,23 +28,23 @@ feature Event do
|
||||||
|
|
||||||
scenario 'rejects a proposal', feature: true, js: true do
|
scenario 'rejects a proposal', feature: true, js: true do
|
||||||
visit admin_conference_program_events_path(conference.short_title)
|
visit admin_conference_program_events_path(conference.short_title)
|
||||||
expect(page.has_content?('Example Proposal')).to be true
|
expect(page).to have_content 'Example Proposal'
|
||||||
|
|
||||||
click_button 'New'
|
click_button 'New'
|
||||||
click_link "reject_event_#{@event.id}"
|
click_link "reject_event_#{@event.id}"
|
||||||
expect(flash).to eq('Event rejected!')
|
expect(page).to have_content 'Event rejected!'
|
||||||
@event.reload
|
@event.reload
|
||||||
expect(@event.state).to eq('rejected')
|
expect(@event.state).to eq('rejected')
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'accepts a proposal', feature: true, js: true do
|
scenario 'accepts a proposal', feature: true, js: true do
|
||||||
visit admin_conference_program_events_path(conference.short_title)
|
visit admin_conference_program_events_path(conference.short_title)
|
||||||
expect(page.has_content?('Example Proposal')).to be true
|
expect(page).to have_content 'Example Proposal'
|
||||||
|
|
||||||
click_button 'New'
|
click_button 'New'
|
||||||
click_link "accept_event_#{@event.id}"
|
click_link "accept_event_#{@event.id}"
|
||||||
expect(flash).to eq('Event accepted!')
|
expect(page).to have_content 'Event accepted!'
|
||||||
expect(page.has_content?('Unconfirmed')).to be true
|
expect(page).to have_content 'Unconfirmed'
|
||||||
@event.reload
|
@event.reload
|
||||||
expect(@event.state).to eq('unconfirmed')
|
expect(@event.state).to eq('unconfirmed')
|
||||||
end
|
end
|
||||||
|
|
@ -52,11 +52,11 @@ feature Event do
|
||||||
scenario 'restarts review of a proposal', feature: true, js: true do
|
scenario 'restarts review of a proposal', feature: true, js: true do
|
||||||
@event.reject!(@options)
|
@event.reject!(@options)
|
||||||
visit admin_conference_program_events_path(conference.short_title)
|
visit admin_conference_program_events_path(conference.short_title)
|
||||||
expect(page.has_content?('Example Proposal')).to be true
|
expect(page).to have_content 'Example Proposal'
|
||||||
|
|
||||||
click_button 'Rejected'
|
click_button 'Rejected'
|
||||||
click_link "restart_event_#{@event.id}"
|
click_link "restart_event_#{@event.id}"
|
||||||
expect(flash).to eq('Review started!')
|
expect(page).to have_content 'Review started!'
|
||||||
@event.reload
|
@event.reload
|
||||||
expect(@event.state).to eq('new')
|
expect(@event.state).to eq('new')
|
||||||
end
|
end
|
||||||
|
|
@ -83,7 +83,7 @@ feature Event do
|
||||||
fill_in 'event_abstract', with: 'Lorem ipsum abstract'
|
fill_in 'event_abstract', with: 'Lorem ipsum abstract'
|
||||||
|
|
||||||
click_button 'Create Proposal'
|
click_button 'Create Proposal'
|
||||||
expect(flash).to eq('Proposal was successfully submitted.')
|
expect(page).to have_content 'Proposal was successfully submitted.'
|
||||||
|
|
||||||
expect(Event.count).to eq(expected_count_event)
|
expect(Event.count).to eq(expected_count_event)
|
||||||
expect(User.count).to eq(expected_count_user)
|
expect(User.count).to eq(expected_count_user)
|
||||||
|
|
@ -101,7 +101,7 @@ feature Event do
|
||||||
select('Easy', from: 'event[difficulty_level_id]')
|
select('Easy', from: 'event[difficulty_level_id]')
|
||||||
|
|
||||||
click_button 'Update Proposal'
|
click_button 'Update Proposal'
|
||||||
expect(flash).to eq('Proposal was successfully updated.')
|
expect(page).to have_content 'Proposal was successfully updated.'
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'signed_in user submits a valid proposal', feature: true, js: true do
|
scenario 'signed_in user submits a valid proposal', feature: true, js: true do
|
||||||
|
|
@ -119,7 +119,7 @@ feature Event do
|
||||||
fill_in 'event_description', with: 'Lorem ipsum description'
|
fill_in 'event_description', with: 'Lorem ipsum description'
|
||||||
|
|
||||||
click_button 'Create Proposal'
|
click_button 'Create Proposal'
|
||||||
expect(flash).to eq('Proposal was successfully submitted.')
|
expect(page).to have_content 'Proposal was successfully submitted.'
|
||||||
|
|
||||||
expect(current_path).to eq(conference_program_proposals_path(conference.short_title))
|
expect(current_path).to eq(conference_program_proposals_path(conference.short_title))
|
||||||
expect(Event.count).to eq(expected_count)
|
expect(Event.count).to eq(expected_count)
|
||||||
|
|
@ -128,11 +128,10 @@ feature Event do
|
||||||
scenario 'confirms a proposal', feature: true, js: true do
|
scenario 'confirms a proposal', feature: true, js: true do
|
||||||
sign_in participant
|
sign_in participant
|
||||||
visit conference_program_proposals_path(conference.short_title)
|
visit conference_program_proposals_path(conference.short_title)
|
||||||
expect(page.has_content?('Example Proposal')).to be true
|
expect(page).to have_content 'Example Proposal'
|
||||||
expect(@event.state).to eq('unconfirmed')
|
expect(@event.state).to eq('unconfirmed')
|
||||||
click_link "confirm_proposal_#{@event.id}"
|
click_link "confirm_proposal_#{@event.id}"
|
||||||
expect(flash)
|
expect(page).to have_content 'The proposal was confirmed. Please register to attend the conference.'
|
||||||
.to eq('The proposal was confirmed. Please register to attend the conference.')
|
|
||||||
expect(current_path).to eq(new_conference_conference_registration_path(conference.short_title))
|
expect(current_path).to eq(new_conference_conference_registration_path(conference.short_title))
|
||||||
@event.reload
|
@event.reload
|
||||||
expect(@event.state).to eq('confirmed')
|
expect(@event.state).to eq('confirmed')
|
||||||
|
|
@ -142,9 +141,9 @@ feature Event do
|
||||||
sign_in participant
|
sign_in participant
|
||||||
@event.confirm!
|
@event.confirm!
|
||||||
visit conference_program_proposals_path(conference.short_title)
|
visit conference_program_proposals_path(conference.short_title)
|
||||||
expect(page.has_content?('Example Proposal')).to be true
|
expect(page).to have_content 'Example Proposal'
|
||||||
click_link "delete_proposal_#{@event.id}"
|
click_link "delete_proposal_#{@event.id}"
|
||||||
expect(flash).to eq('Proposal was successfully withdrawn.')
|
expect(page).to have_content 'Proposal was successfully withdrawn.'
|
||||||
@event.reload
|
@event.reload
|
||||||
expect(@event.state).to eq('withdrawn')
|
expect(@event.state).to eq('withdrawn')
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,8 @@ describe 'Booth' do
|
||||||
|
|
||||||
states_transitions = { new: { restart: false, withdraw: true, accept: true, to_accept: true, to_reject: true, reject: true, cancel: false },
|
states_transitions = { new: { restart: false, withdraw: true, accept: true, to_accept: true, to_reject: true, reject: true, cancel: false },
|
||||||
withdrawn: { restart: true, withdraw: false, accept: false, to_accept: false, to_reject: false, reject: false, cancel: false },
|
withdrawn: { restart: true, withdraw: false, accept: false, to_accept: false, to_reject: false, reject: false, cancel: false },
|
||||||
to_accept: { restart: true, withdraw: true, accept: true, to_accept: false, to_reject: true, reject: false, cancel: false },
|
to_accept: { restart: true, withdraw: true, accept: true, to_accept: false, to_reject: true, reject: false, cancel: true },
|
||||||
to_reject: { restart: true, withdraw: true, accept: false, to_accept: true, to_reject: false, reject: true, cancel: false },
|
to_reject: { restart: true, withdraw: true, accept: false, to_accept: true, to_reject: false, reject: true, cancel: true },
|
||||||
accepted: { restart: false, withdraw: true, accept: false, to_accept: false, to_reject: false, reject: false, cancel: true },
|
accepted: { restart: false, withdraw: true, accept: false, to_accept: false, to_reject: false, reject: false, cancel: true },
|
||||||
rejected: { restart: false, withdraw: true, accept: false, to_accept: false, to_reject: false, reject: false, cancel: true },
|
rejected: { restart: false, withdraw: true, accept: false, to_accept: false, to_reject: false, reject: false, cancel: true },
|
||||||
canceled: { restart: true, withdraw: false, accept: false, to_accept: false, to_reject: false, reject: false, cancel: false } }
|
canceled: { restart: true, withdraw: false, accept: false, to_accept: false, to_reject: false, reject: false, cancel: false } }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue