2018-05-07 16:47:29 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2017-05-31 18:42:52 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
|
|
describe OrganizationsController do
|
|
|
|
|
let!(:organization) { create(:organization) }
|
2017-10-11 20:22:32 -07:00
|
|
|
let!(:conference) do
|
|
|
|
|
create(
|
|
|
|
|
:conference,
|
|
|
|
|
splashpage: create(:splashpage, public: true),
|
|
|
|
|
venue: create(:venue),
|
|
|
|
|
organization: organization
|
|
|
|
|
)
|
|
|
|
|
end
|
|
|
|
|
let!(:antiquated_conference) do
|
|
|
|
|
create(
|
|
|
|
|
:conference,
|
|
|
|
|
splashpage: create(:splashpage, public: true),
|
|
|
|
|
venue: create(:venue),
|
|
|
|
|
organization: organization,
|
|
|
|
|
start_date: 2.weeks.ago,
|
|
|
|
|
end_date: 1.week.ago
|
|
|
|
|
)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
let!(:other_conference) { create(:conference) }
|
2017-06-06 20:04:39 +05:30
|
|
|
let!(:user) { create(:user) }
|
2017-05-31 18:42:52 +05:30
|
|
|
|
|
|
|
|
describe 'GET #index' do
|
|
|
|
|
before :each do
|
2017-06-06 20:04:39 +05:30
|
|
|
sign_in user
|
2017-05-31 18:42:52 +05:30
|
|
|
get :index
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it { expect(response).to render_template('index') }
|
|
|
|
|
end
|
2017-10-11 20:22:32 -07:00
|
|
|
|
|
|
|
|
describe 'GET #conferences' do
|
|
|
|
|
before :each do
|
2019-05-13 17:42:09 +02:00
|
|
|
get :conferences, params: { id: organization.id }
|
2017-10-11 20:22:32 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'loads the organization' do
|
|
|
|
|
expect(assigns(:organization)).to eq organization
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'includes organization conferences' do
|
|
|
|
|
expect(assigns(:current)).to include conference
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'does not include conferences outside organization' do
|
|
|
|
|
expect(assigns(:current)).not_to include other_conference
|
|
|
|
|
expect(assigns(:antiquated)).not_to include other_conference
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it 'includes antiquated organization conferences' do
|
|
|
|
|
expect(assigns(:antiquated)).to include antiquated_conference
|
|
|
|
|
end
|
|
|
|
|
end
|
2017-05-31 18:42:52 +05:30
|
|
|
end
|