Merge master tidy routes
This commit is contained in:
commit
de8b06c4b3
120 changed files with 1321 additions and 1293 deletions
|
|
@ -39,6 +39,34 @@
|
|||
# !/bin/env ruby
|
||||
require 'spec_helper'
|
||||
|
||||
context 'Delegation' do
|
||||
subject do
|
||||
FactoryBot.create(:conference, start_date: 1.month.from_now, end_date: 2.month.from_now)
|
||||
end
|
||||
|
||||
context 'Venue' do
|
||||
context 'when venue has not been set' do
|
||||
it 'the accessors should be nil' do
|
||||
expect(subject.city).to eq(nil)
|
||||
expect(subject.country_name).to eq(nil)
|
||||
expect(subject.venue_name).to eq(nil)
|
||||
expect(subject.venue_street).to eq(nil)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when venue has been set' do
|
||||
it 'should delegate to venue' do
|
||||
venue = FactoryBot.create(:venue)
|
||||
subject.update(venue: venue)
|
||||
expect(subject.city).to eq(venue.city)
|
||||
expect(subject.country_name).to eq(venue.country_name)
|
||||
expect(subject.venue_name).to eq(venue.name)
|
||||
expect(subject.venue_street).to eq(venue.street)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe Conference do
|
||||
|
||||
let(:subject) { create(:conference, start_date: Date.new(2014, 06, 30), end_date: Date.new(2014, 06, 30)) }
|
||||
|
|
|
|||
|
|
@ -117,20 +117,6 @@ describe Event do
|
|||
event.event_type.minimum_abstract_length = 2
|
||||
end
|
||||
|
||||
context 'is invalid' do
|
||||
it 'when submission text is too long' do
|
||||
event.submission_text = 'four too many words'
|
||||
expect(event.valid?).to eq false
|
||||
expect(event.errors[:submission_text]).to eq ['cannot have more than 3 words']
|
||||
end
|
||||
|
||||
it 'when submission text is too short' do
|
||||
event.submission_text = 'word'
|
||||
expect(event.valid?).to eq false
|
||||
expect(event.errors[:submission_text]).to eq ['cannot have less than 2 words']
|
||||
end
|
||||
end
|
||||
|
||||
context 'is valid' do
|
||||
it 'when submission text is within limts' do
|
||||
event.abstract = 'the magic three'
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
# length :integer default(30)
|
||||
# maximum_abstract_length :integer default(500)
|
||||
# minimum_abstract_length :integer default(0)
|
||||
# submission_instructions :text
|
||||
# title :string not null
|
||||
# created_at :datetime
|
||||
# updated_at :datetime
|
||||
|
|
|
|||
|
|
@ -441,6 +441,19 @@ describe User do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#count_registration_tickets' do
|
||||
let(:registration_ticket) { create(:registration_ticket, price_cents: 0) }
|
||||
let(:conference3) { create(:conference, short_title: 'oSC17', title: 'openSUSE Conference 2017', tickets: [registration_ticket]) }
|
||||
let(:ticket_purchase) { create(:ticket_purchase, user: user, conference: conference3, ticket: registration_ticket, quantity: 1) }
|
||||
|
||||
it 'counts the number of registration tickets of a conference held by user' do
|
||||
user.ticket_purchases << ticket_purchase
|
||||
|
||||
expect(user.count_registration_tickets(conference3)).to eq(1)
|
||||
expect(user.count_registration_tickets(conference2)).to eq(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'rolify' do
|
||||
|
|
@ -480,7 +493,7 @@ describe User do
|
|||
end
|
||||
|
||||
describe 'assigns admin attribute' do
|
||||
it 'to second user when first user is deleted_user' do
|
||||
xit 'to second user when first user is deleted_user' do
|
||||
deleted_user = User.find_by(email: 'deleted@localhost.osem')
|
||||
expect(deleted_user.is_admin).to be false
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue