Rename 'ConferenceController' to 'ConferencesController', and 'ProposalController' to 'ProposalsController'

This commit is contained in:
richiethomas 2016-09-14 22:42:04 -04:00
parent 0b6550d060
commit daf1f805bd
71 changed files with 225 additions and 191 deletions

View file

@ -1,5 +1,5 @@
module Admin module Admin
class ConferenceController < Admin::BaseController class ConferencesController < Admin::BaseController
load_and_authorize_resource :conference, find_by: :short_title load_and_authorize_resource :conference, find_by: :short_title
load_resource :program, through: :conference, singleton: true, except: :index load_resource :program, through: :conference, singleton: true, except: :index
load_resource :user, only: [:remove_user] load_resource :user, only: [:remove_user]

View file

@ -30,7 +30,7 @@ class ApplicationController < ActionController::Base
(!session[:return_to] || (!session[:return_to] ||
session[:return_to] && session[:return_to] &&
session[:return_to] == root_path) session[:return_to] == root_path)
admin_conference_index_path admin_conferences_path
else else
session[:return_to] || root_path session[:return_to] || root_path
end end

View file

@ -1,6 +1,6 @@
class ConferenceController < ApplicationController class ConferencesController < ApplicationController
protect_from_forgery with: :null_session protect_from_forgery with: :null_session
before_filter :respond_to_options before_action :respond_to_options
load_and_authorize_resource find_by: :short_title load_and_authorize_resource find_by: :short_title
load_resource :program, through: :conference, singleton: true, except: :index load_resource :program, through: :conference, singleton: true, except: :index

View file

@ -1,5 +1,5 @@
class ProposalController < ApplicationController class ProposalsController < ApplicationController
before_filter :authenticate_user!, except: [:show, :new, :create] before_action :authenticate_user!, except: [:show, :new, :create]
load_resource :conference, find_by: :short_title load_resource :conference, find_by: :short_title
load_resource :program, through: :conference, singleton: true load_resource :program, through: :conference, singleton: true
load_and_authorize_resource :event, parent: false, through: :program load_and_authorize_resource :event, parent: false, through: :program
@ -20,7 +20,7 @@ class ProposalController < ApplicationController
def new def new
@user = User.new @user = User.new
@url = conference_program_proposal_index_path(@conference.short_title) @url = conference_program_proposals_path(@conference.short_title)
@languages = @program.languages_list @languages = @program.languages_list
end end
@ -30,7 +30,7 @@ class ProposalController < ApplicationController
end end
def create def create
@url = conference_program_proposal_index_path(@conference.short_title) @url = conference_program_proposals_path(@conference.short_title)
# We allow proposal submission and sign up on same page. # We allow proposal submission and sign up on same page.
# If user is not signed in then first create new user and then sign them in # If user is not signed in then first create new user and then sign them in
@ -55,7 +55,7 @@ class ProposalController < ApplicationController
event_role: 'speaker') event_role: 'speaker')
if @event.save if @event.save
ahoy.track 'Event submission', title: 'New submission' ahoy.track 'Event submission', title: 'New submission'
redirect_to conference_program_proposal_index_path(@conference.short_title), notice: 'Proposal was successfully submitted.' redirect_to conference_program_proposals_path(@conference.short_title), notice: 'Proposal was successfully submitted.'
else else
flash[:error] = "Could not submit proposal: #{@event.errors.full_messages.join(', ')}" flash[:error] = "Could not submit proposal: #{@event.errors.full_messages.join(', ')}"
render action: 'new' render action: 'new'
@ -66,7 +66,7 @@ class ProposalController < ApplicationController
@url = conference_program_proposal_path(@conference.short_title, params[:id]) @url = conference_program_proposal_path(@conference.short_title, params[:id])
if @event.update(event_params) if @event.update(event_params)
redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title), redirect_to conference_program_proposals_path(conference_id: @conference.short_title),
notice: 'Proposal was successfully updated.' notice: 'Proposal was successfully updated.'
else else
flash[:error] = "Could not update proposal: #{@event.errors.full_messages.join(', ')}" flash[:error] = "Could not update proposal: #{@event.errors.full_messages.join(', ')}"
@ -86,10 +86,10 @@ class ProposalController < ApplicationController
end end
if @event.save if @event.save
redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title), redirect_to conference_program_proposals_path(conference_id: @conference.short_title),
notice: 'Proposal was successfully withdrawn.' notice: 'Proposal was successfully withdrawn.'
else else
redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title), redirect_to conference_program_proposals_path(conference_id: @conference.short_title),
error: "Could not withdraw proposal: #{@event.errors.full_messages.join(', ')}" error: "Could not withdraw proposal: #{@event.errors.full_messages.join(', ')}"
end end
end end
@ -107,14 +107,14 @@ class ProposalController < ApplicationController
if @event.save if @event.save
if @conference.user_registered?(current_user) if @conference.user_registered?(current_user)
redirect_to conference_program_proposal_index_path(@conference.short_title), redirect_to conference_program_proposals_path(@conference.short_title),
notice: 'The proposal was confirmed.' notice: 'The proposal was confirmed.'
else else
redirect_to new_conference_conference_registration_path(conference_id: @conference.short_title), redirect_to new_conference_conference_registration_path(conference_id: @conference.short_title),
alert: 'The proposal was confirmed. Please register to attend the conference.' alert: 'The proposal was confirmed. Please register to attend the conference.'
end end
else else
redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title), redirect_to conference_program_proposals_path(conference_id: @conference.short_title),
error: "Could not confirm proposal: #{@event.errors.full_messages.join(', ')}" error: "Could not confirm proposal: #{@event.errors.full_messages.join(', ')}"
end end
end end
@ -126,16 +126,16 @@ class ProposalController < ApplicationController
begin begin
@event.restart @event.restart
rescue Transitions::InvalidTransition rescue Transitions::InvalidTransition
redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title), redirect_to conference_program_proposals_path(conference_id: @conference.short_title),
error: "The proposal can't be re-submitted." error: "The proposal can't be re-submitted."
return return
end end
if @event.save if @event.save
redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title), redirect_to conference_program_proposals_path(conference_id: @conference.short_title),
notice: "The proposal was re-submitted. The #{@conference.short_title} organizers will review it again." notice: "The proposal was re-submitted. The #{@conference.short_title} organizers will review it again."
else else
redirect_to conference_program_proposal_index_path(conference_id: @conference.short_title), redirect_to conference_program_proposals_path(conference_id: @conference.short_title),
error: "Could not re-submit proposal: #{@event.errors.full_messages.join(', ')}" error: "Could not re-submit proposal: #{@event.errors.full_messages.join(', ')}"
end end
end end

View file

@ -38,12 +38,12 @@ module ApplicationHelper
"Registered: #{event.registrations.count}" "Registered: #{event.registrations.count}"
end end
# Set resource_name for devise so that we can call the devise help links (views/devise/shared/_links) from anywhere (eg sign_up form in proposal#new) # Set resource_name for devise so that we can call the devise help links (views/devise/shared/_links) from anywhere (eg sign_up form in proposals#new)
def resource_name def resource_name
:user :user
end end
# Set devise_mapping for devise so that we can call the devise help links (views/devise/shared/_links) from anywhere (eg sign_up form in proposal#new) # Set devise_mapping for devise so that we can call the devise help links (views/devise/shared/_links) from anywhere (eg sign_up form in proposals#new)
def devise_mapping def devise_mapping
@devise_mapping ||= Devise.mappings[:user] @devise_mapping ||= Devise.mappings[:user]
end end

View file

@ -42,7 +42,7 @@ class EmailSettings < ActiveRecord::Base
if event if event
h['eventtitle'] = event.title h['eventtitle'] = event.title
h['proposalslink'] = Rails.application.routes.url_helpers.conference_program_proposal_index_url( h['proposalslink'] = Rails.application.routes.url_helpers.conference_program_proposals_url(
conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000')) conference.short_title, host: (ENV['OSEM_HOSTNAME'] || 'localhost:3000'))
end end
h h

View file

@ -1,6 +1,6 @@
.row .row
.col-md-8 .col-md-8
= semantic_form_for(@conference, :url => admin_conference_index_path) do |f| = semantic_form_for(@conference, :url => admin_conferences_path) do |f|
= f.inputs 'Basic Information' do = f.inputs 'Basic Information' do
= f.input :title, hint: "The name of your conference as it shall appear throughout the site. Example: 'OpenSUSE Conference 2013'", = f.input :title, hint: "The name of your conference as it shall appear throughout the site. Example: 'OpenSUSE Conference 2013'",
input_html: { required: 'required' } input_html: { required: 'required' }

View file

@ -35,7 +35,7 @@
%b Highlight %b Highlight
%td %td
= check_box_tag @conference.short_title, @event.id, @event.is_highlight, = check_box_tag @conference.short_title, @event.id, @event.is_highlight,
method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{@event.id}?event[is_highlight]=", method: :patch, url: "/admin/conferences/#{@conference.short_title}/program/events/#{@event.id}?event[is_highlight]=",
class: 'switch-checkbox', data: { size: 'small', class: 'switch-checkbox', data: { size: 'small',
off_color: 'warning', off_color: 'warning',
on_text: 'Yes', on_text: 'Yes',
@ -91,7 +91,7 @@
%b Requires Registration %b Requires Registration
%td %td
= check_box_tag @conference.short_title, @event.id, @event.require_registration, = check_box_tag @conference.short_title, @event.id, @event.require_registration,
method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{@event.id}?event[require_registration]=", method: :patch, url: "/admin/conferences/#{@conference.short_title}/program/events/#{@event.id}?event[require_registration]=",
class: 'switch-checkbox', data: { size: 'small', class: 'switch-checkbox', data: { size: 'small',
off_color: 'warning', off_color: 'warning',
on_text: 'Yes', on_text: 'Yes',

View file

@ -1 +1 @@
= render 'proposal/form' = render 'proposals/form'

View file

@ -9,11 +9,11 @@
All the submissions of your speakers All the submissions of your speakers
.row .row
.col-md-4 .col-md-4
= render partial: 'admin/conference/doughnut_chart', locals: {title: 'Events state', data: @event_distribution} = render partial: 'admin/conferences/doughnut_chart', locals: {title: 'Events state', data: @event_distribution}
.col-md-4 .col-md-4
= render partial: 'admin/conference/doughnut_chart', locals: {title: 'Confirmed events scheduled', data: @scheduled_event_distribution} = render partial: 'admin/conferences/doughnut_chart', locals: {title: 'Confirmed events scheduled', data: @scheduled_event_distribution}
.col-md-4 .col-md-4
= render partial: 'admin/conference/doughnut_chart', locals: {title: 'Tracks of confirmed events', data: @tracks_distribution_confirmed} = render partial: 'admin/conferences/doughnut_chart', locals: {title: 'Tracks of confirmed events', data: @tracks_distribution_confirmed}
.row .row
.col-md-12 .col-md-12
%div.margin-event-table %div.margin-event-table
@ -85,7 +85,7 @@
%td.text-center{'data-order' => "#{event.require_registration}"} %td.text-center{'data-order' => "#{event.require_registration}"}
= check_box_tag @conference.short_title, event.id, event.require_registration, = check_box_tag @conference.short_title, event.id, event.require_registration,
method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{event.id}?event[require_registration]=", method: :patch, url: "/admin/conferences/#{@conference.short_title}/program/events/#{event.id}?event[require_registration]=",
class: 'switch-checkbox', data: { size: 'small', class: 'switch-checkbox', data: { size: 'small',
off_color: 'warning', off_color: 'warning',
on_text: 'Yes', on_text: 'Yes',
@ -96,7 +96,7 @@
%td.text-center{'data-order' => "#{event.is_highlight}"} %td.text-center{'data-order' => "#{event.is_highlight}"}
= check_box_tag @conference.short_title, event.id, event.is_highlight, = check_box_tag @conference.short_title, event.id, event.is_highlight,
method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{event.id}?event[is_highlight]=", method: :patch, url: "/admin/conferences/#{@conference.short_title}/program/events/#{event.id}?event[is_highlight]=",
class: 'switch-checkbox', data: { size: 'small', class: 'switch-checkbox', data: { size: 'small',
off_color: 'warning', off_color: 'warning',
on_text: 'Yes', on_text: 'Yes',

View file

@ -32,7 +32,7 @@
%td= event_registration.email %td= event_registration.email
%td= event_registration.created_at %td= event_registration.created_at
%td %td
= check_box_tag @conference.short_title, @event.id, event_registration.attended, class: 'switch-checkbox', method: :patch, url: "/admin/conference/#{@conference.short_title}/program/events/#{@event.id}/toggle_attendance?events_registration_id=#{event_registration.id}&&event_registration[attended]=", = check_box_tag @conference.short_title, @event.id, event_registration.attended, class: 'switch-checkbox', method: :patch, url: "/admin/conferences/#{@conference.short_title}/program/events/#{@event.id}/toggle_attendance?events_registration_id=#{event_registration.id}&&event_registration[attended]=",
data: { size: 'small', data: { size: 'small',
off_color: 'danger', off_color: 'danger',
on_text: 'Yes', on_text: 'Yes',

View file

@ -12,10 +12,10 @@
%p.text-muted %p.text-muted
All the people who registered to your event All the people who registered to your event
.col-md-4 .col-md-4
= render partial: 'admin/conference/doughnut_chart', locals: {title: 'Affiliation', data: @affiliation_distribution} = render partial: 'admin/conferences/doughnut_chart', locals: {title: 'Affiliation', data: @affiliation_distribution}
- unless @conference.pending? - unless @conference.pending?
.col-md-4 .col-md-4
= render partial: 'admin/conference/doughnut_chart', locals: {title: 'Attended registrations', data: @registration_distribution} = render partial: 'admin/conferences/doughnut_chart', locals: {title: 'Attended registrations', data: @registration_distribution}
.row .row
.col-md-12 .col-md-12
%div.margin-event-table %div.margin-event-table

View file

@ -14,7 +14,7 @@
- if ( can? :toggle_user, @role ) - if ( can? :toggle_user, @role )
%td.text-right %td.text-right
= hidden_field_tag "role[user_ids][]", nil = hidden_field_tag "role[user_ids][]", nil
= check_box_tag @conference.short_title, @role.id, (@role.user_ids.include? user.id), method: :post, url: "/admin/conference/#{@conference.short_title}/roles/#{@role.name}/toggle_user?user[email]=#{user.email}&user[state]=", class: 'switch-checkbox', data: { size: 'small', off_color: 'warning', on_text: 'Yes', off_text: 'No' } = check_box_tag @conference.short_title, @role.id, (@role.user_ids.include? user.id), method: :post, url: "/admin/conferences/#{@conference.short_title}/roles/#{@role.name}/toggle_user?user[email]=#{user.email}&user[state]=", class: 'switch-checkbox', data: { size: 'small', off_color: 'warning', on_text: 'Yes', off_text: 'No' }
%td= user.id %td= user.id
%td= user.name %td= user.name
%td= user.email %td= user.email

View file

@ -8,7 +8,7 @@
.row .row
.col-md-6 .col-md-6
- if @conference.venue.location? - if @conference.venue.location?
= render 'conference/venue_map' = render '/conferences/venue_map'
-else -else
- if @venue.commercial.nil? - if @venue.commercial.nil?
.row .row

View file

@ -40,4 +40,4 @@
.row .row
.col-md-12.text-center .col-md-12.text-center
%p.cta-button %p.cta-button
= link_to "Submit your paper now", conference_program_proposal_index_path(@conference.short_title), class: 'btn btn-success btn-lg text-center' = link_to "Submit your paper now", conference_program_proposals_path(@conference.short_title), class: 'btn btn-success btn-lg text-center'

View file

@ -31,7 +31,7 @@
- if conference.registration_limit_exceeded? - if conference.registration_limit_exceeded?
Sorry, no places left Sorry, no places left
- if !current_user.nil? && current_user.proposal_count(conference) > 0 - if !current_user.nil? && current_user.proposal_count(conference) > 0
= link_to "My Proposals", conference_program_proposal_index_path(conference.short_title), :class =>"btn btn-default" = link_to "My Proposals", conference_program_proposals_path(conference.short_title), :class =>"btn btn-default"
- elsif can? :new, conference.program.events.new - elsif can? :new, conference.program.events.new
= link_to "Submit Proposal", new_conference_program_proposal_path(conference.short_title), :class =>"btn btn-default" = link_to "Submit Proposal", new_conference_program_proposal_path(conference.short_title), :class =>"btn btn-default"
- if current_user.nil? || !current_user.subscribed?(conference) - if current_user.nil? || !current_user.subscribed?(conference)

View file

@ -37,4 +37,4 @@
.row .row
.col-md-12.text-center .col-md-12.text-center
%p.cta-button %p.cta-button
= link_to "Submit your paper now", conference_proposal_index_path(@conference.short_title), class: 'btn btn-success btn-lg text-center' = link_to "Submit your paper now", conference_proposals_path(@conference.short_title), class: 'btn btn-success btn-lg text-center'

View file

@ -2,7 +2,7 @@
%li %li
%a.smoothscroll{ href: '#venue' } Venue %a.smoothscroll{ href: '#venue' } Venue
-if @conference.venue.location? -if @conference.venue.location?
= render 'conference/venue_map' = render '/conferences/venue_map'
-else -else
.container .container
.row .row

View file

@ -6,7 +6,7 @@
%span.caret %span.caret
%ul.dropdown-menu{role:'menu'} %ul.dropdown-menu{role:'menu'}
%li %li
= link_to(admin_conference_index_path) do = link_to(admin_conferences_path) do
%span.fa.fa-home %span.fa.fa-home
All Conferences All Conferences
- @conferences.each do |conference| - @conferences.each do |conference|

View file

@ -6,7 +6,7 @@
%span.caret %span.caret
%ul.dropdown-menu{role: 'menu'} %ul.dropdown-menu{role: 'menu'}
%li %li
= link_to(admin_conference_index_path) do = link_to(admin_conferences_path) do
%span.fa.fa-home %span.fa.fa-home
All Conferences All Conferences
- @conferences.each do |conference| - @conferences.each do |conference|

View file

@ -9,7 +9,7 @@
Edit Profile Edit Profile
-if @conference and @conference.program -if @conference and @conference.program
%li %li
= link_to(conference_program_proposal_index_path(@conference.short_title)) do = link_to(conference_program_proposals_path(@conference.short_title)) do
%span.fa.fa-comment %span.fa.fa-comment
My Submissions My Submissions
%li %li
@ -25,7 +25,7 @@
%li.divider %li.divider
%li %li
- if Conference.any? - if Conference.any?
= link_to(admin_conference_index_path()) do = link_to(admin_conferences_path()) do
%span.fa.fa-home %span.fa.fa-home
Administration Administration
- if can? :create, Conference - if can? :create, Conference

View file

@ -6,7 +6,7 @@
= link_to 'Commercials', '#commercials-content', 'data-toggle' => 'tab' = link_to 'Commercials', '#commercials-content', 'data-toggle' => 'tab'
.tab-content .tab-content
#proposal-content.tab-pane.active #proposal-content.tab-pane.active
= render 'proposal/proposal_form' = render 'proposals/proposal_form'
#commercials-content.tab-pane #commercials-content.tab-pane
%p.text-muted %p.text-muted
You can add commercials for your proposal. These commercials will be displayed on the You can add commercials for your proposal. These commercials will be displayed on the

View file

@ -25,7 +25,7 @@ Osem::Application.routes.draw do
end end
end end
resources :comments, only: [:index] resources :comments, only: [:index]
resources :conference do resources :conferences do
resource :contact, except: [:index, :new, :create, :show, :destroy] resource :contact, except: [:index, :new, :create, :show, :destroy]
resources :schedules, only: [:index, :create, :show, :update, :destroy] resources :schedules, only: [:index, :create, :show, :update, :destroy]
resources :event_schedules, only: [:create, :update, :destroy] resources :event_schedules, only: [:create, :update, :destroy]
@ -102,17 +102,17 @@ Osem::Application.routes.draw do
get '/revision_history/:id/revert_attribute' => 'versions#revert_attribute', as: 'revision_history_revert_attribute' get '/revision_history/:id/revert_attribute' => 'versions#revert_attribute', as: 'revision_history_revert_attribute'
end end
resources :conference, only: [:index, :show] do resources :conferences, only: [:index, :show] do
resource :program, only: [] do resource :program, only: [] do
resources :proposal, except: :destroy do resources :proposals, except: :destroy do
get 'commercials/render_commercial' => 'commercials#render_commercial' get 'commercials/render_commercial' => 'commercials#render_commercial'
resources :commercials, only: [:create, :update, :destroy] resources :commercials, only: [:create, :update, :destroy]
member do member do
get :registrations get :registrations
patch '/withdraw' => 'proposal#withdraw' patch '/withdraw' => 'proposals#withdraw'
get :registrations get :registrations
patch '/confirm' => 'proposal#confirm' patch '/confirm' => 'proposals#confirm'
patch '/restart' => 'proposal#restart' patch '/restart' => 'proposals#restart'
end end
end end
end end
@ -145,7 +145,7 @@ Osem::Application.routes.draw do
end end
end end
get '/admin' => redirect('/admin/conference') get '/admin' => redirect('/admin/conferences')
root to: 'conference#index', via: [:get, :options] root to: 'conferences#index', via: [:get, :options]
end end

View file

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe Admin::ConferenceController do describe Admin::ConferencesController do
# It is necessary to use bang version of let to build roles before user # It is necessary to use bang version of let to build roles before user
let(:conference) { create(:conference, end_date: Date.new(2014, 05, 26) + 15) } let(:conference) { create(:conference, end_date: Date.new(2014, 05, 26) + 15) }

View file

@ -0,0 +1,38 @@
require 'spec_helper'
describe ApplicationController, type: :controller do
let(:conference) { create(:conference) }
describe 'user is signed in' do
describe 'as admin' do
let(:admin) { create(:admin) }
before { sign_in(admin) }
it 'redirects to the admin homepage' do
expect(controller.after_sign_in_path_for(admin)).to eq admin_conferences_path
end
end
describe 'as regular user' do
let(:user) { create(:user) }
before { sign_in(user) }
context 'with no return_to value in the session' do
it 'redirects to the root_path' do
expect(controller.after_sign_in_path_for(user)).to eq root_path
end
end
context 'with a specific return_to value provided in the session' do
it 'redirects to the conferences_path' do
@request.session['return_to'] = conferences_path
expect(controller.after_sign_in_path_for(user)).to eq conferences_path
end
end
end
end
end

View file

@ -1,7 +1,7 @@
require 'spec_helper' require 'spec_helper'
describe ConferenceController do describe ConferencesController do
let(:conference) { create(:conference, splashpage: create(:splashpage, public: true), venue: create(:venue)) } let(:conference) { create(:conference, splashpage: create(:splashpage, public: true), venue: create(:venue)) }
let!(:cfp) { create(:cfp, program: conference.program) } let!(:cfp) { create(:cfp, program: conference.program) }
let(:room) { create(:room, venue: conference.venue) } let(:room) { create(:room, venue: conference.venue) }

View file

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe ProposalController do describe ProposalsController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:conference) { create(:conference, short_title: 'lama101') } let(:conference) { create(:conference, short_title: 'lama101') }
let(:event) { create(:event, program: conference.program) } let(:event) { create(:event, program: conference.program) }
@ -16,7 +16,7 @@ describe ProposalController do
it 'assigns user and url variables' do it 'assigns user and url variables' do
expect(assigns(:user)).to be_instance_of(User) expect(assigns(:user)).to be_instance_of(User)
expect(assigns(:url)).to eq '/conference/lama101/program/proposal' expect(assigns(:url)).to eq '/conferences/lama101/program/proposals'
end end
it 'renders new template' do it 'renders new template' do
@ -32,7 +32,7 @@ describe ProposalController do
post :create, event: attributes_for(:event, event_type_id: event_type.id), post :create, event: attributes_for(:event, event_type_id: event_type.id),
conference_id: conference.short_title, conference_id: conference.short_title,
user: attributes_for(:user) user: attributes_for(:user)
expect(assigns(:url)).to eq '/conference/lama101/program/proposal' expect(assigns(:url)).to eq '/conferences/lama101/program/proposals'
end end
context 'user is saved successfully' do context 'user is saved successfully' do
@ -75,7 +75,7 @@ describe ProposalController do
end end
it 'redirects to proposal index path', run: true do it 'redirects to proposal index path', run: true do
expect(response).to redirect_to conference_program_proposal_index_path conference.short_title expect(response).to redirect_to conference_program_proposals_path conference.short_title
end end
it 'shows success message in flash notice', run: true do it 'shows success message in flash notice', run: true do
@ -199,7 +199,7 @@ describe ProposalController do
it 'assigns user and url variables' do it 'assigns user and url variables' do
expect(assigns(:user)).to be_instance_of(User) expect(assigns(:user)).to be_instance_of(User)
expect(assigns(:url)).to eq '/conference/lama101/program/proposal' expect(assigns(:url)).to eq '/conferences/lama101/program/proposals'
end end
it 'renders new template' do it 'renders new template' do
@ -214,7 +214,7 @@ describe ProposalController do
it 'assigns event and url variables' do it 'assigns event and url variables' do
expect(assigns(:event)).to eq event expect(assigns(:event)).to eq event
expect(assigns(:url)).to eq "/conference/lama101/program/proposal/#{event.id}" expect(assigns(:url)).to eq "/conferences/lama101/program/proposals/#{event.id}"
end end
it 'renders edit template' do it 'renders edit template' do
@ -229,7 +229,7 @@ describe ProposalController do
it 'assigns url variables' do it 'assigns url variables' do
post :create, event: attributes_for(:event, event_type_id: event_type.id), post :create, event: attributes_for(:event, event_type_id: event_type.id),
conference_id: conference.short_title conference_id: conference.short_title
expect(assigns(:url)).to eq '/conference/lama101/program/proposal' expect(assigns(:url)).to eq '/conferences/lama101/program/proposals'
end end
context 'creates proposal successfully' do context 'creates proposal successfully' do
@ -252,7 +252,7 @@ describe ProposalController do
end end
it 'redirects to proposal index path', run: true do it 'redirects to proposal index path', run: true do
expect(response).to redirect_to conference_program_proposal_index_path conference.short_title expect(response).to redirect_to conference_program_proposals_path conference.short_title
end end
it 'shows success message in flash notice', run: true do it 'shows success message in flash notice', run: true do
@ -298,7 +298,7 @@ describe ProposalController do
patch :update, event: attributes_for(:event, title: 'some title', event_type_id: event_type.id), patch :update, event: attributes_for(:event, title: 'some title', event_type_id: event_type.id),
conference_id: conference.short_title, conference_id: conference.short_title,
id: event.id id: event.id
expect(assigns(:url)).to eq "/conference/lama101/program/proposal/#{event.id}" expect(assigns(:url)).to eq "/conferences/lama101/program/proposals/#{event.id}"
end end
context 'updates successfully' do context 'updates successfully' do
@ -314,7 +314,7 @@ describe ProposalController do
end end
it 'redirects to proposal index path' do it 'redirects to proposal index path' do
expect(response).to redirect_to conference_program_proposal_index_path conference.short_title expect(response).to redirect_to conference_program_proposals_path conference.short_title
end end
it 'shows success message in flash notice' do it 'shows success message in flash notice' do
@ -349,7 +349,7 @@ describe ProposalController do
it 'assigns url variable' do it 'assigns url variable' do
patch :withdraw, conference_id: conference.short_title, id: event.id patch :withdraw, conference_id: conference.short_title, id: event.id
expect(assigns(:url)).to eq "/conference/lama101/program/proposal/#{event.id}" expect(assigns(:url)).to eq "/conferences/lama101/program/proposals/#{event.id}"
end end
context 'withdraws successfully' do context 'withdraws successfully' do
@ -363,7 +363,7 @@ describe ProposalController do
end end
it 'redirects to proposal index path' do it 'redirects to proposal index path' do
expect(response).to redirect_to conference_program_proposal_index_path conference.short_title expect(response).to redirect_to conference_program_proposals_path conference.short_title
end end
it 'shows success message in flash notice' do it 'shows success message in flash notice' do
@ -404,7 +404,7 @@ describe ProposalController do
end end
it 'redirects to proposal index path' do it 'redirects to proposal index path' do
expect(response).to redirect_to conference_program_proposal_index_path conference.short_title expect(response).to redirect_to conference_program_proposals_path conference.short_title
end end
it 'shows error in flash message' do it 'shows error in flash message' do
@ -426,7 +426,7 @@ describe ProposalController do
end end
it 'assigns url variable' do it 'assigns url variable' do
expect(assigns(:url)).to eq "/conference/lama101/program/proposal/#{event.id}" expect(assigns(:url)).to eq "/conferences/lama101/program/proposals/#{event.id}"
end end
it 'change state of event to confirmed' do it 'change state of event to confirmed' do
@ -439,7 +439,7 @@ describe ProposalController do
before { patch :confirm, conference_id: conference.short_title, id: event.id } before { patch :confirm, conference_id: conference.short_title, id: event.id }
it 'assigns url variable' do it 'assigns url variable' do
expect(assigns(:url)).to eq "/conference/lama101/program/proposal/#{event.id}" expect(assigns(:url)).to eq "/conferences/lama101/program/proposals/#{event.id}"
end end
it 'change state of event to confirmed' do it 'change state of event to confirmed' do
@ -455,7 +455,7 @@ describe ProposalController do
end end
it 'redirects to proposal index path' do it 'redirects to proposal index path' do
expect(response).to redirect_to conference_program_proposal_index_path conference.short_title expect(response).to redirect_to conference_program_proposals_path conference.short_title
end end
it 'shows success message in flash notice' do it 'shows success message in flash notice' do
@ -510,7 +510,7 @@ describe ProposalController do
end end
it 'redirects to proposal index path' do it 'redirects to proposal index path' do
expect(response).to redirect_to conference_program_proposal_index_path conference.short_title expect(response).to redirect_to conference_program_proposals_path conference.short_title
end end
it 'shows error in flash message' do it 'shows error in flash message' do
@ -524,7 +524,7 @@ describe ProposalController do
it 'assigns url variable' do it 'assigns url variable' do
patch :restart, conference_id: conference.short_title, id: event.id patch :restart, conference_id: conference.short_title, id: event.id
expect(assigns(:url)).to eq "/conference/lama101/program/proposal/#{event.id}" expect(assigns(:url)).to eq "/conferences/lama101/program/proposals/#{event.id}"
end end
context 'resubmits successfully' do context 'resubmits successfully' do
@ -538,7 +538,7 @@ describe ProposalController do
end end
it 'redirects to proposal index path' do it 'redirects to proposal index path' do
expect(response).to redirect_to conference_program_proposal_index_path conference.short_title expect(response).to redirect_to conference_program_proposals_path conference.short_title
end end
it 'shows success message in flash notice' do it 'shows success message in flash notice' do
@ -558,7 +558,7 @@ describe ProposalController do
end end
it 'redirects to proposal index path' do it 'redirects to proposal index path' do
expect(response).to redirect_to conference_program_proposal_index_path conference.short_title expect(response).to redirect_to conference_program_proposals_path conference.short_title
end end
it 'shows error in flash message' do it 'shows error in flash message' do
@ -578,7 +578,7 @@ describe ProposalController do
end end
it 'redirects to proposal index path' do it 'redirects to proposal index path' do
expect(response).to redirect_to conference_program_proposal_index_path conference.short_title expect(response).to redirect_to conference_program_proposals_path conference.short_title
end end
it 'shows error in flash message' do it 'shows error in flash message' do

View file

@ -34,28 +34,28 @@ feature 'Has correct abilities' do
expect(current_path).to eq(admin_conference_path(conference1.short_title)) expect(current_path).to eq(admin_conference_path(conference1.short_title))
expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard') expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard')
expect(page).to have_link('Basics', href: "/admin/conference/#{conference1.short_title}/edit") expect(page).to have_link('Basics', href: "/admin/conferences/#{conference1.short_title}/edit")
expect(page).to have_link('Contact', href: "/admin/conference/#{conference1.short_title}/contact/edit") expect(page).to have_link('Contact', href: "/admin/conferences/#{conference1.short_title}/contact/edit")
expect(page).to have_link('Commercials', href: "/admin/conference/#{conference1.short_title}/commercials") expect(page).to have_link('Commercials', href: "/admin/conferences/#{conference1.short_title}/commercials")
expect(page).to have_link('Events', href: "/admin/conference/#{conference1.short_title}/program/events") expect(page).to have_link('Events', href: "/admin/conferences/#{conference1.short_title}/program/events")
expect(page).to have_link('Registrations', href: "/admin/conference/#{conference1.short_title}/registrations") expect(page).to have_link('Registrations', href: "/admin/conferences/#{conference1.short_title}/registrations")
expect(page).to have_link('Schedules', href: "/admin/conference/#{conference1.short_title}/schedules") expect(page).to have_link('Schedules', href: "/admin/conferences/#{conference1.short_title}/schedules")
expect(page).to have_link('Campaigns', href: "/admin/conference/#{conference1.short_title}/campaigns") expect(page).to have_link('Campaigns', href: "/admin/conferences/#{conference1.short_title}/campaigns")
expect(page).to have_link('Goals', href: "/admin/conference/#{conference1.short_title}/targets") expect(page).to have_link('Goals', href: "/admin/conferences/#{conference1.short_title}/targets")
expect(page).to have_link('Venue', href: "/admin/conference/#{conference1.short_title}/venue") expect(page).to have_link('Venue', href: "/admin/conferences/#{conference1.short_title}/venue")
expect(page).to have_link('Rooms', href: "/admin/conference/#{conference1.short_title}/venue/rooms") expect(page).to have_link('Rooms', href: "/admin/conferences/#{conference1.short_title}/venue/rooms")
expect(page).to have_link('Lodgings', href: "/admin/conference/#{conference1.short_title}/lodgings") expect(page).to have_link('Lodgings', href: "/admin/conferences/#{conference1.short_title}/lodgings")
expect(page).to have_link('Sponsorship', href: "/admin/conference/#{conference1.short_title}/sponsorship_levels") expect(page).to have_link('Sponsorship', href: "/admin/conferences/#{conference1.short_title}/sponsorship_levels")
expect(page).to have_link('Sponsors', href: "/admin/conference/#{conference1.short_title}/sponsors") expect(page).to have_link('Sponsors', href: "/admin/conferences/#{conference1.short_title}/sponsors")
expect(page).to have_link('Tickets', href: "/admin/conference/#{conference1.short_title}/tickets") expect(page).to have_link('Tickets', href: "/admin/conferences/#{conference1.short_title}/tickets")
expect(page).to have_link('E-Mails', href: "/admin/conference/#{conference1.short_title}/emails") expect(page).to have_link('E-Mails', href: "/admin/conferences/#{conference1.short_title}/emails")
expect(page).to have_link('Program', href: "/admin/conference/#{conference1.short_title}/program") expect(page).to have_link('Program', href: "/admin/conferences/#{conference1.short_title}/program")
expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference1.short_title}/program/cfp") expect(page).to have_link('Call for Papers', href: "/admin/conferences/#{conference1.short_title}/program/cfp")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference1.short_title}/program/tracks") expect(page).to have_link('Tracks', href: "/admin/conferences/#{conference1.short_title}/program/tracks")
expect(page).to have_link('Event Types', href: "/admin/conference/#{conference1.short_title}/program/event_types") expect(page).to have_link('Event Types', href: "/admin/conferences/#{conference1.short_title}/program/event_types")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference1.short_title}/program/difficulty_levels") expect(page).to have_link('Difficulty Levels', href: "/admin/conferences/#{conference1.short_title}/program/difficulty_levels")
expect(page).to have_link('Questions', href: "/admin/conference/#{conference1.short_title}/questions") expect(page).to have_link('Questions', href: "/admin/conferences/#{conference1.short_title}/questions")
expect(page).to have_link('Roles', href: "/admin/conference/#{conference1.short_title}/roles") expect(page).to have_link('Roles', href: "/admin/conferences/#{conference1.short_title}/roles")
visit edit_admin_conference_path(conference1.short_title) visit edit_admin_conference_path(conference1.short_title)
expect(current_path).to eq(edit_admin_conference_path(conference1.short_title)) expect(current_path).to eq(edit_admin_conference_path(conference1.short_title))
@ -114,29 +114,29 @@ feature 'Has correct abilities' do
expect(current_path).to eq(admin_conference_path(conference2.short_title)) expect(current_path).to eq(admin_conference_path(conference2.short_title))
expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard') expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard')
expect(page).to_not have_link('Basics', href: "/admin/conference/#{conference2.short_title}/edit") expect(page).to_not have_link('Basics', href: "/admin/conferences/#{conference2.short_title}/edit")
expect(page).to have_text('Basics') expect(page).to have_text('Basics')
expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference2.short_title}/contact/edit") expect(page).to_not have_link('Contact', href: "/admin/conferences/#{conference2.short_title}/contact/edit")
expect(page).to have_link('Commercials', href: "/admin/conference/#{conference2.short_title}/commercials") expect(page).to have_link('Commercials', href: "/admin/conferences/#{conference2.short_title}/commercials")
expect(page).to have_link('Events', href: "/admin/conference/#{conference2.short_title}/program/events") expect(page).to have_link('Events', href: "/admin/conferences/#{conference2.short_title}/program/events")
expect(page).to_not have_link('Registrations', href: "/admin/conference/#{conference2.short_title}/registrations") expect(page).to_not have_link('Registrations', href: "/admin/conferences/#{conference2.short_title}/registrations")
expect(page).to_not have_link('Schedules', href: "/admin/conference/#{conference2.short_title}/schedules") expect(page).to_not have_link('Schedules', href: "/admin/conferences/#{conference2.short_title}/schedules")
expect(page).to_not have_link('Campaigns', href: "/admin/conference/#{conference2.short_title}/campaigns") expect(page).to_not have_link('Campaigns', href: "/admin/conferences/#{conference2.short_title}/campaigns")
expect(page).to_not have_link('Goals', href: "/admin/conference/#{conference2.short_title}/targets") expect(page).to_not have_link('Goals', href: "/admin/conferences/#{conference2.short_title}/targets")
expect(page).to have_link('Venue', href: "/admin/conference/#{conference2.short_title}/venue") expect(page).to have_link('Venue', href: "/admin/conferences/#{conference2.short_title}/venue")
expect(page).to have_link('Rooms', href: "/admin/conference/#{conference2.short_title}/venue/rooms") expect(page).to have_link('Rooms', href: "/admin/conferences/#{conference2.short_title}/venue/rooms")
expect(page).to_not have_link('Lodgings', href: "/admin/conference/#{conference2.short_title}/lodgings") expect(page).to_not have_link('Lodgings', href: "/admin/conferences/#{conference2.short_title}/lodgings")
expect(page).to_not have_link('Sponsorship', href: "/admin/conference/#{conference2.short_title}/sponsorship_levels") expect(page).to_not have_link('Sponsorship', href: "/admin/conferences/#{conference2.short_title}/sponsorship_levels")
expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference2.short_title}/sponsors") expect(page).to_not have_link('Sponsors', href: "/admin/conferences/#{conference2.short_title}/sponsors")
expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference2.short_title}/supporter_levels") expect(page).to_not have_link('Supporter Levels', href: "/admin/conferences/#{conference2.short_title}/supporter_levels")
expect(page).to have_link('E-Mails', href: "/admin/conference/#{conference2.short_title}/emails") expect(page).to have_link('E-Mails', href: "/admin/conferences/#{conference2.short_title}/emails")
expect(page).to have_link('Program', href: "/admin/conference/#{conference2.short_title}/program") expect(page).to have_link('Program', href: "/admin/conferences/#{conference2.short_title}/program")
expect(page).to have_link('Call for Papers', href: "/admin/conference/#{conference2.short_title}/program/cfp") expect(page).to have_link('Call for Papers', href: "/admin/conferences/#{conference2.short_title}/program/cfp")
expect(page).to have_link('Tracks', href: "/admin/conference/#{conference2.short_title}/program/tracks") expect(page).to have_link('Tracks', href: "/admin/conferences/#{conference2.short_title}/program/tracks")
expect(page).to have_link('Event Types', href: "/admin/conference/#{conference2.short_title}/program/event_types") expect(page).to have_link('Event Types', href: "/admin/conferences/#{conference2.short_title}/program/event_types")
expect(page).to have_link('Difficulty Levels', href: "/admin/conference/#{conference2.short_title}/program/difficulty_levels") expect(page).to have_link('Difficulty Levels', href: "/admin/conferences/#{conference2.short_title}/program/difficulty_levels")
expect(page).to_not have_link('Questions', href: "/admin/conference/#{conference2.short_title}/questions") expect(page).to_not have_link('Questions', href: "/admin/conferences/#{conference2.short_title}/questions")
expect(page).to have_link('Roles', href: "/admin/conference/#{conference2.short_title}/roles") expect(page).to have_link('Roles', href: "/admin/conferences/#{conference2.short_title}/roles")
visit edit_admin_conference_path(conference2.short_title) visit edit_admin_conference_path(conference2.short_title)
expect(current_path).to eq(root_path) expect(current_path).to eq(root_path)
@ -191,29 +191,29 @@ feature 'Has correct abilities' do
expect(current_path).to eq(admin_conference_path(conference3.short_title)) expect(current_path).to eq(admin_conference_path(conference3.short_title))
expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard') expect(page).to have_selector('li.nav-header.nav-header-bigger a', text: 'Dashboard')
expect(page).to_not have_link('Basics', href: "/admin/conference/#{conference2.short_title}/edit") expect(page).to_not have_link('Basics', href: "/admin/conferences/#{conference2.short_title}/edit")
expect(page).to have_text('Basics') expect(page).to have_text('Basics')
expect(page).to_not have_link('Contact', href: "/admin/conference/#{conference3.short_title}/contact/edit") expect(page).to_not have_link('Contact', href: "/admin/conferences/#{conference3.short_title}/contact/edit")
expect(page).to have_link('Commercials', href: "/admin/conference/#{conference3.short_title}/commercials") expect(page).to have_link('Commercials', href: "/admin/conferences/#{conference3.short_title}/commercials")
expect(page).to_not have_link('Events', href: "/admin/conference/#{conference3.short_title}/program/events") expect(page).to_not have_link('Events', href: "/admin/conferences/#{conference3.short_title}/program/events")
expect(page).to have_link('Registrations', href: "/admin/conference/#{conference3.short_title}/registrations") expect(page).to have_link('Registrations', href: "/admin/conferences/#{conference3.short_title}/registrations")
expect(page).to_not have_link('Schedules', href: "/admin/conference/#{conference3.short_title}/schedules") expect(page).to_not have_link('Schedules', href: "/admin/conferences/#{conference3.short_title}/schedules")
expect(page).to_not have_link('Campaigns', href: "/admin/conference/#{conference3.short_title}/campaigns") expect(page).to_not have_link('Campaigns', href: "/admin/conferences/#{conference3.short_title}/campaigns")
expect(page).to_not have_link('Targets', href: "/admin/conference/#{conference3.short_title}/targets") expect(page).to_not have_link('Targets', href: "/admin/conferences/#{conference3.short_title}/targets")
expect(page).to_not have_link('Venue', href: "/admin/conference/#{conference3.short_title}/venue") expect(page).to_not have_link('Venue', href: "/admin/conferences/#{conference3.short_title}/venue")
expect(page).to_not have_link('Rooms', href: "/admin/conference/#{conference3.short_title}/venue/rooms") expect(page).to_not have_link('Rooms', href: "/admin/conferences/#{conference3.short_title}/venue/rooms")
expect(page).to_not have_link('Lodgings', href: "/admin/conference/#{conference3.short_title}/lodgings") expect(page).to_not have_link('Lodgings', href: "/admin/conferences/#{conference3.short_title}/lodgings")
expect(page).to_not have_link('Sponsorship', href: "/admin/conference/#{conference3.short_title}/sponsorship_levels") expect(page).to_not have_link('Sponsorship', href: "/admin/conferences/#{conference3.short_title}/sponsorship_levels")
expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference3.short_title}/sponsors") expect(page).to_not have_link('Sponsors', href: "/admin/conferences/#{conference3.short_title}/sponsors")
expect(page).to_not have_link('Supporter Levels', href: "/admin/conference/#{conference3.short_title}/supporter_levels") expect(page).to_not have_link('Supporter Levels', href: "/admin/conferences/#{conference3.short_title}/supporter_levels")
expect(page).to_not have_link('E-Mails', href: "/admin/conference/#{conference3.short_title}/emails") expect(page).to_not have_link('E-Mails', href: "/admin/conferences/#{conference3.short_title}/emails")
expect(page).to_not have_link('Program', href: "/admin/conference/#{conference3.short_title}/program") expect(page).to_not have_link('Program', href: "/admin/conferences/#{conference3.short_title}/program")
expect(page).to_not have_link('Call for papers', href: "/admin/conference/#{conference3.short_title}/program/cfp") expect(page).to_not have_link('Call for papers', href: "/admin/conferences/#{conference3.short_title}/program/cfp")
expect(page).to_not have_link('Tracks', href: "/admin/conference/#{conference3.short_title}/program/tracks") expect(page).to_not have_link('Tracks', href: "/admin/conferences/#{conference3.short_title}/program/tracks")
expect(page).to_not have_link('Event types', href: "/admin/conference/#{conference3.short_title}/program/event_types") expect(page).to_not have_link('Event types', href: "/admin/conferences/#{conference3.short_title}/program/event_types")
expect(page).to_not have_link('Difficulty levels', href: "/admin/conference/#{conference3.short_title}/program/difficulty_levels") expect(page).to_not have_link('Difficulty levels', href: "/admin/conferences/#{conference3.short_title}/program/difficulty_levels")
expect(page).to have_link('Questions', href: "/admin/conference/#{conference3.short_title}/questions") expect(page).to have_link('Questions', href: "/admin/conferences/#{conference3.short_title}/questions")
expect(page).to have_link('Roles', href: "/admin/conference/#{conference3.short_title}/roles") expect(page).to have_link('Roles', href: "/admin/conferences/#{conference3.short_title}/roles")
visit edit_admin_conference_path(conference3.short_title) visit edit_admin_conference_path(conference3.short_title)
expect(current_path).to eq(root_path) expect(current_path).to eq(root_path)

View file

@ -12,7 +12,7 @@ feature 'BaseController' do
describe 'GET #verify_user_admin' do describe 'GET #verify_user_admin' do
context 'when user is a guest' do context 'when user is a guest' do
it 'redirects to sign in page' do it 'redirects to sign in page' do
visit admin_conference_index_path visit admin_conferences_path
expect(current_path).to eq new_user_session_path expect(current_path).to eq new_user_session_path
end end
end end
@ -23,39 +23,39 @@ feature 'BaseController' do
end end
it 'not an admin it redirects to root_path' do it 'not an admin it redirects to root_path' do
visit admin_conference_index_path visit admin_conferences_path
expect(current_path).to eq root_path expect(current_path).to eq root_path
expect(flash).to eq 'You are not authorized to access this area!' expect(flash).to eq 'You are not authorized to access this area!'
end end
it 'an admin he can access the admin area' do it 'an admin he can access the admin area' do
user.is_admin = true user.is_admin = true
visit admin_conference_index_path visit admin_conferences_path
expect(current_path).to eq admin_conference_index_path expect(current_path).to eq admin_conferences_path
end end
it 'an organizer he can access the admin area' do it 'an organizer he can access the admin area' do
user.role_ids = organizer_role.id user.role_ids = organizer_role.id
visit admin_conference_index_path visit admin_conferences_path
expect(current_path).to eq admin_conference_index_path expect(current_path).to eq admin_conferences_path
end end
it 'a volunteers_coordinator he can access the admin area' do it 'a volunteers_coordinator he can access the admin area' do
user.role_ids = volunteers_coordinator_role.id user.role_ids = volunteers_coordinator_role.id
visit admin_conference_index_path visit admin_conferences_path
expect(current_path).to eq admin_conference_index_path expect(current_path).to eq admin_conferences_path
end end
it 'a cfp he can access the admin area' do it 'a cfp he can access the admin area' do
user.role_ids = cfp_role.id user.role_ids = cfp_role.id
visit admin_conference_index_path visit admin_conferences_path
expect(current_path).to eq admin_conference_index_path expect(current_path).to eq admin_conferences_path
end end
it 'an info_desk he can access the admin area' do it 'an info_desk he can access the admin area' do
user.role_ids = info_desk_role.id user.role_ids = info_desk_role.id
visit admin_conference_index_path visit admin_conferences_path
expect(current_path).to eq admin_conference_index_path expect(current_path).to eq admin_conferences_path
end end
end end
end end

View file

@ -9,8 +9,6 @@ feature Commercial do
context 'in admin area' do context 'in admin area' do
scenario 'adds, updates, deletes of a conference', feature: true, js: true do scenario 'adds, updates, deletes of a conference', feature: true, js: true do
expected_count = conference.commercials.count + 1
sign_in organizer sign_in organizer
visit admin_conference_commercials_path(conference.short_title) visit admin_conference_commercials_path(conference.short_title)
@ -22,14 +20,14 @@ feature Commercial do
fill_in 'commercial_url', with: 'https://www.youtube.com/watch?v=M9bq_alk-sw' fill_in 'commercial_url', with: 'https://www.youtube.com/watch?v=M9bq_alk-sw'
click_button 'Create Commercial' click_button 'Create Commercial'
expect(flash).to eq('Commercial was successfully created.') expect(flash).to eq('Commercial was successfully created.')
expect(conference.commercials.count).to eq(expected_count) expect(conference.commercials.count).to eq(1)
commercial = conference.commercials.where(url: 'https://www.youtube.com/watch?v=M9bq_alk-sw').first commercial = conference.commercials.where(url: 'https://www.youtube.com/watch?v=M9bq_alk-sw').first
fill_in "commercial_url_#{commercial.id}", with: 'https://www.youtube.com/watch?v=VNkDJk5_9eU' fill_in "commercial_url_#{commercial.id}", with: 'https://www.youtube.com/watch?v=VNkDJk5_9eU'
click_button 'Update' click_button 'Update'
expect(flash).to eq('Commercial was successfully updated.') expect(flash).to eq('Commercial was successfully updated.')
expect(conference.commercials.count).to eq(expected_count) expect(conference.commercials.count).to eq(1)
commercial.reload commercial.reload
expect(commercial.url).to eq 'https://www.youtube.com/watch?v=VNkDJk5_9eU' expect(commercial.url).to eq 'https://www.youtube.com/watch?v=VNkDJk5_9eU'
@ -37,7 +35,7 @@ feature Commercial do
click_link 'Delete' click_link 'Delete'
expect(flash).to eq('Commercial was successfully destroyed.') expect(flash).to eq('Commercial was successfully destroyed.')
expect(conference.commercials.count).to eq(expected_count - 1) expect(conference.commercials.count).to eq(0)
end end
end end
@ -49,8 +47,6 @@ feature Commercial do
user_id: participant.id, user_id: participant.id,
event_id: event.id, event_id: event.id,
event_role: 'submitter')] event_role: 'submitter')]
@expected_count = Commercial.count + 1
sign_in participant sign_in participant
end end
@ -68,7 +64,7 @@ feature Commercial do
click_button 'Create Commercial' click_button 'Create Commercial'
expect(flash).to eq('Commercial was successfully created.') expect(flash).to eq('Commercial was successfully created.')
expect(event.commercials.count).to eq(@expected_count) expect(event.commercials.count).to eq(1)
end end
scenario 'does not add an invalid commercial of an event', feature: true, js: true do scenario 'does not add an invalid commercial of an event', feature: true, js: true do
@ -82,7 +78,7 @@ feature Commercial do
click_button 'Create Commercial' click_button 'Create Commercial'
expect(flash).to include('An error prohibited this Commercial from being saved:') expect(flash).to include('An error prohibited this Commercial from being saved:')
expect(current_path).to eq edit_conference_program_proposal_path(conference.short_title, event.id) expect(current_path).to eq edit_conference_program_proposal_path(conference.short_title, event.id)
expect(event.commercials.count).to eq 0 expect(event.commercials.count).to eq(0)
end end
scenario 'updates a commercial of an event', feature: true, versioning: true, js: true do scenario 'updates a commercial of an event', feature: true, versioning: true, js: true do
@ -94,7 +90,7 @@ feature Commercial do
fill_in "commercial_url_#{commercial.id}", with: 'https://www.youtube.com/watch?v=M9bq_alk-sw' fill_in "commercial_url_#{commercial.id}", with: 'https://www.youtube.com/watch?v=M9bq_alk-sw'
click_button 'Update' click_button 'Update'
expect(flash).to eq('Commercial was successfully updated.') expect(flash).to eq('Commercial was successfully updated.')
expect(event.commercials.count).to eq(@expected_count) expect(event.commercials.count).to eq(1)
commercial.reload commercial.reload
expect(commercial.url).to eq('https://www.youtube.com/watch?v=M9bq_alk-sw') expect(commercial.url).to eq('https://www.youtube.com/watch?v=M9bq_alk-sw')
end end
@ -122,7 +118,7 @@ feature Commercial do
click_link 'Delete' click_link 'Delete'
page.driver.network_traffic page.driver.network_traffic
expect(flash).to eq('Commercial was successfully destroyed.') expect(flash).to eq('Commercial was successfully destroyed.')
expect(event.commercials.count).to eq(@expected_count - 1) expect(event.commercials.count).to eq(0)
end end
end end
end end

View file

@ -107,7 +107,7 @@ feature Event do
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
sign_in participant_without_bio sign_in participant_without_bio
expected_count = Event.count + 1 expected_count = Event.count + 1
visit conference_program_proposal_index_path(conference.short_title) visit conference_program_proposals_path(conference.short_title)
click_link 'New Proposal' click_link 'New Proposal'
fill_in 'event_title', with: 'Example Proposal' fill_in 'event_title', with: 'Example Proposal'
@ -121,13 +121,13 @@ feature Event do
click_button 'Create Proposal' click_button 'Create Proposal'
expect(flash).to eq('Proposal was successfully submitted.') expect(flash).to eq('Proposal was successfully submitted.')
expect(current_path).to eq(conference_program_proposal_index_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)
end end
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_proposal_index_path(conference.short_title) visit conference_program_proposals_path(conference.short_title)
expect(page.has_content?('Example Proposal')).to be true expect(page.has_content?('Example Proposal')).to be true
expect(@event.state).to eq('unconfirmed') expect(@event.state).to eq('unconfirmed')
click_link "confirm_proposal_#{@event.id}" click_link "confirm_proposal_#{@event.id}"
@ -141,7 +141,7 @@ feature Event do
scenario 'withdraw a proposal', feature: true, js: true do scenario 'withdraw a proposal', feature: true, js: true do
sign_in participant sign_in participant
@event.confirm! @event.confirm!
visit conference_program_proposal_index_path(conference.short_title) visit conference_program_proposals_path(conference.short_title)
expect(page.has_content?('Example Proposal')).to be true expect(page.has_content?('Example Proposal')).to be true
click_link "delete_proposal_#{@event.id}" click_link "delete_proposal_#{@event.id}"
expect(flash).to eq('Proposal was successfully withdrawn.') expect(flash).to eq('Proposal was successfully withdrawn.')

View file

@ -179,14 +179,14 @@ feature 'Version' do
click_button 'New' click_button 'New'
click_link 'Reject event' click_link 'Reject event'
visit conference_program_proposal_index_path(conference_id: conference.short_title) visit conference_program_proposals_path(conference_id: conference.short_title)
click_link 'Re-Submit' click_link 'Re-Submit'
visit admin_conference_program_events_path(conference.short_title) visit admin_conference_program_events_path(conference.short_title)
click_button 'New' click_button 'New'
click_link 'Accept event' click_link 'Accept event'
visit conference_program_proposal_index_path(conference_id: conference.short_title) visit conference_program_proposals_path(conference_id: conference.short_title)
click_link 'Confirm' click_link 'Confirm'
visit admin_conference_program_events_path(conference.short_title) visit admin_conference_program_events_path(conference.short_title)

View file

@ -12,9 +12,9 @@ describe EmailSettings do
'conference' => conference.title, 'conference' => conference.title,
'conference_start_date' => Date.new(2014, 05, 01), 'conference_start_date' => Date.new(2014, 05, 01),
'conference_end_date' => Date.new(2014, 05, 06), 'conference_end_date' => Date.new(2014, 05, 06),
'registrationlink' => 'http://localhost:3000/conference/goto/register', 'registrationlink' => 'http://localhost:3000/conferences/goto/register',
'conference_splash_link' => 'http://localhost:3000/conference/goto', 'conference_splash_link' => 'http://localhost:3000/conferences/goto',
'schedule_link' => 'http://localhost:3000/conference/goto/schedule', 'schedule_link' => 'http://localhost:3000/conferences/goto/schedule',
'cfp_end_date' => 'Unknown', 'cfp_end_date' => 'Unknown',
'cfp_start_date' => 'Unknown', 'cfp_start_date' => 'Unknown',
'venue' => 'Unknown', 'venue' => 'Unknown',
@ -87,7 +87,7 @@ describe EmailSettings do
context 'conference has event' do context 'conference has event' do
before do before do
event_hash = { 'eventtitle' => 'Talk about talks', 'proposalslink' => 'http://localhost:3000/conference/goto/program/proposal' } event_hash = { 'eventtitle' => 'Talk about talks', 'proposalslink' => 'http://localhost:3000/conferences/goto/program/proposals' }
expected_hash.merge!(event_hash) expected_hash.merge!(event_hash)
end end

