Merge branch 'master' into move-ability-namespace
This commit is contained in:
commit
3e396f7070
35 changed files with 404 additions and 70 deletions
|
|
@ -46,6 +46,7 @@ feature 'Has correct abilities' do
|
|||
expect(page).to_not have_link('Goals', href: "/admin/conferences/#{conference.short_title}/targets")
|
||||
expect(page).to have_link('Roles', href: "/admin/conferences/#{conference.short_title}/roles")
|
||||
expect(page).to have_link('Resources', href: "/admin/conferences/#{conference.short_title}/resources")
|
||||
expect(page).to_not have_link('New Conference', href: '/admin/conferences/new')
|
||||
|
||||
visit admin_conference_venue_rooms_path(conference.short_title)
|
||||
expect(current_path).to eq(admin_conference_venue_rooms_path(conference.short_title))
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ feature 'Has correct abilities' do
|
|||
expect(page).to have_link('Registrations', href: "/admin/conferences/#{conference.short_title}/registrations")
|
||||
expect(page).to have_link('Questions', href: "/admin/conferences/#{conference.short_title}/questions")
|
||||
expect(page).to_not have_link('E-Mails', href: "/admin/conferences/#{conference.short_title}/emails")
|
||||
expect(page).to_not have_link('New Conference', href: '/admin/conferences/new')
|
||||
|
||||
visit admin_organizations_path
|
||||
expect(current_path).to eq(admin_organizations_path)
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ feature 'Has correct abilities' do
|
|||
expect(page).to have_link('E-Mails', href: "/admin/conferences/#{conference.short_title}/emails")
|
||||
expect(page).to have_link('Roles', href: "/admin/conferences/#{conference.short_title}/roles")
|
||||
expect(page).to have_link('Resources', href: "/admin/conferences/#{conference.short_title}/resources")
|
||||
expect(page).to have_link('New Conference', href: '/admin/conferences/new')
|
||||
|
||||
visit edit_admin_conference_path(conference.short_title)
|
||||
expect(current_path).to eq(edit_admin_conference_path(conference.short_title))
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ feature 'Has correct abilities' do
|
|||
expect(page).to have_link('E-Mails', href: "/admin/conferences/#{conference.short_title}/emails")
|
||||
expect(page).to have_link('Roles', href: "/admin/conferences/#{conference.short_title}/roles")
|
||||
expect(page).to have_link('Resources', href: "/admin/conferences/#{conference.short_title}/resources")
|
||||
expect(page).to_not have_link('New Conference', href: '/admin/conferences/new')
|
||||
|
||||
visit admin_conference_path(other_conference.short_title)
|
||||
expect(page).to have_link('Add venue', href: "/admin/conferences/#{other_conference.short_title}/venue/new")
|
||||
|
|
|
|||
|
|
@ -1660,4 +1660,48 @@ describe Conference do
|
|||
expect{ conference.save }.to change{ EventSchedule.count }.from(2).to(1)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#revision' do
|
||||
let(:track) { create(:track, program: subject.program) }
|
||||
let(:event) { create(:event, program: subject.program, track: track) }
|
||||
let(:venue) { create(:venue, conference: subject) }
|
||||
let(:room) { create(:room, venue: venue) }
|
||||
|
||||
it 'for change in conference' do
|
||||
subject.title = 'changed'
|
||||
expect{ subject.save }.to change { subject.revision }.by(1)
|
||||
end
|
||||
|
||||
it 'for change in event' do
|
||||
event.title = 'changed'
|
||||
expect{ event.save }.to change { subject.revision }.by(1)
|
||||
end
|
||||
|
||||
it 'for change in track' do
|
||||
track.name = 'changed'
|
||||
expect{ track.save }.to change { subject.revision }.by(1)
|
||||
end
|
||||
|
||||
it 'for change in room' do
|
||||
room.name = 'changed'
|
||||
expect{ room.save }.to change { subject.revision }.by(1)
|
||||
end
|
||||
end
|
||||
|
||||
describe '.upcoming' do
|
||||
let!(:upcoming_conference) { create(:conference) }
|
||||
let!(:past_conference) { create(:conference, start_date: Date.current - 1.days, end_date: Date.current - 1.days) }
|
||||
subject { Conference.upcoming }
|
||||
|
||||
it { is_expected.to eq [upcoming_conference] }
|
||||
end
|
||||
|
||||
describe '.past' do
|
||||
let!(:upcoming_conference) { create(:conference) }
|
||||
let!(:past_conference1) { create(:conference, start_date: Date.current - 1.days, end_date: Date.current - 1.days) }
|
||||
let!(:past_conference2) { create(:conference, start_date: Date.current - 2.days, end_date: Date.current - 1.days) }
|
||||
subject { Conference.past }
|
||||
|
||||
it { is_expected.to eq [past_conference1, past_conference2] }
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -98,6 +98,29 @@ describe Event do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#comments_count' do
|
||||
context 'has a valid counter cache' do
|
||||
before do
|
||||
create(:comment, commentable: event)
|
||||
end
|
||||
|
||||
it 'successfully increments comments_count' do
|
||||
expected = expect do
|
||||
create(:comment, commentable: event)
|
||||
end
|
||||
expected.to change { event.comments_count }.by(1)
|
||||
end
|
||||
|
||||
it 'successfully decrements comments_count' do
|
||||
expected = expect do
|
||||
event.comment_threads.last.destroy
|
||||
event.reload
|
||||
end
|
||||
expected.to change { event.comments_count }.by(-1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'scope ' do
|
||||
context 'confirmed' do
|
||||
it 'returns only confirmed events' do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue