Merge branch 'master' into Hide_recent_Registrations/Submissions

This commit is contained in:
Stella Rouzi 2017-06-12 10:14:56 +03:00 committed by GitHub
commit 4e227b4858
11 changed files with 57 additions and 22 deletions

View file

@ -104,6 +104,10 @@ Style/TrailingBlankLines:
Style/TrailingWhitespace: Style/TrailingWhitespace:
Enabled: true Enabled: true
# Check for array literals made up of word-like strings, that are not using the %w() syntax
Style/WordArray:
Enabled: true
# This cop checks for numeric comparisons that can be replaced by a predicate method. # This cop checks for numeric comparisons that can be replaced by a predicate method.
Style/ZeroLengthPredicate: Style/ZeroLengthPredicate:
Enabled: true Enabled: true

View file

@ -928,11 +928,3 @@ Style/UnneededInterpolation:
Style/VariableNumber: Style/VariableNumber:
Exclude: Exclude:
- 'spec/models/ticket_purchase_spec.rb' - 'spec/models/ticket_purchase_spec.rb'
# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: SupportedStyles, WordRegex.
# SupportedStyles: percent, brackets
Style/WordArray:
EnforcedStyle: percent
MinSize: 3

View file

@ -24,6 +24,9 @@ before_script:
- mysql -u root -e 'create database osem_test;' - mysql -u root -e 'create database osem_test;'
- RAILS_ENV=test bundle exec rake db:migrate --trace - RAILS_ENV=test bundle exec rake db:migrate --trace
script: script:
- 'bundle exec rubocop -Dc .rubocop.yml' - "./travis_script.sh $TEST_SUITE"
- 'bundle exec haml-lint app/views' env:
- 'bundle exec rspec --color --format documentation' - TEST_SUITE=rspec
- TEST_SUITE=linters
matrix:
fast_finish: true

View file

@ -128,6 +128,7 @@ gem 'country_select'
gem 'prawn_rails' gem 'prawn_rails'
# to render XLS spreadsheets # to render XLS spreadsheets
gem 'axlsx', git: 'https://github.com/randym/axlsx.git'
gem 'axlsx_rails' gem 'axlsx_rails'
# as error catcher # as error catcher

View file

@ -1,3 +1,13 @@
GIT
remote: https://github.com/randym/axlsx.git
revision: c8ac844572b25fda358cc01d2104720c4c42f450
specs:
axlsx (2.1.0.pre)
htmlentities (~> 4.3.4)
mimemagic (~> 0.3)
nokogiri (>= 1.6.6)
rubyzip (>= 1.2.1)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
remote: https://rails-assets.org/ remote: https://rails-assets.org/
@ -65,10 +75,6 @@ GEM
awesome_nested_set (3.0.0.rc.5) awesome_nested_set (3.0.0.rc.5)
activerecord (>= 4.0.0, < 5) activerecord (>= 4.0.0, < 5)
aws_cf_signer (0.1.3) aws_cf_signer (0.1.3)
axlsx (2.0.1)
htmlentities (~> 4.3.1)
nokogiri (>= 1.4.1)
rubyzip (~> 1.2.1)
axlsx_rails (0.2.0) axlsx_rails (0.2.0)
axlsx (>= 2.0.1) axlsx (>= 2.0.1)
rails (>= 3.1) rails (>= 3.1)
@ -262,6 +268,7 @@ GEM
mime-types (>= 1.16, < 3) mime-types (>= 1.16, < 3)
method_source (0.8.2) method_source (0.8.2)
mime-types (2.99.1) mime-types (2.99.1)
mimemagic (0.3.2)
mina (0.3.8) mina (0.3.8)
open4 (~> 1.3.4) open4 (~> 1.3.4)
rake rake
@ -551,6 +558,7 @@ DEPENDENCIES
ahoy_matey ahoy_matey
autoprefixer-rails autoprefixer-rails
awesome_nested_set (~> 3.0.0.rc.5) awesome_nested_set (~> 3.0.0.rc.5)
axlsx!
axlsx_rails axlsx_rails
bootstrap-sass (~> 3.3.4.1) bootstrap-sass (~> 3.3.4.1)
bootstrap-switch-rails (~> 3.0.0) bootstrap-switch-rails (~> 3.0.0)