View file

@ -3,6 +3,6 @@ module Sidebar
@conference = create(:conference) @conference = create(:conference)
assign :conference, @conference assign :conference, @conference
render render
expect(view).to render_template('admin/conference/_sidebar') expect(view).to render_template('admin/conferences/_sidebar')
end end
end end

View file

@ -1,11 +1,11 @@
require 'spec_helper' require 'spec_helper'
describe 'admin/conference/edit' do describe 'admin/conferences/edit' do
it 'renders conference details which are editable' do it 'renders conference details which are editable' do
@conference = create(:conference, title: 'openSUSE') @conference = create(:conference, title: 'openSUSE')
assign :conference, @conference assign :conference, @conference
render template: 'admin/conference/edit.html.haml' render template: 'admin/conferences/edit.html.haml'
expect(rendered).to have_selector("input[value='openSUSE']") expect(rendered).to have_selector("input[value='openSUSE']")
end end
end end

View file

@ -1,12 +1,12 @@
require 'spec_helper' require 'spec_helper'
describe 'admin/conference/index' do describe 'admin/conferences/index' do
let(:conference) { create(:conference, title: 'openSUSE Conference 2016') } let(:conference) { create(:conference, title: 'openSUSE Conference 2016') }
let(:second_conference) { create(:conference) } let(:second_conference) { create(:conference) }
it 'renders all conference names with links' do it 'renders all conference names with links' do
assign(:conferences, [conference, second_conference]) assign(:conferences, [conference, second_conference])
render render template: 'admin/conferences/index.html.haml'
expect(rendered).to include('openSUSE Conference 2016') expect(rendered).to include('openSUSE Conference 2016')
expect(rendered).to include(CGI.escapeHTML(second_conference.title)) expect(rendered).to include(CGI.escapeHTML(second_conference.title))
end end

View file

@ -1,11 +1,11 @@
require 'spec_helper' require 'spec_helper'
describe 'admin/conference/new' do describe 'admin/conferences/new' do
let(:conference) { build(:conference) } let(:conference) { build(:conference) }
it 'renders the new template for the conference' do it 'renders the new template for the conference' do
assign(:conference, Conference.new) assign(:conference, Conference.new)
render render template: 'admin/conferences/new.html.haml'
expect(rendered).to include('Basic Information') expect(rendered).to include('Basic Information')
assign(:conference, conference) assign(:conference, conference)
render render

View file

@ -1,13 +1,13 @@
require 'spec_helper' require 'spec_helper'
describe 'admin/conference/show' do describe 'admin/conferences/show' do
it 'renders conference dashboard' do it 'renders conference dashboard' do
conference = create(:conference, title: 'openSUSE') conference = create(:conference, title: 'openSUSE')
assign :conference, conference assign :conference, conference
assign :program, conference.program assign :program, conference.program
assign :conference_progress, conference.get_status assign :conference_progress, conference.get_status
render render template: 'admin/conferences/show.html.haml'
expect(rendered).to include("Dashboard for #{conference.title}") expect(rendered).to include("Dashboard for #{conference.title}")
end end
end end

View file

@ -1,6 +1,6 @@
require 'spec_helper' require 'spec_helper'
describe 'conference/index' do describe 'conferences/index' do
it 'renders _conference partial for each conference' do it 'renders _conference partial for each conference' do
allow(view).to receive(:date_string).and_return('January 17 - 21 2014') allow(view).to receive(:date_string).and_return('January 17 - 21 2014')
assign(:current, [create(:conference), create(:conference)]) assign(:current, [create(:conference), create(:conference)])

