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:
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.
Style/ZeroLengthPredicate:
Enabled: true

View file

@ -928,11 +928,3 @@ Style/UnneededInterpolation:
Style/VariableNumber:
Exclude:
- '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;'
- RAILS_ENV=test bundle exec rake db:migrate --trace
script:
- 'bundle exec rubocop -Dc .rubocop.yml'
- 'bundle exec haml-lint app/views'
- 'bundle exec rspec --color --format documentation'
- "./travis_script.sh $TEST_SUITE"
env:
- TEST_SUITE=rspec
- TEST_SUITE=linters
matrix:
fast_finish: true

View file

@ -128,6 +128,7 @@ gem 'country_select'
gem 'prawn_rails'
# to render XLS spreadsheets
gem 'axlsx', git: 'https://github.com/randym/axlsx.git'
gem 'axlsx_rails'
# as error catcher
@ -178,7 +179,7 @@ gem 'cloudinary'
# for setting app configuration in the environment
gem 'dotenv-rails'
# For countable.js
# For countable.js
gem "countable-rails", "~> 0.0.1"
# Both are not in a group as we use it also for rake data:demo

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
remote: https://rubygems.org/
remote: https://rails-assets.org/
@ -65,10 +75,6 @@ GEM
awesome_nested_set (3.0.0.rc.5)
activerecord (>= 4.0.0, < 5)
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 (>= 2.0.1)
rails (>= 3.1)
@ -262,6 +268,7 @@ GEM
mime-types (>= 1.16, < 3)
method_source (0.8.2)
mime-types (2.99.1)
mimemagic (0.3.2)
mina (0.3.8)
open4 (~> 1.3.4)
rake
@ -551,6 +558,7 @@ DEPENDENCIES
ahoy_matey
autoprefixer-rails
awesome_nested_set (~> 3.0.0.rc.5)
axlsx!
axlsx_rails
bootstrap-sass (~> 3.3.4.1)
bootstrap-switch-rails (~> 3.0.0)

View file

@ -1,6 +1,6 @@
class EventUser < ActiveRecord::Base
# 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 :user

View file

@ -2,7 +2,7 @@ namespace :data do
desc 'Sets conference_id in all pre-existing PaperTrail::Version objects'
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
if version.item_type == 'Conference'
version.update_attributes(conference_id: version.item_id)

View file

@ -4,7 +4,7 @@ describe UsersHelper, type: :helper do
describe 'show_roles' 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)'
end
end

View file

@ -141,7 +141,7 @@ describe Program do
describe '#cfp_open?' do
describe 'returns true' 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
end
end
@ -152,7 +152,7 @@ describe Program do
end
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
end
end

View file

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