View file

@ -1,6 +1,6 @@
class EventUser < ActiveRecord::Base class EventUser < ActiveRecord::Base
# TODO Do we need these roles? # TODO Do we need these roles?
ROLES = [['Speaker', 'speaker'], ['Submitter', 'submitter'], ['Moderator', 'moderator']] ROLES = [%w[Speaker speaker], %w[Submitter submitter], %w[Moderator moderator]]
belongs_to :event belongs_to :event
belongs_to :user belongs_to :user

View file

@ -2,7 +2,7 @@ namespace :data do
desc 'Sets conference_id in all pre-existing PaperTrail::Version objects' desc 'Sets conference_id in all pre-existing PaperTrail::Version objects'
task set_conference_in_versions: :environment do task set_conference_in_versions: :environment do
PaperTrail::Version.where(conference_id: nil, item_type: ['Conference', 'Event']).each do |version| PaperTrail::Version.where(conference_id: nil, item_type: %w[Conference Event]).each do |version|
# All pre-existing versions are either of Conference or Event # All pre-existing versions are either of Conference or Event
if version.item_type == 'Conference' if version.item_type == 'Conference'
version.update_attributes(conference_id: version.item_id) version.update_attributes(conference_id: version.item_id)

View file

@ -4,7 +4,7 @@ describe UsersHelper, type: :helper do
describe 'show_roles' do describe 'show_roles' do
it 'formats the hash passed' do it 'formats the hash passed' do
roles = { 'organizer' => ['oSC16', 'oSC15'], 'cfp' => ['oSC16'] } roles = { 'organizer' => %w[oSC16 oSC15], 'cfp' => ['oSC16'] }
expect(show_roles(roles)).to eq 'Organizer (oSC16, oSC15), Cfp (oSC16)' expect(show_roles(roles)).to eq 'Organizer (oSC16, oSC15), Cfp (oSC16)'
end end
end end

View file

@ -141,7 +141,7 @@ describe Program do
describe '#cfp_open?' do describe '#cfp_open?' do
describe 'returns true' do describe 'returns true' do
it 'when there is an open Call for Papers for the conference' do it 'when there is an open Call for Papers for the conference' do
create(:cfp, start_date: Date.today - 2, end_date: Date.today, program_id: program.id) create(:cfp, start_date: Date.current - 2, end_date: Date.current, program_id: program.id)
expect(program.cfp_open?).to be true expect(program.cfp_open?).to be true
end end
end end
@ -152,7 +152,7 @@ describe Program do
end end
it 'when the Call for Papers period is over' do it 'when the Call for Papers period is over' do
build(:cfp, start_date: Date.today - 2, end_date: Date.today - 1, program_id: program.id) create(:cfp, start_date: Date.current - 2, end_date: Date.current - 1, program_id: program.id)
expect(program.cfp_open?).to be false expect(program.cfp_open?).to be false
end end
end end

View file

@ -282,7 +282,7 @@ describe User do
it 'returns hash of role and conference' do it 'returns hash of role and conference' do
expected_hash = { expected_hash = {
'organizer' => ['oSC16', 'oSC15'], 'organizer' => %w[oSC16 oSC15],
'cfp' => ['oSC16'] 'cfp' => ['oSC16']
} }

27
travis_script.sh Executable file
View file

@ -0,0 +1,27 @@
#!/bin/bash
# This script runs the test suites for the CI build
# Be verbose and fail script on the first error
set -xe
# By default: all test runs
if [ -z $1 ]; then
TEST_SUITE="all"
else
TEST_SUITE="$1"
fi
case $TEST_SUITE in
linters)
bundle exec rubocop -Dc .rubocop.yml
bundle exec haml-lint app/views
;;
rspec)
bundle exec rspec --color --format documentation
;;
*)
bundle exec rubocop -Dc .rubocop.yml
bundle exec haml-lint app/views
bundle exec rspec --color --format documentation
;;
esac