View file

@ -1,5 +1,5 @@
require 'spec_helper' require 'spec_helper'
describe 'conference/show.html.haml' do describe 'conferences/show.html.haml' do
let!(:conference) { create(:full_conference) } let!(:conference) { create(:full_conference) }
before(:each) do before(:each) do
@ -13,11 +13,11 @@ describe 'conference/show.html.haml' do
end end
it 'renders program partial' do it 'renders program partial' do
expect(view).to render_template(partial: 'conference/_schedule_splashpage') expect(view).to render_template(partial: 'conferences/_schedule_splashpage')
end end
it 'renders registration partial' do it 'renders registration partial' do
expect(view).to render_template(partial: 'conference/_registration') expect(view).to render_template(partial: 'conferences/_registration')
end end
it 'renders call_for_paper partial' do it 'renders call_for_paper partial' do
@ -25,7 +25,7 @@ describe 'conference/show.html.haml' do
end end
it 'renders sponsors partial' do it 'renders sponsors partial' do
expect(view).to render_template(partial: 'conference/_sponsors') expect(view).to render_template(partial: 'conferences/_sponsors')
expect(rendered).to match(conference.contact.email) expect(rendered).to match(conference.contact.email)
expect(rendered).to match(conference.sponsors.first.website_url) expect(rendered).to match(conference.sponsors.first.website_url)
expect(rendered).to match(CGI.escapeHTML(conference.sponsors.first.description)) expect(rendered).to match(CGI.escapeHTML(conference.sponsors.first.description))
@ -33,7 +33,7 @@ describe 'conference/show.html.haml' do
end end
it 'renders social media partial' do it 'renders social media partial' do
expect(view).to render_template('conference/_social_media') expect(view).to render_template('conferences/_social_media')
expect(rendered).to match(conference.contact.facebook) expect(rendered).to match(conference.contact.facebook)
expect(rendered).to match(conference.contact.googleplus) expect(rendered).to match(conference.contact.googleplus)
expect(rendered).to match(conference.contact.instagram) expect(rendered).to match(conference.contact.instagram)
@ -41,7 +41,7 @@ describe 'conference/show.html.haml' do
end end
it 'renders venue partial' do it 'renders venue partial' do
expect(view).to render_template(partial: 'conference/_venue') expect(view).to render_template(partial: 'conferences/_venue')
expect(rendered).to match(CGI.escapeHTML(conference.venue.name)) expect(rendered).to match(CGI.escapeHTML(conference.venue.name))
expect(rendered).to match(conference.venue.street) expect(rendered).to match(conference.venue.street)
expect(rendered).to match(conference.venue.website) expect(rendered).to match(conference.venue.website)
@ -49,7 +49,7 @@ describe 'conference/show.html.haml' do
end end
it 'renders lodging partial' do it 'renders lodging partial' do
expect(view).to render_template(partial: 'conference/_lodging') expect(view).to render_template(partial: 'conferences/_lodging')
expect(rendered).to match(CGI.escapeHTML(conference.lodgings.first.name)) expect(rendered).to match(CGI.escapeHTML(conference.lodgings.first.name))
expect(rendered).to match(CGI.escapeHTML(conference.lodgings.first.description)) expect(rendered).to match(CGI.escapeHTML(conference.lodgings.first.description))
# FIXME: Lodging without image doesn't show link # FIXME: Lodging without image doesn't show link