6
Gemfile
|
|
@ -174,13 +174,17 @@ gem 'cloudinary'
|
|||
# for setting app configuration in the environment
|
||||
gem 'dotenv-rails'
|
||||
|
||||
# for fake data
|
||||
# this is not in a group as we use it also for rake data:demo
|
||||
gem 'faker'
|
||||
|
||||
# Use guard and spring for testing in development
|
||||
group :development do
|
||||
# to launch specs when files are modified
|
||||
gem 'guard-rspec', '~> 4.2.8'
|
||||
gem 'spring-commands-rspec'
|
||||
# for static code analisys
|
||||
gem 'rubocop'
|
||||
gem 'rubocop', require: false
|
||||
# to silence rack assests messages
|
||||
gem 'quiet_assets'
|
||||
# as database
|
||||
|
|
|
|||
|
|
@ -173,6 +173,8 @@ GEM
|
|||
factory_girl_rails (4.6.0)
|
||||
factory_girl (~> 4.5.0)
|
||||
railties (>= 3.0.0)
|
||||
faker (1.6.1)
|
||||
i18n (~> 0.5)
|
||||
faraday (0.9.0)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
fastimage (2.0.0)
|
||||
|
|
@ -550,6 +552,7 @@ DEPENDENCIES
|
|||
devise_ichain_authenticatable
|
||||
dotenv-rails
|
||||
factory_girl_rails
|
||||
faker
|
||||
font-awesome-rails
|
||||
formtastic (~> 3.1.1)
|
||||
formtastic-bootstrap
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
class Cfp < ActiveRecord::Base
|
||||
belongs_to :program
|
||||
|
||||
validates :program_id, presence: true, uniqueness: true
|
||||
validates :program_id, presence: true
|
||||
validates :start_date, :end_date, presence: true
|
||||
validate :before_end_of_conference
|
||||
validate :start_after_end_date
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ class Contact < ActiveRecord::Base
|
|||
|
||||
validates :conference, presence: true
|
||||
# Conferences only have one contact
|
||||
validates :conference_id, uniqueness: {message: 'has already contact details'}
|
||||
|
||||
validates :facebook, :twitter, :googleplus, :instagram,
|
||||
format: URI::regexp(%w(http https)), allow_blank: true
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ class Venue < ActiveRecord::Base
|
|||
|
||||
accepts_nested_attributes_for :commercial, allow_destroy: true
|
||||
validates :name, :street, :city, :country, presence: true
|
||||
validates :conference_id, presence: true, uniqueness: true
|
||||
|
||||
mount_uploader :picture, PictureUploader, mount_on: :photo_file_name
|
||||
|
||||
|
|
@ -32,7 +31,7 @@ class Venue < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def notify_on_venue_changed?
|
||||
return false unless conference.email_settings.send_on_venue_updated
|
||||
return false unless conference.try(:email_settings).try(:send_on_venue_updated)
|
||||
# do not notify unless the address changed
|
||||
return false unless self.name_changed? || self.street_changed? || self.city_changed? || self.country_changed?
|
||||
# do not notify unless the mail content is set up
|
||||
|
|
|
|||
|
|
@ -12,24 +12,24 @@
|
|||
.row
|
||||
.col-md-6.col-md-offset-3.col-sm-10.col-sm-offset-1
|
||||
%p
|
||||
- if @program.event_types.any?
|
||||
- if @conference.program.event_types.any?
|
||||
You can submit proposals for
|
||||
%span.notranslate
|
||||
= "#{event_types(@conference)}."
|
||||
- if @program.tracks.any?
|
||||
- if @conference.program.tracks.any?
|
||||
Proposals should fit in one of the
|
||||
%span.notranslate
|
||||
= "#{pluralize(@program.tracks.count, 'track')}:"
|
||||
= "#{pluralize(@conference.program.tracks.count, 'track')}:"
|
||||
= "#{tracks(@conference)}."
|
||||
The submission period has begun
|
||||
%em.notranslate
|
||||
= @program.cfp.start_date.strftime('%A, %B %-d. %Y')
|
||||
= @conference.program.cfp.start_date.strftime('%A, %B %-d. %Y')
|
||||
and closes
|
||||
%em.notranslate
|
||||
= @program.cfp.end_date.strftime('%A, %B %-d. %Y.')
|
||||
- if @program.cfp_open?
|
||||
= @conference.program.cfp.end_date.strftime('%A, %B %-d. %Y.')
|
||||
- if @conference.program.cfp_open?
|
||||
That means you have only
|
||||
%b.notranslate= pluralize(@program.cfp.remaining_days, 'day')
|
||||
%b.notranslate= pluralize(@conference.program.cfp.remaining_days, 'day')
|
||||
left!
|
||||
Remember
|
||||
%span.notranslate
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
%section#program
|
||||
= render 'schedule_splashpage'
|
||||
|
||||
- if @program.cfp_open? and @conference.splashpage.include_cfp
|
||||
- if @conference.program.cfp_open? and @conference.splashpage.include_cfp
|
||||
%section#callforpapers
|
||||
= render 'call_for_paper'
|
||||
|
||||
|
|
|
|||
8
lib/tasks/data_demo.rake
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
namespace :data do
|
||||
desc 'Create demo data using our factories'
|
||||
task demo: :environment do
|
||||
include FactoryGirl::Syntax::Methods
|
||||
create(:full_conference)
|
||||
create(:admin, email: 'admin@osem.io', username: 'admin', password: 'password', password_confirmation: 'password')
|
||||
end
|
||||
end
|
||||
|
|
@ -58,7 +58,7 @@ describe Admin::ConferenceController do
|
|||
conference.reload
|
||||
expect(flash[:error]).
|
||||
to eq("Updating conference failed. Short title can't be blank.")
|
||||
expect(conference.title).to eq('The dog and pony show')
|
||||
expect(conference.title).to eq("#{conference.title}")
|
||||
expect(conference.short_title).to eq("#{conference.short_title}")
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ describe ConferenceRegistrationsController, type: :controller do
|
|||
end
|
||||
|
||||
it 'shows error in flash message' do
|
||||
expect(flash[:error]).to match "Could not update your registration for The dog and pony show: #{@registration.errors.full_messages.join('. ')}."
|
||||
expect(flash[:error]).to match "Could not update your registration for #{conference.title}: #{@registration.errors.full_messages.join('. ')}."
|
||||
end
|
||||
|
||||
it 'does not update the registration' do
|
||||
|
|
@ -139,7 +139,7 @@ describe ConferenceRegistrationsController, type: :controller do
|
|||
end
|
||||
|
||||
it 'shows success message in flash notice', run: true do
|
||||
expect(flash[:notice]).to match('You are not registered for The dog and pony show anymore!')
|
||||
expect(flash[:notice]).to match("You are not registered for #{conference.title} anymore!")
|
||||
end
|
||||
|
||||
it 'deletes the registration' do
|
||||
|
|
@ -160,7 +160,7 @@ describe ConferenceRegistrationsController, type: :controller do
|
|||
end
|
||||
|
||||
it 'shows error in flash message' do
|
||||
expect(flash[:error]).to match "Could not delete your registration for The dog and pony show: #{@registration.errors.full_messages.join('. ')}."
|
||||
expect(flash[:error]).to match "Could not delete your registration for #{conference.title}: #{@registration.errors.full_messages.join('. ')}."
|
||||
end
|
||||
|
||||
it 'does not delete the registration' do
|
||||
|
|
|
|||
|
|
@ -2,8 +2,9 @@
|
|||
|
||||
FactoryGirl.define do
|
||||
factory :cfp do
|
||||
program
|
||||
start_date { 1.day.ago }
|
||||
end_date { 6.days.from_now }
|
||||
|
||||
program
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,12 +2,13 @@
|
|||
|
||||
FactoryGirl.define do
|
||||
factory :conference do
|
||||
title 'The dog and pony show'
|
||||
sequence(:short_title) { |n| "dps#{n}14" }
|
||||
timezone 'Amsterdam'
|
||||
title { Faker::Book.title }
|
||||
short_title { SecureRandom.urlsafe_base64(4) }
|
||||
timezone { Faker::Address.time_zone }
|
||||
start_date { Date.today }
|
||||
end_date { 6.days.from_now }
|
||||
registration_limit 0
|
||||
description { CGI.escapeHTML(Faker::Hipster.paragraph) }
|
||||
|
||||
after(:create) do |conference|
|
||||
Role.where(name: 'organizer', resource: conference).first_or_create(description: 'For the organizers of the conference (who shall have full access)')
|
||||
|
|
@ -17,19 +18,38 @@ FactoryGirl.define do
|
|||
end
|
||||
|
||||
factory :full_conference do
|
||||
splashpage
|
||||
association :splashpage, factory: :full_splashpage
|
||||
registration_period
|
||||
venue
|
||||
|
||||
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)
|
||||
|
||||
# Contact/Program is created by Conference callbacks
|
||||
conference.contact.destroy
|
||||
conference.contact = create(:contact, conference: conference)
|
||||
conference.program.update_attributes(schedule_public: true)
|
||||
|
||||
create(:cfp, program: conference.program)
|
||||
create_list(:track, 2, program: conference.program)
|
||||
create_list(:ticket, 3, conference: conference)
|
||||
create_list(:room, 3, venue: conference.venue)
|
||||
create_list(:lodging, 4, conference: conference)
|
||||
|
||||
create_list(:sponsorship_level, 3, conference: conference)
|
||||
create(:sponsor, sponsorship_level: conference.sponsorship_levels.first, conference: conference)
|
||||
create_list(:sponsor, 2, sponsorship_level: conference.sponsorship_levels.second, conference: conference)
|
||||
create_list(:sponsor, 3, sponsorship_level: conference.sponsorship_levels.third, conference: conference)
|
||||
|
||||
create(:campaign, conference: conference)
|
||||
create(:target, conference: conference)
|
||||
create(:question, conferences: [conference])
|
||||
|
||||
# Logo...
|
||||
uploader = PictureUploader.new(conference, :picture)
|
||||
File.open('app/assets/images/rails.png') { |f| uploader.store!(f) }
|
||||
conference.logo_file_name = 'rails.png'
|
||||
conference.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
13
spec/factories/contacts.rb
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
FactoryGirl.define do
|
||||
factory :contact do
|
||||
social_tag { SecureRandom.urlsafe_base64(4) }
|
||||
email { Faker::Internet.email }
|
||||
sponsor_email { Faker::Internet.email }
|
||||
facebook { Faker::Internet.url('facebook.com') }
|
||||
googleplus { Faker::Internet.url('plus.google.com') }
|
||||
twitter { Faker::Internet.url('twitter.com') }
|
||||
instagram { Faker::Internet.url('instagram.com') }
|
||||
|
||||
conference
|
||||
end
|
||||
end
|
||||
|
|
@ -2,34 +2,11 @@
|
|||
|
||||
FactoryGirl.define do
|
||||
factory :event do
|
||||
sequence(:title) { |n| "The ##{n} talk you'll ever attend." }
|
||||
program
|
||||
abstract <<-EOS
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ante
|
||||
lacus, mollis non urna vitae, varius semper leo. Nulla ac nibh dui. Mauris
|
||||
convallis diam eu porta fermentum. Vestibulum posuere odio et est ornare,
|
||||
at consectetur ante eleifend. Etiam tellus libero, ornare at euismod nec,
|
||||
luctus a leo. Aliquam et commodo lacus, at luctus nibh. Aenean eleifend
|
||||
risus a nisi pellentesque tempor. Etiam dapibus facilisis odio at ornare.
|
||||
Mauris tempus, nunc ut malesuada iaculis, eros mi mattis ligula, vitae
|
||||
lobortis enim lacus ut nunc. Donec mattis sagittis imperdiet.
|
||||
Pellentesque ultrices malesuada ipsum, mattis dignissim felis pulvinar
|
||||
vitae. Etiam ultrices erat convallis arcu placerat, at vulputate felis
|
||||
tempus. Ut eleifend sem et ante feugiat euismod ac luctus tortor. Nam
|
||||
commodo mattis erat ac condimentum. Duis dictum tempus odio, quis
|
||||
adipiscing justo. Etiam nunc neque, rutrum vitae sapien eget, elementum
|
||||
dignissim dui.
|
||||
title { Faker::Hipster.sentence }
|
||||
abstract { Faker::Hipster.paragraph(2) }
|
||||
|
||||
program
|
||||
|
||||
Donec vitae laoreet augue. Sed eget felis placerat, scelerisque felis eu,
|
||||
mattis risus. Sed posuere arcu at lacus ultricies pretium. Aenean in
|
||||
dapibus erat. Morbi vitae risus eu ante lacinia mollis. Donec vitae
|
||||
hendrerit est. Maecenas ac sem non mi vulputate aliquam ac eget enim.
|
||||
Curabitur eget volutpat nisi. Proin sit amet consequat urna. Aliquam nec
|
||||
elit vitae tellus pellentesque ultricies. Sed in enim vitae nisl
|
||||
ullamcorper dignissim. Proin aliquet nisi sed mauris dapibus, sit amet
|
||||
dignissim quam pulvinar. Nunc dictum porta sodales. Cras ullamcorper
|
||||
libero quis porta ultricies. Fusce pulvinar accumsan lobortis.
|
||||
EOS
|
||||
after(:build) do |event|
|
||||
event.event_users << build(:submitter) unless event.submitter # so that we don't have two submitters
|
||||
# set an event_type if none is passed to the factory.
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@
|
|||
|
||||
FactoryGirl.define do
|
||||
factory :lodging do
|
||||
name 'Example Hotel'
|
||||
description 'Lorem Ipsum Dolor'
|
||||
website_link 'http://www.example.com'
|
||||
conference
|
||||
name { "#{Faker::App.name} Hotel" }
|
||||
description { CGI.escapeHTML(Faker::Lorem.paragraph) }
|
||||
website_link { Faker::Internet.url }
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,11 +2,9 @@
|
|||
|
||||
FactoryGirl.define do
|
||||
factory :question do
|
||||
title 'blah'
|
||||
title { Faker::Lorem.sentence }
|
||||
question_type
|
||||
after(:build) do |question|
|
||||
question.answers << build(:answer)
|
||||
question.conferences << build(:conference)
|
||||
end
|
||||
conferences { [create(:conference)] }
|
||||
answers { [create(:answer)] }
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
FactoryGirl.define do
|
||||
factory :registration_period do
|
||||
start_date { 3.days.from_now }
|
||||
start_date { 3.days.ago }
|
||||
end_date { 5.days.from_now }
|
||||
conference
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
FactoryGirl.define do
|
||||
factory :room do
|
||||
name 'Example Room'
|
||||
name { "Room #{Faker::Address.country}" }
|
||||
size 4
|
||||
|
||||
venue
|
||||
|
||||
factory :room_for_100 do
|
||||
|
|
|
|||
|
|
@ -3,5 +3,18 @@
|
|||
FactoryGirl.define do
|
||||
factory :splashpage do
|
||||
public false
|
||||
|
||||
factory :full_splashpage do
|
||||
public true
|
||||
include_tracks true
|
||||
include_program true
|
||||
include_social_media true
|
||||
include_venue true
|
||||
include_tickets true
|
||||
include_registrations true
|
||||
include_sponsors true
|
||||
include_lodgings true
|
||||
include_cfp true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,16 +2,17 @@
|
|||
|
||||
FactoryGirl.define do
|
||||
factory :sponsor do
|
||||
name 'Example sponsor'
|
||||
website_url 'http://www.example.com'
|
||||
description 'Lorem Ipsum Dolor'
|
||||
name { Faker::Company.name }
|
||||
website_url { Faker::Internet.url }
|
||||
description { CGI.escapeHTML(Faker::Lorem.paragraph) }
|
||||
|
||||
sponsorship_level
|
||||
conference
|
||||
|
||||
after(:create) do |sponsor|
|
||||
logo = "#{1 + rand(13)}.png"
|
||||
uploader = PictureUploader.new(sponsor, :picture)
|
||||
File.open('app/assets/images/rails.png') { |f| uploader.store!(f) }
|
||||
sponsor.logo_file_name = 'rails.png'
|
||||
File.open("spec/support/logos/#{logo}") { |f| uploader.store!(f) }
|
||||
sponsor.logo_file_name = logo.to_s
|
||||
sponsor.save
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
FactoryGirl.define do
|
||||
factory :sponsorship_level do
|
||||
title 'Platin'
|
||||
title { Faker::Hipster.word }
|
||||
|
||||
conference
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
FactoryGirl.define do
|
||||
factory :ticket do
|
||||
title 'Business Ticket'
|
||||
title { "#{Faker::Hipster.word} Ticket" }
|
||||
price_cents 1000
|
||||
price_currency 'USD'
|
||||
conference
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
FactoryGirl.define do
|
||||
factory :track do
|
||||
name 'Example Track'
|
||||
description 'Lorem Ipsum dolsum'
|
||||
color '#ffffff'
|
||||
program
|
||||
name { Faker::Commerce.department(2, true) }
|
||||
description { Faker::Lorem.sentence }
|
||||
color { Faker::Color.hex_color }
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
# Read about factories at https://github.com/thoughtbot/factory_girl
|
||||
FactoryGirl.define do
|
||||
factory :venue do
|
||||
name 'Suse Office'
|
||||
street 'Maxfeldstrasse 5'
|
||||
city 'Nuremberg'
|
||||
postalcode '90489'
|
||||
country 'DE'
|
||||
website 'www.opensuse.org'
|
||||
description 'Lorem Ipsum Dolor'
|
||||
name { "#{Faker::Company.name} Office" }
|
||||
street { Faker::Address.street_address }
|
||||
city { Faker::Address.city }
|
||||
postalcode { Faker::Address.postcode }
|
||||
country { Faker::Address.country_code }
|
||||
website { Faker::Internet.url }
|
||||
description { Faker::Lorem.sentence }
|
||||
|
||||
conference
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@ feature Lodging do
|
|||
visit admin_conference_lodgings_path(
|
||||
conference_id: conference.short_title)
|
||||
|
||||
expect(page.has_content?('Example Hotel')).to be true
|
||||
expect(page.has_content?(lodging.name)).to be true
|
||||
|
||||
# Add lodging
|
||||
click_link 'Edit'
|
||||
|
||||
fill_in 'lodging_name', with: 'New lodging'
|
||||
fill_in 'lodging_website_link', with: 'http:\\www.google.com'
|
||||
fill_in 'lodging_website_link', with: 'http://www.google.com'
|
||||
attach_file 'Picture', path
|
||||
|
||||
click_button 'Update Lodging'
|
||||
|
|
@ -51,26 +51,26 @@ feature Lodging do
|
|||
expect(page.has_content?('New lodging')).to be true
|
||||
lodging.reload
|
||||
expect(lodging.name).to eq('New lodging')
|
||||
expect(lodging.description).to eq('Lorem Ipsum Dolor')
|
||||
expect(lodging.website_link).to eq('http:\\www.google.com')
|
||||
expect(lodging.description).to eq(lodging.description)
|
||||
expect(lodging.website_link).to eq('http://www.google.com')
|
||||
expect(Lodging.count).to eq(1)
|
||||
end
|
||||
|
||||
scenario 'Delete a lodging', feature: true, js: true do
|
||||
conference.lodgings << create(:lodging)
|
||||
lodging = create(:lodging, conference: conference)
|
||||
|
||||
sign_in organizer
|
||||
visit admin_conference_lodgings_path(
|
||||
conference_id: conference.short_title)
|
||||
|
||||
expect(page.has_content?('Example Hotel')).to be true
|
||||
expect(page.has_content?(lodging.name)).to be true
|
||||
|
||||
# Add lodging
|
||||
click_link 'Delete'
|
||||
|
||||
# Validations
|
||||
expect(flash).to eq('Lodging successfully deleted.')
|
||||
expect(page.has_content?('Example Hotel')).to be false
|
||||
expect(page.has_content?(lodging.name)).to be false
|
||||
expect(Lodging.count).to eq(0)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ feature Sponsor do
|
|||
fill_in 'sponsor_description', with: 'The original provider of the enterprise Linux distribution'
|
||||
attach_file 'Picture', path
|
||||
fill_in 'sponsor_website_url', with: 'http://www.suse.com'
|
||||
select('Platin', from: 'sponsor_sponsorship_level_id')
|
||||
select(conference.sponsorship_levels.first.title, from: 'sponsor_sponsorship_level_id')
|
||||
|
||||
click_button 'Create Sponsor'
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ feature Sponsor do
|
|||
expect(page.has_content?('SUSE')).to be true
|
||||
expect(page.has_content?('The original provider')).to be true
|
||||
expect(page.has_content?('http://www.suse.com')).to be true
|
||||
expect(page.has_content?('Platin')).to be true
|
||||
expect(page.has_content?(conference.sponsorship_levels.first.title)).to be true
|
||||
expect(page).to have_selector("img[src*='rails.png']")
|
||||
expect(page.assert_selector('tr', count: 2)).to be true
|
||||
end
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ feature Registration do
|
|||
expect(current_path).to eq(conference_conference_registrations_path(conference.short_title))
|
||||
expect(flash).
|
||||
to eq("Thank you for supporting #{conference.title} by purchasing a ticket.")
|
||||
expect(page.has_content?('2 Business Ticket Tickets for 10')).to be true
|
||||
expect(page.has_content?("2 #{ticket.title} Tickets for 10")).to be true
|
||||
end
|
||||
|
||||
scenario 'deletes a purchased ticket', feature: true, js: true do
|
||||
|
|
@ -41,7 +41,7 @@ feature Registration do
|
|||
create(:ticket_purchase, conference: conference, user: participant, ticket: ticket, quantity: 4)
|
||||
|
||||
visit conference_conference_registrations_path(conference.short_title)
|
||||
expect(page.has_content?('4 Business Ticket Tickets for 10')).to be true
|
||||
expect(page.has_content?("4 #{ticket.title} Tickets for 10")).to be true
|
||||
|
||||
click_link "ticket-#{ticket.id}-delete"
|
||||
expect(flash).to eq('Ticket successfully deleted.')
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ describe SponsorsHelper, type: :helper do
|
|||
end
|
||||
|
||||
it 'returns correct url' do
|
||||
expect(get_logo(sponsor)).to match %r{.*(\bfirst/rails.png\b)}
|
||||
expect(get_logo(sponsor)).to match %r{.*(\bfirst/#{sponsor.logo_file_name}\b)}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ describe SponsorsHelper, type: :helper do
|
|||
end
|
||||
|
||||
it 'returns correct url' do
|
||||
expect(get_logo(sponsor)).to match %r{.*(\bsecond/rails.png\b)}
|
||||
expect(get_logo(sponsor)).to match %r{.*(\bsecond/#{sponsor.logo_file_name}\b)}
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ describe SponsorsHelper, type: :helper do
|
|||
end
|
||||
|
||||
it 'returns correct url' do
|
||||
expect(get_logo(sponsor)).to match %r{.*(\bothers/rails.png\b)}
|
||||
expect(get_logo(sponsor)).to match %r{.*(\bothers/#{sponsor.logo_file_name}\b)}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ describe EmailSettings do
|
|||
{
|
||||
'email' => 'john@doe.com',
|
||||
'name' => 'John Doe',
|
||||
'conference' => 'The dog and pony show',
|
||||
'conference' => conference.title,
|
||||
'conference_start_date' => Date.new(2014, 05, 01),
|
||||
'conference_end_date' => Date.new(2014, 05, 06),
|
||||
'registrationlink' => 'http://localhost:3000/conference/goto/register',
|
||||
|
|
@ -62,7 +62,7 @@ describe EmailSettings do
|
|||
context 'conference has venue' do
|
||||
before do
|
||||
conference.update_attributes(venue: create(:venue))
|
||||
venue_hash = { 'venue' => 'Suse Office', 'venue_address' => 'Maxfeldstrasse 5, Nuremberg, Germany' }
|
||||
venue_hash = { 'venue' => conference.venue.name, 'venue_address' => conference.venue.address }
|
||||
expected_hash.merge!(venue_hash)
|
||||
end
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ describe EmailSettings do
|
|||
|
||||
it 'replaces fillers in template' do
|
||||
expected_text = "Dear John Doe\n\nWe are very pleased" \
|
||||
'to inform you that your submission Talk about talks has been accepted for the conference The dog and pony show.'
|
||||
"to inform you that your submission Talk about talks has been accepted for the conference #{conference.title}."
|
||||
expect(conference.email_settings.generate_event_mail(event, event_template)).to eq expected_text
|
||||
end
|
||||
end
|
||||
|
|
@ -114,7 +114,7 @@ describe EmailSettings do
|
|||
let(:conf_update_template) { "Dear {name},\n\nThank you for Registering for the conference {conference}." }
|
||||
|
||||
it 'replaces fillers in template' do
|
||||
expected_text = "Dear John Doe,\n\nThank you for Registering for the conference The dog and pony show."
|
||||
expected_text = "Dear John Doe,\n\nThank you for Registering for the conference #{conference.title}."
|
||||
expect(conference.email_settings.generate_email_on_conf_updates(conference, user, conf_update_template)).to eq expected_text
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ describe Event do
|
|||
describe '#abstract_word_count' do
|
||||
it 'counts words in abstract' do
|
||||
event = build(:event)
|
||||
expect(event.abstract_word_count).to eq(233)
|
||||
expect(event.abstract_word_count).to eq(event.abstract.to_s.split.size)
|
||||
event.update_attributes!(abstract: 'abstract.')
|
||||
expect(event.abstract_word_count).to eq(1)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ describe ConferenceSerializer, type: :serializer do
|
|||
{
|
||||
conference: {
|
||||
short_title: 'goto',
|
||||
title: 'The dog and pony show',
|
||||
title: conference.title,
|
||||
description: 'Lorem ipsum dolor sit',
|
||||
start_date: '2014-03-04',
|
||||
end_date: '2014-03-10',
|
||||
|
|
@ -61,7 +61,7 @@ describe ConferenceSerializer, type: :serializer do
|
|||
before do
|
||||
venue = create(:venue, conference: conference)
|
||||
_room = create(:room, venue: venue)
|
||||
_track = create(:track, program: conference.program)
|
||||
track = create(:track, program: conference.program)
|
||||
|
||||
room_hash = {
|
||||
rooms: [{
|
||||
|
|
@ -74,8 +74,8 @@ describe ConferenceSerializer, type: :serializer do
|
|||
track_hash = {
|
||||
tracks: [{
|
||||
id: 1,
|
||||
name: 'Example Track',
|
||||
description: 'Lorem Ipsum dolsum'
|
||||
name: track.name,
|
||||
description: track.description
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ describe RoomSerializer, type: :serializer do
|
|||
expected_json = {
|
||||
room: {
|
||||
guid: room.guid,
|
||||
name: 'Example Room',
|
||||
name: room.name,
|
||||
description: ''
|
||||
}
|
||||
}.to_json
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ describe TrackSerializer, type: :serializer do
|
|||
expected_json = {
|
||||
track: {
|
||||
guid: track.guid,
|
||||
name: 'Example Track',
|
||||
color: '#ffffff'
|
||||
name: track.name,
|
||||
color: track.color
|
||||
}
|
||||
}.to_json
|
||||
|
||||
|
|
|
|||
BIN
spec/support/logos/1.png
Normal file
|
After Width: | Height: | Size: 44 KiB |
BIN
spec/support/logos/10.png
Normal file
|
After Width: | Height: | Size: 105 KiB |
BIN
spec/support/logos/11.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
spec/support/logos/12.png
Normal file
|
After Width: | Height: | Size: 42 KiB |
BIN
spec/support/logos/13.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
spec/support/logos/2.png
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
spec/support/logos/3.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
spec/support/logos/4.png
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
spec/support/logos/5.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
spec/support/logos/6.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
spec/support/logos/7.png
Normal file
|
After Width: | Height: | Size: 77 KiB |
BIN
spec/support/logos/8.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
spec/support/logos/9.png
Normal file
|
After Width: | Height: | Size: 46 KiB |
1
spec/support/logos/README.md
Normal file
|
|
@ -0,0 +1 @@
|
|||
These are fake logos from https://github.com/pigment/fake-logos
|
||||
|
|
@ -1,18 +1,17 @@
|
|||
# Automatically save and open the page
|
||||
# whenever an expectation is not met in a features spec
|
||||
# Automatically save the page a test fails
|
||||
Capybara.save_and_open_page_path = Rails.root.join('tmp', 'capybara')
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.after(:each, type: :feature) do
|
||||
ename = RSpec.current_example.full_description
|
||||
ename = ename.gsub ' ', '_'
|
||||
ename.downcase!
|
||||
ename = ename + '.html'
|
||||
example_filename = RSpec.current_example.full_description
|
||||
example_filename = example_filename.tr(' ', '_')
|
||||
example_filename = example_filename + '.html'
|
||||
example_filename = File.expand_path(example_filename, Capybara.save_and_open_page_path)
|
||||
if RSpec.current_example.exception.present?
|
||||
save_page(ename)
|
||||
else
|
||||
capfile = File.expand_path(ename, Capybara.save_and_open_page_path)
|
||||
if File.exist?(capfile)
|
||||
File.unlink(capfile)
|
||||
end
|
||||
save_page(example_filename)
|
||||
# remove the file if the test starts working again
|
||||
elsif File.exist?(example_filename)
|
||||
File.unlink(example_filename)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'admin/conference/index' do
|
||||
let(:conference) { create(:conference, title: 'openSUSE Conference 2016') }
|
||||
let(:second_conference) { create(:conference) }
|
||||
|
||||
it 'renders all conference names with links' do
|
||||
assign(:conferences, [create(:conference, title: 'openSUSE'), create(:conference)])
|
||||
assign(:conferences, [conference, second_conference])
|
||||
render
|
||||
expect(rendered).to include('openSUSE')
|
||||
expect(rendered).to include('The dog and pony show')
|
||||
expect(rendered).to include('openSUSE Conference 2016')
|
||||
expect(rendered).to include(second_conference.title)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'admin/conference/new' do
|
||||
let(:conference) { build(:conference) }
|
||||
|
||||
it 'renders the new template for the conference' do
|
||||
assign(:conference, Conference.new)
|
||||
render
|
||||
expect(rendered).to include('Basic Information')
|
||||
assign(:conference, build(:conference))
|
||||
assign(:conference, conference)
|
||||
render
|
||||
expect(rendered).to include('The dog and pony show')
|
||||
expect(rendered).to include(conference.title)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,6 +7,6 @@ describe 'admin/lodgings/index' do
|
|||
@conference.lodgings << create(:lodging)
|
||||
assign :venue, @conference.venue
|
||||
render
|
||||
expect(rendered).to include('Example Hotel')
|
||||
expect(rendered).to include(@conference.lodgings.first.name)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ describe 'admin/sponsors/index' do
|
|||
)
|
||||
assign :conference, @conference
|
||||
render
|
||||
expect(rendered).to include('Example sponsor')
|
||||
expect(rendered).to include('http://www.example.com')
|
||||
expect(rendered).to include('Lorem Ipsum Dolor')
|
||||
expect(rendered).to include('Platin')
|
||||
expect(rendered).to include(@conference.sponsors.first.name)
|
||||
expect(rendered).to include(@conference.sponsors.first.website_url)
|
||||
expect(rendered).to include(truncate(@conference.sponsors.first.description))
|
||||
expect(rendered).to include(@conference.sponsorship_levels.first.title)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ describe 'admin/sponsorship_levels/index' do
|
|||
@sponsorship_level = create(:sponsorship_level)
|
||||
assign :conference, @sponsorship_level.conference
|
||||
render
|
||||
expect(rendered).to include('Platin')
|
||||
expect(rendered).to include(@sponsorship_level.title)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,46 +1,15 @@
|
|||
require 'spec_helper'
|
||||
describe 'conference/show.html.haml' do
|
||||
let!(:conference) { create(:full_conference) }
|
||||
|
||||
before(:each) do
|
||||
allow(view).to receive(:date_string).and_return('January 17 - 21 2014')
|
||||
@conference = create(:conference, description: 'Lorem Ipsum')
|
||||
@program = @conference.program
|
||||
|
||||
@conference.splashpage = create(:splashpage,
|
||||
include_registrations: true,
|
||||
include_program: true,
|
||||
include_sponsors: true,
|
||||
include_tracks: true,
|
||||
include_tickets: true,
|
||||
include_social_media: true,
|
||||
include_venue: true,
|
||||
include_lodgings: true,
|
||||
include_cfp: true)
|
||||
|
||||
@conference.contact.update(sponsor_email: 'example@example.com',
|
||||
facebook: 'http://facebook.com',
|
||||
googleplus: 'http://google.com',
|
||||
instagram: 'http://instagram.com',
|
||||
twitter: 'http://twitter.com')
|
||||
|
||||
@conference.registration_period = create(:registration_period,
|
||||
start_date: Date.yesterday,
|
||||
end_date: Date.tomorrow)
|
||||
|
||||
@conference.program.cfp = create(:cfp, program: @conference.program)
|
||||
|
||||
@conference.sponsorship_levels << create(:sponsorship_level, conference: @conference)
|
||||
@sponsorship_level = @conference.sponsorship_levels.first
|
||||
@sponsorship_level.sponsors << create(:sponsor, sponsorship_level: @sponsorship_level,
|
||||
conference: @conference)
|
||||
|
||||
@conference.venue = create(:venue)
|
||||
@conference.lodgings << create(:lodging)
|
||||
assign :conference, @conference
|
||||
assign :conference, conference
|
||||
render
|
||||
end
|
||||
|
||||
it 'renders banner component' do
|
||||
expect(rendered).to match(/#{@conference.description}/)
|
||||
expect(rendered).to match(conference.description)
|
||||
end
|
||||
|
||||
it 'renders program partial' do
|
||||
|
|
@ -57,32 +26,33 @@ describe 'conference/show.html.haml' do
|
|||
|
||||
it 'renders sponsors partial' do
|
||||
expect(view).to render_template(partial: 'conference/_sponsors')
|
||||
expect(rendered).to match(/example@example.com/)
|
||||
expect(rendered).to match(/www.example.com/)
|
||||
expect(rendered).to match(/Lorem Ipsum Dolor/)
|
||||
expect(rendered).to match(/rails.png/)
|
||||
expect(rendered).to match(conference.contact.email)
|
||||
expect(rendered).to match(conference.sponsors.first.website_url)
|
||||
expect(rendered).to match(conference.sponsors.first.description)
|
||||
expect(rendered).to match(conference.sponsors.first.logo_file_name)
|
||||
end
|
||||
|
||||
it 'renders social media partial' do
|
||||
expect(view).to render_template('conference/_social_media')
|
||||
expect(rendered).to match(/facebook.com/)
|
||||
expect(rendered).to match(/google.com/)
|
||||
expect(rendered).to match(/instagram.com/)
|
||||
expect(rendered).to match(/twitter.com/)
|
||||
expect(rendered).to match(conference.contact.facebook)
|
||||
expect(rendered).to match(conference.contact.googleplus)
|
||||
expect(rendered).to match(conference.contact.instagram)
|
||||
expect(rendered).to match(conference.contact.twitter)
|
||||
end
|
||||
|
||||
it 'renders venue partial' do
|
||||
expect(view).to render_template(partial: 'conference/_venue')
|
||||
expect(rendered).to match(/Suse Office/)
|
||||
expect(rendered).to match(/Maxfeldstrasse 5/)
|
||||
expect(rendered).to match(/www.opensuse.org/)
|
||||
expect(rendered).to match(/Lorem Ipsum Dolor/)
|
||||
expect(rendered).to match(conference.venue.name)
|
||||
expect(rendered).to match(conference.venue.street)
|
||||
expect(rendered).to match(conference.venue.website)
|
||||
expect(rendered).to match(conference.venue.description)
|
||||
end
|
||||
|
||||
it 'renders lodging partial' do
|
||||
expect(view).to render_template(partial: 'conference/_lodging')
|
||||
expect(rendered).to match(/Example Hotel/)
|
||||
expect(rendered).to match(/Lorem Ipsum Dolor/)
|
||||
expect(rendered).to match(/www.example.com/)
|
||||
expect(rendered).to match(conference.lodgings.first.name)
|
||||
expect(rendered).to match(conference.lodgings.first.description)
|
||||
# FIXME: Lodging without image doesn't show link
|
||||
# expect(rendered).to match(conference.lodgings.first.website_link)
|
||||
end
|
||||
end
|
||||
|
|
|
|||