mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Rooms belong to venue
This commit is contained in:
parent
feabbfbc99
commit
f840f2b3f0
31 changed files with 221 additions and 166 deletions
|
|
@ -1,22 +1,22 @@
|
|||
module Admin
|
||||
class RoomsController < Admin::BaseController
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource :program, through: :conference, singleton: true
|
||||
load_and_authorize_resource through: :program
|
||||
load_and_authorize_resource :venue, through: :conference, singleton: true
|
||||
load_and_authorize_resource through: :venue
|
||||
|
||||
def index; end
|
||||
|
||||
def edit; end
|
||||
|
||||
def new
|
||||
@room = @program.rooms.new
|
||||
@room = @venue.rooms.new
|
||||
end
|
||||
|
||||
def create
|
||||
@room = @program.rooms.new(room_params)
|
||||
@room = @venue.rooms.new(room_params)
|
||||
if @room.save
|
||||
flash[:notice] = 'Room successfully created.'
|
||||
redirect_to(admin_conference_program_rooms_path(conference_id: @conference.short_title))
|
||||
redirect_to(admin_conference_venue_rooms_path(conference_id: @conference.short_title))
|
||||
else
|
||||
flash[:error] = "Creating Room failed: #{@room.errors.full_messages.join('. ')}."
|
||||
render :new
|
||||
|
|
@ -26,7 +26,7 @@ module Admin
|
|||
def update
|
||||
if @room.update_attributes(room_params)
|
||||
flash[:notice] = 'Room successfully updated.'
|
||||
redirect_to(admin_conference_program_rooms_path(conference_id: @conference.short_title))
|
||||
redirect_to(admin_conference_venue_rooms_path(conference_id: @conference.short_title))
|
||||
else
|
||||
flash[:error] = "Update Room failed: #{@room.errors.full_messages.join('. ')}."
|
||||
render :edit
|
||||
|
|
@ -36,10 +36,10 @@ module Admin
|
|||
def destroy
|
||||
if @room.destroy
|
||||
flash[:notice] = 'Room successfully deleted.'
|
||||
redirect_to(admin_conference_program_rooms_path(conference_id: @conference.short_title))
|
||||
redirect_to(admin_conference_venue_rooms_path(conference_id: @conference.short_title))
|
||||
else
|
||||
flash[:error] = "Destroying room failed! #{@room.errors.full_messages.join('. ')}."
|
||||
redirect_to(admin_conference_program_rooms_path(conference_id: @conference.short_title))
|
||||
redirect_to(admin_conference_venue_rooms_path(conference_id: @conference.short_title))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ module Admin
|
|||
# the schedule of a conference, which should not be accessed in the first place
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource :program, through: :conference, singleton: true
|
||||
load_resource :venue, through: :conference, singleton: true
|
||||
|
||||
skip_before_filter :verify_authenticity_token, only: [:update]
|
||||
layout 'schedule'
|
||||
|
|
@ -15,7 +16,7 @@ module Admin
|
|||
return
|
||||
end
|
||||
@dates = @conference.start_date..@conference.end_date
|
||||
@rooms = @program.rooms
|
||||
@rooms = @venue.rooms
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
|
|||
|
|
@ -5,8 +5,12 @@ module Api
|
|||
respond_to :json
|
||||
|
||||
def index
|
||||
@conference ? (rooms = @conference.rooms) : (rooms = Room.all)
|
||||
|
||||
if params[:conference_id].blank?
|
||||
rooms = Room.all
|
||||
else
|
||||
conference = Conference.find_by_guid(params[:conference_id])
|
||||
rooms = conference.venue.rooms if conference.venue
|
||||
end
|
||||
respond_with rooms
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class ConferenceController < ApplicationController
|
|||
def show; end
|
||||
|
||||
def schedule
|
||||
@rooms = @conference.program.rooms
|
||||
@rooms = @conference.venue.rooms if @conference.venue
|
||||
@events = @conference.program.events
|
||||
@dates = @conference.start_date..@conference.end_date
|
||||
|
||||
|
|
|
|||
|
|
@ -106,6 +106,10 @@ class Ability
|
|||
can :manage, :all if user.is_admin
|
||||
|
||||
cannot :destroy, Program
|
||||
# Do not delete venue, when there are rooms being used
|
||||
cannot :destroy, Venue do |venue|
|
||||
venue.conference.program.events.where.not(room_id: nil).any?
|
||||
end
|
||||
end
|
||||
|
||||
def signed_in_with_organizer_role(user)
|
||||
|
|
@ -141,7 +145,7 @@ class Ability
|
|||
commercialable_id: Event.where(program_id: Program.where(conference_id: conf_ids_for_organizer).pluck(:id)).pluck(:id)
|
||||
can :manage, Venue, conference_id: conf_ids_for_organizer
|
||||
can :manage, Lodging, conference_id: conf_ids_for_organizer
|
||||
can :manage, Room, program: { conference_id: conf_ids_for_organizer}
|
||||
can :manage, Room, venue: { conference_id: conf_ids_for_organizer}
|
||||
can :manage, Sponsor, conference_id: conf_ids_for_organizer
|
||||
can :manage, SponsorshipLevel, conference_id: conf_ids_for_organizer
|
||||
can :manage, Ticket, conference_id: conf_ids_for_organizer
|
||||
|
|
@ -160,7 +164,7 @@ class Ability
|
|||
can :manage, Track, program: { conference_id: conf_ids_for_cfp }
|
||||
can :manage, DifficultyLevel, program: { conference_id: conf_ids_for_cfp }
|
||||
can :manage, EmailSettings, conference_id: conf_ids_for_cfp
|
||||
can :manage, Room, program: { conference_id: conf_ids_for_cfp }
|
||||
can :manage, Room, venue: { conference_id: conf_ids_for_cfp }
|
||||
can :index, Venue, conference_id: conf_ids_for_cfp
|
||||
can :manage, Cfp, program: { conference_id: conf_ids_for_cfp }
|
||||
can :manage, Program, conference_id: conf_ids_for_cfp
|
||||
|
|
|
|||
|
|
@ -707,7 +707,7 @@ class Conference < ActiveRecord::Base
|
|||
# * +True+ -> One room or more
|
||||
# * +False+ -> No room
|
||||
def rooms_set?
|
||||
program.rooms.count > 0
|
||||
venue.present? && venue.rooms.count > 0
|
||||
end
|
||||
|
||||
# Checks if the conference has a venue object.
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ class Program < ActiveRecord::Base
|
|||
has_many :event_types, dependent: :destroy
|
||||
has_many :tracks, dependent: :destroy
|
||||
has_many :difficulty_levels, dependent: :destroy
|
||||
has_many :rooms, dependent: :destroy
|
||||
has_many :events, dependent: :destroy do
|
||||
def workshops
|
||||
where(require_registration: true, state: :confirmed)
|
||||
|
|
@ -36,11 +35,10 @@ class Program < ActiveRecord::Base
|
|||
accepts_nested_attributes_for :event_types, allow_destroy: true
|
||||
accepts_nested_attributes_for :tracks, reject_if: proc { |r| r['name'].blank? }, allow_destroy: true
|
||||
accepts_nested_attributes_for :difficulty_levels, allow_destroy: true
|
||||
accepts_nested_attributes_for :rooms, reject_if: proc { |r| r['name'].blank? }, allow_destroy: true
|
||||
|
||||
attr_accessible :schedule_fluid, :rating,
|
||||
:schedule_public, :include_cfp_in_splash, :conference_id,
|
||||
:event_types_attributes, :difficulty_levels_attributes, :rooms_attributes, :tracks_attributes
|
||||
:event_types_attributes, :difficulty_levels_attributes, :tracks_attributes
|
||||
|
||||
# validates :conference_id, presence: true, uniqueness: true
|
||||
validates :rating, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 10 }
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
class Room < ActiveRecord::Base
|
||||
belongs_to :program
|
||||
belongs_to :venue
|
||||
has_many :events, dependent: :nullify
|
||||
|
||||
before_create :generate_guid
|
||||
|
||||
validates :name, presence: true
|
||||
validates :name, :venue_id, presence: true
|
||||
|
||||
validates :size, numericality: { only_integer: true, greater_than: 0 }, allow_nil: true
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
class Venue < ActiveRecord::Base
|
||||
belongs_to :conference
|
||||
has_many :lodgings
|
||||
has_many :rooms, dependent: :destroy
|
||||
before_create :generate_guid
|
||||
|
||||
validates :name, :street, :city, :country, presence: true
|
||||
validates :conference_id, presence: true, uniqueness: true
|
||||
|
||||
has_attached_file :photo,
|
||||
styles: { thumb: '100x100>', large: '300x300>' }
|
||||
|
|
@ -11,8 +12,6 @@ class Venue < ActiveRecord::Base
|
|||
content_type: [/jpg/, /jpeg/, /png/, /gif/],
|
||||
size: { in: 0..500.kilobytes }
|
||||
|
||||
accepts_nested_attributes_for :lodgings, allow_destroy: true
|
||||
|
||||
after_update :send_mail_notification
|
||||
|
||||
def address
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@
|
|||
Add venue
|
||||
%li{'class'=>"list-group-item #{class_for_todo(conference_progress['rooms'])}"}
|
||||
%span{'class'=>icon_for_todo(conference_progress['rooms'])}
|
||||
- if can? :update, @conference.program.rooms.build
|
||||
= link_to 'Add rooms', admin_conference_program_rooms_path(conference_progress['short_title'])
|
||||
- if @conference.venue && (can? :update, @conference.venue.rooms.build)
|
||||
= link_to 'Add rooms', admin_conference_venue_rooms_path(conference_progress['short_title'])
|
||||
- else
|
||||
Add rooms
|
||||
%li{'class'=>"list-group-item #{class_for_todo(conference_progress['tracks'])}"}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
= @room.name
|
||||
.row
|
||||
.col-md-8
|
||||
= semantic_form_for(@room, :url => (@room.new_record? ? admin_conference_program_rooms_path : admin_conference_program_room_path(@conference.short_title, @room))) do |f|
|
||||
= f.input :name
|
||||
= semantic_form_for(@room, :url => (@room.new_record? ? admin_conference_venue_rooms_path : admin_conference_venue_room_path(@conference.short_title, @room))) do |f|
|
||||
= f.input :name, input_html: { autofocus: true}
|
||||
= f.input :size, :input_html => {:size => 5}
|
||||
%p.text-right
|
||||
= f.action :submit, as: :button, button_html: { class: 'btn btn-primary' }
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
%p.text-muted
|
||||
The rooms of your conference venue
|
||||
|
||||
- if @conference.program.rooms.any?
|
||||
- if @rooms.any?
|
||||
.row
|
||||
.col-md-12
|
||||
%table.table.table-hover#rooms
|
||||
|
|
@ -14,18 +14,18 @@
|
|||
%th Size
|
||||
%th Actions
|
||||
%tbody
|
||||
- @conference.program.rooms.each_with_index do |room, index|
|
||||
- @rooms.each_with_index do |room, index|
|
||||
%tr
|
||||
%td
|
||||
= room.name
|
||||
%td
|
||||
= room.size
|
||||
%td
|
||||
= link_to 'Edit', edit_admin_conference_program_room_path(@conference.short_title, room.id),
|
||||
= link_to 'Edit', edit_admin_conference_venue_room_path(@conference.short_title, room.id),
|
||||
method: :get, class: 'btn btn-primary'
|
||||
= link_to 'Delete', admin_conference_program_room_path(@conference.short_title, room.id),
|
||||
= link_to 'Delete', admin_conference_venue_room_path(@conference.short_title, room.id),
|
||||
method: :delete, class: 'btn btn-danger',
|
||||
data: { confirm: "Do you really want to delete #{room.name}? Attention: This room will be removed from all Events that have it set"}
|
||||
.row
|
||||
.col-md-12.text-right
|
||||
= link_to 'Add Room', new_admin_conference_program_room_path(@conference.short_title), class: 'btn btn-primary'
|
||||
= link_to 'Add Room', new_admin_conference_venue_room_path(@conference.short_title), class: 'btn btn-primary'
|
||||
|
|
|
|||
|
|
@ -20,9 +20,12 @@
|
|||
= @venue.country_name
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'Edit Venue', edit_admin_conference_venue_path(@conference.short_title), class: 'btn btn-primary', disabled: !(can? :edit, @conference.venue)
|
||||
= link_to 'Delete Venue', admin_conference_venue_path(@conference.short_title), method: 'delete', class: 'btn btn-danger', disabled: !(can? :edit, @conference.venue)
|
||||
= link_to(edit_admin_conference_venue_path(@conference.short_title), class: 'btn btn-primary', disabled: !(can? :update, @venue) ) do
|
||||
Edit Venue
|
||||
= link_to(admin_conference_venue_path(@conference.short_title), method: 'delete', class: 'btn btn-danger', disabled: !(can? :destroy, @venue)) do
|
||||
Delete Venue
|
||||
-else
|
||||
.row
|
||||
.col-md-12.text-right
|
||||
= link_to 'Create Venue', new_admin_conference_venue_path(@conference.short_title), class: 'btn btn-primary', disabled: !(can? :edit, @conference.venue)
|
||||
= link_to(new_admin_conference_venue_path(@conference.short_title), class: 'btn btn-primary') do
|
||||
Create Venue
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@
|
|||
%span.fa.fa-road
|
||||
Venue
|
||||
%ul
|
||||
- if can? :update, @conference.program.rooms.build
|
||||
%li{:class=> active_nav_li(admin_conference_program_rooms_path(@conference.short_title))}
|
||||
= link_to 'Rooms', admin_conference_program_rooms_path(@conference.short_title)
|
||||
- if @conference.venue && @conference.venue.persisted? && (can? :update, @conference.venue.rooms.build)
|
||||
%li{:class=> active_nav_li(admin_conference_venue_rooms_path(@conference.short_title))}
|
||||
= link_to 'Rooms', admin_conference_venue_rooms_path(@conference.short_title)
|
||||
- if can? :update, @conference.lodgings.build
|
||||
%li{ class: active_nav_li(admin_conference_lodgings_path(@conference.short_title)) }
|
||||
= link_to 'Lodgings', admin_conference_lodgings_path(@conference.short_title)
|
||||
|
|
|
|||
|
|
@ -44,14 +44,15 @@ Osem::Application.routes.draw do
|
|||
|
||||
# Singletons
|
||||
resource :splashpage
|
||||
resource :venue
|
||||
resource :venue do
|
||||
resources :rooms, except: [:show]
|
||||
end
|
||||
resource :registration_period
|
||||
resource :program do
|
||||
resource :cfp
|
||||
resources :tracks
|
||||
resources :event_types
|
||||
resources :difficulty_levels
|
||||
resources :rooms, except: [:show]
|
||||
resources :events do
|
||||
member do
|
||||
post :comment
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class CreateProgramsTable< ActiveRecord::Migration
|
|||
t.integer :rating, default: 0
|
||||
t.boolean :schedule_public, default: false
|
||||
t.boolean :schedule_fluid, default: false
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_column :call_for_papers, :program_id, :integer
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class RenameConferenceIdToProgramIdInEventsRoomsTracksDifficultyLevels < ActiveRecord::Migration
|
||||
class RenameConferenceIdToProgramIdInEventsTracksDifficultyLevels < ActiveRecord::Migration
|
||||
class TempConference < ActiveRecord::Base
|
||||
self.table_name = 'conferences'
|
||||
end
|
||||
|
|
@ -19,10 +19,6 @@ class RenameConferenceIdToProgramIdInEventsRoomsTracksDifficultyLevels < ActiveR
|
|||
self.table_name = 'difficulty_levels'
|
||||
end
|
||||
|
||||
class TempRoom < ActiveRecord::Base
|
||||
self.table_name = 'rooms'
|
||||
end
|
||||
|
||||
class TempProgram < ActiveRecord::Base
|
||||
self.table_name = 'programs'
|
||||
end
|
||||
|
|
@ -32,7 +28,6 @@ class RenameConferenceIdToProgramIdInEventsRoomsTracksDifficultyLevels < ActiveR
|
|||
add_column :event_types, :program_id, :integer
|
||||
add_column :tracks, :program_id, :integer
|
||||
add_column :difficulty_levels, :program_id, :integer
|
||||
add_column :rooms, :program_id, :integer
|
||||
|
||||
TempConference.all.each do |conference|
|
||||
program = Program.find_by(conference_id: conference.id)
|
||||
|
|
@ -56,18 +51,12 @@ class RenameConferenceIdToProgramIdInEventsRoomsTracksDifficultyLevels < ActiveR
|
|||
difficulty_level.program_id = program.id
|
||||
difficulty_level.save!
|
||||
end
|
||||
|
||||
TempRoom.where(conference_id: conference.id).each do |room|
|
||||
room.program_id = program.id
|
||||
room.save!
|
||||
end
|
||||
end
|
||||
|
||||
remove_column :events, :conference_id
|
||||
remove_column :event_types, :conference_id
|
||||
remove_column :tracks, :conference_id
|
||||
remove_column :difficulty_levels, :conference_id
|
||||
remove_column :rooms, :conference_id
|
||||
end
|
||||
|
||||
def down
|
||||
|
|
@ -75,7 +64,6 @@ class RenameConferenceIdToProgramIdInEventsRoomsTracksDifficultyLevels < ActiveR
|
|||
add_column :event_types, :conference_id, :integer
|
||||
add_column :tracks, :conference_id, :integer
|
||||
add_column :difficulty_levels, :conference_id, :integer
|
||||
add_column :rooms, :conference_id, :integer
|
||||
|
||||
TempConference.all.each do |conference|
|
||||
program = TempProgram.find_by(conference_id: conference.id)
|
||||
|
|
@ -100,11 +88,6 @@ class RenameConferenceIdToProgramIdInEventsRoomsTracksDifficultyLevels < ActiveR
|
|||
difficulty_level.conference_id = conference.id
|
||||
difficulty_level.save!
|
||||
end
|
||||
|
||||
TempRoom.where(program_id: program.id).each do |room|
|
||||
room.conference_id = conference.id
|
||||
room.save!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -112,6 +95,5 @@ class RenameConferenceIdToProgramIdInEventsRoomsTracksDifficultyLevels < ActiveR
|
|||
remove_column :event_types, :program_id
|
||||
remove_column :tracks, :program_id
|
||||
remove_column :difficulty_levels, :program_id
|
||||
remove_column :rooms, :program_id
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
class ChangeConferenceIdToVenueIdInRooms < ActiveRecord::Migration
|
||||
class TempConference < ActiveRecord::Base
|
||||
self.table_name = 'conferences'
|
||||
|
||||
has_one :temp_venue
|
||||
end
|
||||
|
||||
class TempVenue < ActiveRecord::Base
|
||||
self.table_name = 'venues'
|
||||
|
||||
belongs_to :temp_conference
|
||||
has_many :temp_rooms
|
||||
end
|
||||
|
||||
class TempRoom < ActiveRecord::Base
|
||||
self.table_name = 'rooms'
|
||||
|
||||
belongs_to :temp_venue
|
||||
end
|
||||
|
||||
def up
|
||||
add_column :rooms, :venue_id, :integer, null: false
|
||||
|
||||
TempRoom.all.each do |room|
|
||||
venue = TempVenue.find_by(conference_id: room.conference_id)
|
||||
if venue
|
||||
room.venue_id = venue.id
|
||||
else
|
||||
test_venue = Venue.find_or_create_by!(conference_id: room.conference_id, name: 'test venue', street: 'test street', city: 'test city', country: 'test')
|
||||
room.venue_id = test_venue.id
|
||||
end
|
||||
room.save!
|
||||
end
|
||||
|
||||
remove_column :rooms, :conference_id
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :rooms, :conference_id, :integer, null: false
|
||||
|
||||
TempRoom.all.each do |room|
|
||||
venue = TempVenue.find(room.venue_id)
|
||||
conference = TempConference.find(venue.conference_id)
|
||||
|
||||
if conference
|
||||
room.conference_id = conference.id
|
||||
end
|
||||
|
||||
room.save!
|
||||
end
|
||||
|
||||
remove_column :rooms, :venue_id
|
||||
end
|
||||
end
|
||||
18
db/schema.rb
18
db/schema.rb
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20151021113015) do
|
||||
ActiveRecord::Schema.define(version: 20151031092713) do
|
||||
|
||||
create_table "ahoy_events", force: true do |t|
|
||||
t.uuid "visit_id"
|
||||
|
|
@ -274,10 +274,12 @@ ActiveRecord::Schema.define(version: 20151021113015) do
|
|||
end
|
||||
|
||||
create_table "programs", force: true do |t|
|
||||
t.integer "conference_id"
|
||||
t.integer "rating", default: 0
|
||||
t.boolean "schedule_public", default: false
|
||||
t.boolean "schedule_fluid", default: false
|
||||
t.integer "conference_id"
|
||||
t.integer "rating", default: 0
|
||||
t.boolean "schedule_public", default: false
|
||||
t.boolean "schedule_fluid", default: false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "qanswers", force: true do |t|
|
||||
|
|
@ -360,10 +362,10 @@ ActiveRecord::Schema.define(version: 20151021113015) do
|
|||
add_index "roles_users", ["user_id", "role_id"], name: "index_roles_users_on_user_id_and_role_id", using: :btree
|
||||
|
||||
create_table "rooms", force: true do |t|
|
||||
t.string "guid", null: false
|
||||
t.string "name", null: false
|
||||
t.string "guid", null: false
|
||||
t.string "name", null: false
|
||||
t.integer "size"
|
||||
t.integer "program_id"
|
||||
t.integer "venue_id", null: false
|
||||
end
|
||||
|
||||
create_table "social_events", force: true do |t|
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ var scheduleDayEvents = {};
|
|||
var Schedule = {
|
||||
loadEvents: function(conference_id, start_date) {
|
||||
var eventDates = {};
|
||||
var url = '/admin/conference/' + conference_id + '/events';
|
||||
var url = '/admin/conference/' + conference_id + '/program/events';
|
||||
var params = { start: $('#start').text(), end: $('#end').text()};
|
||||
var callback = function(data) {
|
||||
$.each(data, function(key, val) {
|
||||
|
|
|
|||
|
|
@ -7,22 +7,21 @@ FactoryGirl.define do
|
|||
timezone 'Amsterdam'
|
||||
start_date { Date.today }
|
||||
end_date { 6.days.from_now }
|
||||
program
|
||||
|
||||
factory :full_conference do
|
||||
venue
|
||||
splashpage
|
||||
registration_period
|
||||
|
||||
after(:build) do |conference|
|
||||
conference.commercials << build(:conference_commercial, commercialable: conference)
|
||||
conference.campaigns << build(:campaign, conference: conference)
|
||||
conference.targets << build(:target, conference: conference)
|
||||
conference.questions << build(:question, conference_id: conference.id)
|
||||
conference.lodgings << build(:lodging, conference: conference)
|
||||
conference.sponsors << build(:sponsor, conference: conference)
|
||||
conference.sponsorship_levels << build(:sponsorship_level, conference: conference)
|
||||
conference.tickets << build(:ticket, conference: conference)
|
||||
after :create do |conference|
|
||||
create(:venue, conference_id: conference.id)
|
||||
conference.commercials << create(:conference_commercial, commercialable: conference)
|
||||
conference.campaigns << create(:campaign, conference: conference)
|
||||
conference.targets << create(:target, conference: conference)
|
||||
conference.questions << create(:question, conference_id: conference.id)
|
||||
conference.lodgings << create(:lodging, conference: conference)
|
||||
conference.sponsors << create(:sponsor, conference: conference)
|
||||
conference.sponsorship_levels << create(:sponsorship_level, conference: conference)
|
||||
conference.tickets << create(:ticket, conference: conference)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -46,7 +46,10 @@ FactoryGirl.define do
|
|||
event.commercials << build(:event_commercial, commercialable: event)
|
||||
event.difficulty_level = build(:difficulty_level, program: event.program)
|
||||
event.track = build(:track, program: event.program)
|
||||
event.room = build(:room, program: event.program)
|
||||
unless (venue = event.program.conference.venue)
|
||||
venue = create(:venue, conference: event.program.conference)
|
||||
end
|
||||
event.room = build(:room, venue: venue)
|
||||
event.comment_threads << build(:comment, commentable: event)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,6 +4,6 @@ FactoryGirl.define do
|
|||
factory :program do
|
||||
schedule_public false
|
||||
schedule_fluid false
|
||||
# conference
|
||||
conference
|
||||
end
|
||||
end
|
||||
|
|
@ -3,7 +3,7 @@ FactoryGirl.define do
|
|||
factory :room do
|
||||
name 'Example Room'
|
||||
size 4
|
||||
program
|
||||
venue
|
||||
|
||||
factory :room_for_100 do
|
||||
name 'Room for 100'
|
||||
|
|
|
|||
|
|
@ -8,5 +8,6 @@ FactoryGirl.define do
|
|||
country 'DE'
|
||||
website 'www.opensuse.org'
|
||||
description 'Lorem Ipsum Dolor'
|
||||
conference
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ require 'spec_helper'
|
|||
|
||||
feature 'Has correct abilities' do
|
||||
# It is necessary to use bang version of let to build roles before user
|
||||
let(:conference1) { create(:conference) } # user is organizer
|
||||
let(:conference2) { create(:conference) } # user is cfp
|
||||
let(:conference3) { create(:conference) } # user is info_desk
|
||||
let(:conference4) { create(:conference) } # user is volunteer coordinator
|
||||
let(:conference5) { create(:conference) } # user has no role
|
||||
let(:conference1) { create(:full_conference) } # user is organizer
|
||||
let(:conference2) { create(:full_conference) } # user is cfp
|
||||
let(:conference3) { create(:full_conference) } # user is info_desk
|
||||
let(:conference4) { create(:full_conference) } # user is volunteer coordinator
|
||||
let(:conference5) { create(:full_conference) } # user has no role
|
||||
|
||||
let(:role_organizer) { create(:role, name: 'organizer', resource: conference1) }
|
||||
let(:role_cfp) { create(:role, name: 'cfp', resource: conference2) }
|
||||
|
|
@ -43,7 +43,7 @@ feature 'Has correct abilities' do
|
|||
expect(page).to have_link('Campaigns', href: "/admin/conference/#{conference1.short_title}/campaigns")
|
||||
expect(page).to have_link('Goals', href: "/admin/conference/#{conference1.short_title}/targets")
|
||||
expect(page).to have_link('Venue', href: "/admin/conference/#{conference1.short_title}/venue")
|
||||
expect(page).to have_link('Rooms', href: "/admin/conference/#{conference1.short_title}/program/rooms")
|
||||
expect(page).to have_link('Rooms', href: "/admin/conference/#{conference1.short_title}/venue/rooms")
|
||||
expect(page).to have_link('Lodgings', href: "/admin/conference/#{conference1.short_title}/lodgings")
|
||||
expect(page).to have_link('Sponsorship', href: "/admin/conference/#{conference1.short_title}/sponsorship_levels")
|
||||
expect(page).to have_link('Sponsors', href: "/admin/conference/#{conference1.short_title}/sponsors")
|
||||
|
|
@ -120,7 +120,7 @@ feature 'Has correct abilities' do
|
|||
expect(page).to_not have_link('Campaigns', href: "/admin/conference/#{conference2.short_title}/campaigns")
|
||||
expect(page).to_not have_link('Goals', href: "/admin/conference/#{conference2.short_title}/targets")
|
||||
expect(page).to have_link('Venue', href: "/admin/conference/#{conference2.short_title}/venue")
|
||||
expect(page).to have_link('Rooms', href: "/admin/conference/#{conference2.short_title}/program/rooms")
|
||||
expect(page).to have_link('Rooms', href: "/admin/conference/#{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('Sponsorship', href: "/admin/conference/#{conference2.short_title}/sponsorship_levels")
|
||||
expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference2.short_title}/sponsors")
|
||||
|
|
@ -193,7 +193,7 @@ feature 'Has correct abilities' do
|
|||
expect(page).to_not have_link('Campaigns', href: "/admin/conference/#{conference3.short_title}/campaigns")
|
||||
expect(page).to_not have_link('Targets', href: "/admin/conference/#{conference3.short_title}/targets")
|
||||
expect(page).to_not have_link('Venue', href: "/admin/conference/#{conference3.short_title}/venue")
|
||||
expect(page).to_not have_link('Rooms', href: "/admin/conference/#{conference3.short_title}/program/rooms")
|
||||
expect(page).to_not have_link('Rooms', href: "/admin/conference/#{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('Sponsorship', href: "/admin/conference/#{conference3.short_title}/sponsorship_levels")
|
||||
expect(page).to_not have_link('Sponsors', href: "/admin/conference/#{conference3.short_title}/sponsors")
|
||||
|
|
|
|||
|
|
@ -2,13 +2,14 @@ require 'spec_helper'
|
|||
|
||||
feature Room do
|
||||
let!(:conference) { create(:conference) }
|
||||
let!(:venue) { create(:venue, conference: conference) }
|
||||
let!(:organizer_role) { create(:organizer_role, resource: conference) }
|
||||
let!(:organizer) { create(:user, role_ids: [organizer_role.id]) }
|
||||
|
||||
shared_examples 'rooms' do
|
||||
scenario 'adds a room', feature: true, js: true do
|
||||
sign_in organizer
|
||||
visit admin_conference_program_rooms_path(
|
||||
visit admin_conference_venue_rooms_path(
|
||||
conference_id: conference.short_title)
|
||||
|
||||
expect(page.has_no_table?('#rooms')).to be true
|
||||
|
|
@ -30,9 +31,9 @@ feature Room do
|
|||
end
|
||||
|
||||
scenario 'updates a room', feature: true, js: true do
|
||||
room = create(:room, program_id: conference.program.id)
|
||||
room = create(:room, venue: venue)
|
||||
sign_in organizer
|
||||
visit edit_admin_conference_program_room_path(
|
||||
visit edit_admin_conference_venue_room_path(
|
||||
conference_id: conference.short_title, id: room.id)
|
||||
|
||||
fill_in 'room_name', with: 'Auditorium'
|
||||
|
|
|
|||
|
|
@ -10,6 +10,17 @@ describe 'User' do
|
|||
subject(:ability){ Ability.new(user) }
|
||||
let(:user){ nil }
|
||||
|
||||
let!(:my_conference) { create(:full_conference) }
|
||||
let!(:my_cfp) { create(:cfp, program: my_conference.program) }
|
||||
let(:my_venue) { my_conference.venue || create(:venue, conference: my_conference) }
|
||||
let(:my_registration) { create(:registration, conference: my_conference, user: first_user) }
|
||||
|
||||
let(:other_registration) { create(:registration, conference: conference_public) }
|
||||
let(:my_event) { create(:event_full, program: my_conference.program) }
|
||||
let(:my_room) { create(:room, venue: my_conference.venue) }
|
||||
let!(:my_event_scheduled) { create(:event_full, program: my_conference.program, room_id: my_room.id) }
|
||||
let(:other_event) { create(:event_full, program: conference_public.program) }
|
||||
|
||||
let(:conference_not_public) { create(:conference, splashpage: create(:splashpage, public: false)) }
|
||||
let(:conference_public) { create(:full_conference, splashpage: create(:splashpage, public: true)) }
|
||||
let!(:conference_public_cfp) { create(:cfp, program: conference_public.program) }
|
||||
|
|
@ -62,10 +73,8 @@ describe 'User' do
|
|||
let(:registration_public) { create(:registration, conference: conference_public, user: user) }
|
||||
let(:registration_not_public) { create(:registration, conference: conference_not_public, user: user) }
|
||||
|
||||
let(:my_event) { create(:event, users: [user]) }
|
||||
|
||||
let(:commercial) { create(:commercial, commercialable: event_unconfirmed) }
|
||||
let(:my_commercial) { create(:commercial, commercialable: my_event) }
|
||||
let(:user_event) { create(:event, users: [user]) }
|
||||
let(:user_commercial) { create(:commercial, commercialable: user_event) }
|
||||
|
||||
it{ should be_able_to(:manage, user) }
|
||||
|
||||
|
|
@ -79,28 +88,39 @@ describe 'User' do
|
|||
it{ should be_able_to(:destroy, subscription) }
|
||||
|
||||
it{ should be_able_to(:create, Event) }
|
||||
it{ should be_able_to(:manage, my_event) }
|
||||
it{ should be_able_to(:manage, user_event) }
|
||||
it{ should_not be_able_to(:manage, event_unconfirmed) }
|
||||
|
||||
it{ should be_able_to(:create, my_event.commercials.new) }
|
||||
it{ should be_able_to(:manage, my_commercial) }
|
||||
it{ should_not be_able_to(:manage, commercial) }
|
||||
it{ should be_able_to(:create, user_event.commercials.new) }
|
||||
it{ should be_able_to(:manage, user_commercial) }
|
||||
it{ should_not be_able_to(:manage, commercial_event_unconfirmed) }
|
||||
end
|
||||
|
||||
context 'user #is_admin?' do
|
||||
let(:venue) { my_conference.venue }
|
||||
let(:room) { create(:room, venue: venue) }
|
||||
let!(:event) { create(:event_full, program: my_conference.program, room_id: room.id) }
|
||||
let(:user) { create(:admin) }
|
||||
it{ should be_able_to(:manage, :all) }
|
||||
it{ should_not be_able_to(:destroy, my_conference.program) }
|
||||
it{ should_not be_able_to(:destroy, my_venue) }
|
||||
end
|
||||
|
||||
context 'when user has the role organizer' do
|
||||
let!(:my_conference) { create(:full_conference) }
|
||||
let!(:my_cfp) { create(:cfp, program: my_conference.program) }
|
||||
let(:role) { create(:organizer_role, resource: my_conference) }
|
||||
let(:user) { create(:user, role_ids: [role.id], is_admin: false) }
|
||||
let(:registration) { create(:registration, conference: my_conference) }
|
||||
let(:other_registration) { create(:registration, conference: conference_public) }
|
||||
let(:event) { create(:event_full, program: my_conference.program) }
|
||||
let(:other_event) { create(:event_full, program: conference_public.program) }
|
||||
|
||||
it{ should_not be_able_to(:destroy, my_conference.program) }
|
||||
it 'when there is a room assigned to an event' do
|
||||
should_not be_able_to(:destroy, my_venue)
|
||||
end
|
||||
|
||||
it 'when there are no rooms used' do
|
||||
my_event_scheduled.room_id = nil
|
||||
my_event_scheduled.save!
|
||||
my_event_scheduled.reload
|
||||
should be_able_to(:destroy, my_venue)
|
||||
end
|
||||
|
||||
it{ should be_able_to([:create, :new], Conference) }
|
||||
it{ should be_able_to(:manage, my_conference) }
|
||||
|
|
@ -134,32 +154,26 @@ describe 'User' do
|
|||
it{ should be_able_to(:manage, my_conference.tickets.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.tickets.first) }
|
||||
|
||||
it{ should be_able_to(:manage, registration) }
|
||||
it{ should be_able_to(:manage, my_registration) }
|
||||
it{ should_not be_able_to(:manage, other_registration) }
|
||||
|
||||
it{ should be_able_to(:manage, event) }
|
||||
it{ should be_able_to(:manage, my_event) }
|
||||
it{ should_not be_able_to(:manage, other_event) }
|
||||
it{ should be_able_to(:manage, event.event_type) }
|
||||
it{ should be_able_to(:manage, my_event.event_type) }
|
||||
it{ should_not be_able_to(:manage, other_event.event_type) }
|
||||
it{ should be_able_to(:manage, event.track) }
|
||||
it{ should be_able_to(:manage, my_event.track) }
|
||||
it{ should_not be_able_to(:manage, other_event.track) }
|
||||
it{ should be_able_to(:manage, event.difficulty_level) }
|
||||
it{ should be_able_to(:manage, my_event.difficulty_level) }
|
||||
it{ should_not be_able_to(:manage, other_event.difficulty_level) }
|
||||
it{ should be_able_to(:manage, event.commercials.first) }
|
||||
it{ should be_able_to(:manage, my_event.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, other_event.commercials.first) }
|
||||
it{ should be_able_to(:index, event.comment_threads.first) }
|
||||
it{ should be_able_to(:index, my_event.comment_threads.first) }
|
||||
it{ should_not be_able_to(:index, other_event.comment_threads.first) }
|
||||
end
|
||||
|
||||
context 'when user has the role cfp' do
|
||||
let!(:my_conference) { create(:full_conference) }
|
||||
let!(:my_cfp) { create(:cfp, program: my_conference.program) }
|
||||
let(:role) { create(:cfp_role, resource: my_conference) }
|
||||
let(:user) { create(:user, role_ids: [role.id], is_admin: false) }
|
||||
let(:registration) { create(:registration, conference: my_conference) }
|
||||
let(:other_registration) { create(:registration, conference: conference_public) }
|
||||
let(:event) { create(:event_full, program: my_conference.program) }
|
||||
let(:other_event) { create(:event_full, program: conference_public.program) }
|
||||
|
||||
it{ should_not be_able_to([:create, :new], Conference.new) }
|
||||
it{ should_not be_able_to(:manage, my_conference) }
|
||||
|
|
@ -194,32 +208,26 @@ describe 'User' do
|
|||
it{ should_not be_able_to(:manage, my_conference.tickets.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.tickets.first) }
|
||||
|
||||
it{ should_not be_able_to(:manage, registration) }
|
||||
it{ should_not be_able_to(:manage, my_registration) }
|
||||
it{ should_not be_able_to(:manage, other_registration) }
|
||||
|
||||
it{ should be_able_to(:manage, event) }
|
||||
it{ should be_able_to(:manage, my_event) }
|
||||
it{ should_not be_able_to(:manage, other_event) }
|
||||
it{ should be_able_to(:manage, event.event_type) }
|
||||
it{ should be_able_to(:manage, my_event.event_type) }
|
||||
it{ should_not be_able_to(:manage, other_event.event_type) }
|
||||
it{ should be_able_to(:manage, event.track) }
|
||||
it{ should be_able_to(:manage, my_event.track) }
|
||||
it{ should_not be_able_to(:manage, other_event.track) }
|
||||
it{ should be_able_to(:manage, event.difficulty_level) }
|
||||
it{ should be_able_to(:manage, my_event.difficulty_level) }
|
||||
it{ should_not be_able_to(:manage, other_event.difficulty_level) }
|
||||
it{ should be_able_to(:manage, event.commercials.first) }
|
||||
it{ should be_able_to(:manage, my_event.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, other_event.commercials.first) }
|
||||
it{ should be_able_to(:index, event.comment_threads.first) }
|
||||
it{ should be_able_to(:index, my_event.comment_threads.first) }
|
||||
it{ should_not be_able_to(:index, other_event.comment_threads.first) }
|
||||
end
|
||||
|
||||
context 'when user has the role info_desk' do
|
||||
let!(:my_conference) { create(:full_conference) }
|
||||
let!(:my_cfp) { create(:cfp, program: my_conference.program) }
|
||||
let(:role) { create(:info_desk_role, resource: my_conference) }
|
||||
let(:user) { create(:user, role_ids: [role.id], is_admin: false) }
|
||||
let(:registration) { create(:registration, conference: my_conference) }
|
||||
let(:other_registration) { create(:registration, conference: conference_public) }
|
||||
let(:event) { create(:event_full, program: my_conference.program) }
|
||||
let(:other_event) { create(:event_full, program: conference_public.program) }
|
||||
|
||||
it{ should_not be_able_to([:create, :new], Conference.new) }
|
||||
it{ should_not be_able_to(:manage, my_conference) }
|
||||
|
|
@ -254,32 +262,26 @@ describe 'User' do
|
|||
it{ should_not be_able_to(:manage, my_conference.tickets.first) }
|
||||
it{ should_not be_able_to(:manage, conference_public.tickets.first) }
|
||||
|
||||
it{ should be_able_to(:manage, registration) }
|
||||
it{ should be_able_to(:manage, my_registration) }
|
||||
it{ should_not be_able_to(:manage, other_registration) }
|
||||
|
||||
it{ should_not be_able_to(:manage, event) }
|
||||
it{ should_not be_able_to(:manage, my_event) }
|
||||
it{ should_not be_able_to(:manage, other_event) }
|
||||
it{ should_not be_able_to(:manage, event.event_type) }
|
||||
it{ should_not be_able_to(:manage, my_event.event_type) }
|
||||
it{ should_not be_able_to(:manage, other_event.event_type) }
|
||||
it{ should_not be_able_to(:manage, event.track) }
|
||||
it{ should_not be_able_to(:manage, my_event.track) }
|
||||
it{ should_not be_able_to(:manage, other_event.track) }
|
||||
it{ should_not be_able_to(:manage, event.difficulty_level) }
|
||||
it{ should_not be_able_to(:manage, my_event.difficulty_level) }
|
||||
it{ should_not be_able_to(:manage, other_event.difficulty_level) }
|
||||
it{ should_not be_able_to(:manage, event.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, my_event.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, other_event.commercials.first) }
|
||||
it{ should_not be_able_to(:index, event.comment_threads.first) }
|
||||
it{ should_not be_able_to(:index, my_event.comment_threads.first) }
|
||||
it{ should_not be_able_to(:index, other_event.comment_threads.first) }
|
||||
end
|
||||
|
||||
context 'when user has the role volunteers_coordinator' do
|
||||
let!(:my_conference) { create(:full_conference) }
|
||||
let!(:my_cfp) { create(:cfp, program: my_conference.program) }
|
||||
let(:role) { create(:volunteers_coordinator_role, resource: my_conference) }
|
||||
let(:user) { create(:user, role_ids: [role.id], is_admin: false) }
|
||||
let(:registration) { create(:registration, conference: my_conference) }
|
||||
let(:other_registration) { create(:registration, conference: conference_public) }
|
||||
let(:event) { create(:event_full, program: my_conference.program) }
|
||||
let(:other_event) { create(:event_full, program: conference_public.program) }
|
||||
|
||||
it{ should_not be_able_to([:create, :new], Conference.new) }
|
||||
it{ should_not be_able_to(:manage, my_conference) }
|
||||
|
|
@ -317,17 +319,17 @@ describe 'User' do
|
|||
it{ should_not be_able_to(:manage, registration) }
|
||||
it{ should_not be_able_to(:manage, other_registration) }
|
||||
|
||||
it{ should_not be_able_to(:manage, event) }
|
||||
it{ should_not be_able_to(:manage, my_event) }
|
||||
it{ should_not be_able_to(:manage, other_event) }
|
||||
it{ should_not be_able_to(:manage, event.event_type) }
|
||||
it{ should_not be_able_to(:manage, my_event.event_type) }
|
||||
it{ should_not be_able_to(:manage, other_event.event_type) }
|
||||
it{ should_not be_able_to(:manage, event.track) }
|
||||
it{ should_not be_able_to(:manage, my_event.track) }
|
||||
it{ should_not be_able_to(:manage, other_event.track) }
|
||||
it{ should_not be_able_to(:manage, event.difficulty_level) }
|
||||
it{ should_not be_able_to(:manage, my_event.difficulty_level) }
|
||||
it{ should_not be_able_to(:manage, other_event.difficulty_level) }
|
||||
it{ should_not be_able_to(:manage, event.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, my_event.commercials.first) }
|
||||
it{ should_not be_able_to(:manage, other_event.commercials.first) }
|
||||
it{ should_not be_able_to(:index, event.comment_threads.first) }
|
||||
it{ should_not be_able_to(:index, my_event.comment_threads.first) }
|
||||
it{ should_not be_able_to(:index, other_event.comment_threads.first) }
|
||||
it 'should be_able to :manage Vposition'
|
||||
it 'should be_able to :manage Vday'
|
||||
|
|
|
|||
|
|
@ -972,7 +972,6 @@ describe Conference do
|
|||
it 'calculates correct for new conference' do
|
||||
subject.program.cfp = nil
|
||||
subject.venue = nil
|
||||
subject.program.rooms = []
|
||||
subject.program.tracks = []
|
||||
subject.program.event_types = []
|
||||
subject.program.difficulty_levels = []
|
||||
|
|
@ -1005,7 +1004,6 @@ describe Conference do
|
|||
end_date: Date.today + 14)
|
||||
subject.program.cfp = create(:cfp)
|
||||
subject.venue = nil
|
||||
subject.program.rooms = []
|
||||
subject.program.tracks = []
|
||||
subject.program.event_types = []
|
||||
subject.program.difficulty_levels = []
|
||||
|
|
@ -1023,8 +1021,8 @@ describe Conference do
|
|||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.program.cfp = create(:cfp)
|
||||
subject.venue = create(:venue)
|
||||
subject.program.rooms = []
|
||||
subject.venue = create(:venue, conference: subject)
|
||||
subject.venue.rooms = []
|
||||
subject.program.tracks = []
|
||||
subject.program.event_types = []
|
||||
subject.program.difficulty_levels = []
|
||||
|
|
@ -1039,12 +1037,12 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'calculates correct for conference with registration, cfp, venue, rooms' do
|
||||
subject.program.rooms = [create(:room)]
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.program.cfp = create(:cfp)
|
||||
subject.venue = create(:venue)
|
||||
subject.venue = create(:venue, conference: subject)
|
||||
subject.venue.rooms = [create(:room, venue: subject.venue)]
|
||||
subject.program.tracks = []
|
||||
subject.program.event_types = []
|
||||
subject.program.difficulty_levels = []
|
||||
|
|
@ -1060,13 +1058,13 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'calculates correct for conference with registration, cfp, venue, rooms, tracks' do
|
||||
subject.program.rooms = [create(:room)]
|
||||
subject.venue = create(:venue, conference: subject)
|
||||
subject.venue.rooms = [create(:room, venue: subject.venue)]
|
||||
subject.program.tracks = [create(:track)]
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.program.cfp = create(:cfp)
|
||||
subject.venue = create(:venue)
|
||||
subject.program.event_types = []
|
||||
subject.program.difficulty_levels = []
|
||||
subject.splashpage = create(:splashpage, public: false)
|
||||
|
|
@ -1083,14 +1081,14 @@ describe Conference do
|
|||
|
||||
it 'calculates correct for conference with registration, cfp,
|
||||
venue, rooms, tracks, event_types' do
|
||||
subject.program.rooms = [create(:room)]
|
||||
subject.program.tracks = [create(:track)]
|
||||
subject.program.event_types = [create(:event_type)]
|
||||
subject.registration_period = create(:registration_period,
|
||||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.program.cfp = create(:cfp)
|
||||
subject.venue = create(:venue)
|
||||
subject.venue = create(:venue, conference: subject)
|
||||
subject.venue.rooms = [create(:room, venue: subject.venue)]
|
||||
subject.program.difficulty_levels = []
|
||||
subject.splashpage = create(:splashpage, public: false)
|
||||
|
||||
|
|
@ -1106,7 +1104,6 @@ describe Conference do
|
|||
end
|
||||
|
||||
it 'calculates correct for conference with all mandatory options' do
|
||||
subject.program.rooms = [create(:room)]
|
||||
subject.program.tracks = [create(:track)]
|
||||
subject.program.event_types = [create(:event_type)]
|
||||
subject.program.difficulty_levels = [create(:difficulty_level)]
|
||||
|
|
@ -1114,7 +1111,8 @@ describe Conference do
|
|||
start_date: Date.today,
|
||||
end_date: Date.today + 14)
|
||||
subject.program.cfp = create(:cfp)
|
||||
subject.venue = create(:venue)
|
||||
subject.venue = create(:venue, conference: subject)
|
||||
subject.venue.rooms = [create(:room, venue: subject.venue)]
|
||||
subject.splashpage = create(:splashpage, public: true)
|
||||
|
||||
expect(subject.get_status).to eq(@result)
|
||||
|
|
|
|||
|
|
@ -4,8 +4,10 @@ describe 'admin/rooms/index' do
|
|||
|
||||
it 'renders rooms list' do
|
||||
conference = create(:conference)
|
||||
create(:room, name: 'Example Room', size: 4, program: conference.program)
|
||||
venue = create(:venue, conference: conference)
|
||||
room = create(:room, name: 'Example Room', size: 4, venue: venue)
|
||||
assign :conference, conference
|
||||
assign :rooms, [room]
|
||||
render
|
||||
expect(rendered).to include('Example Room')
|
||||
expect(rendered).to include('4')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue