diff --git a/.circleci/config.yml b/.circleci/config.yml index e455ed353..041879643 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,19 +22,22 @@ jobs: - run: sudo apt-get update; sudo apt-get install libreoffice libreoffice-calc unoconv - run: sudo apt-get install ruby-railties-4.0 bundler - run: sudo apt-get install qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x - - run: yes | gem uninstall bundler - - run: gem install bundler -v 1.17.3 - - run: bundle install + - run: sudo apt-get install xvfb + - run: gem install bundler + - restore_cache: + key: v1-{{checksum "Gemfile.lock" }} + - run: bundle install --path vendor/bundle + - save_cache: + key: v1-{{checksum "Gemfile.lock" }} + paths: "vendor/bundle" - run: bundle exec rake assets:precompile - run: echo -e "export RAILS_ENV=test\nexport RACK_ENV=test" >> $BASH_ENV - - run: 'bundle check --path=vendor/bundle || bundle install --path=vendor/bundle - --jobs=4 --retry=3 ' # database: override: - run: bundle exec rake db:preprep - run: RAILS_ENV=test bundle exec rake db:migrate --trace - run: bundle exec rake db:test:prepare # Test - - run: rake + - run: xvfb-run -a bundle exec rake # Run blackduck security scan after test - run: bash <(curl -s https://copilot.blackducksoftware.com/ci/circle2/scripts/upload) # Save test results diff --git a/.gitignore b/.gitignore index cb96475f7..caa7dbf61 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ # Ignore bundler config /.bundle /.bundler +vendor/bundle # Ignore the default SQLite database. /db/*.sqlite3 @@ -45,3 +46,5 @@ coffeelint.json .elasticbeanstalk/* !.elasticbeanstalk/*.cfg.yml !.elasticbeanstalk/*.global.yml + +vendor/* \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 6ad73208d..a27096495 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,3 @@ -GIT - remote: https://github.com/jetthoughts/yaml_db.git - revision: 5f73cbd14adee939adf08574ec3bf6e05ee55889 - specs: - yaml_db (0.2.3) - GIT remote: https://github.com/ambethia/recaptcha revision: 76c2f58ee906ed591662d552c6be383024af11d6 @@ -47,6 +41,12 @@ GIT rails (~> 4) sass +GIT + remote: https://github.com/jetthoughts/yaml_db + revision: 5f73cbd14adee939adf08574ec3bf6e05ee55889 + specs: + yaml_db (0.2.3) + GEM remote: https://rubygems.org/ specs: @@ -83,19 +83,18 @@ GEM auto_html (1.6.4) redcarpet (~> 3.1) rinku (~> 1.5.0) - autoprefixer-rails (5.1.7) + autoprefixer-rails (9.8.5) execjs - json - bcrypt (3.1.12) + bcrypt (3.1.13) bcrypt-ruby (3.1.5) bcrypt (>= 3.1.3) - benchmark-ips (2.7.2) - bootstrap-sass (3.3.3) - autoprefixer-rails (>= 5.0.0.1) - sass (>= 3.2.19) + benchmark-ips (2.8.2) + bootstrap-sass (3.4.1) + autoprefixer-rails (>= 5.2.1) + sassc (>= 2.0.0) bootstrap-switch-rails (3.3.2) browser (0.8.0) - builder (3.2.3) + builder (3.2.4) byebug (9.0.6) capybara (2.4.4) mime-types (>= 1.16) @@ -127,21 +126,22 @@ GEM coffee-script execjs json - concurrent-ruby (1.1.5) + concurrent-ruby (1.1.6) derailed (0.1.0) derailed_benchmarks - derailed_benchmarks (1.3.5) + derailed_benchmarks (1.6.0) benchmark-ips (~> 2) get_process_mem (~> 0) heapy (~> 0) memory_profiler (~> 0) rack (>= 1) - rake (> 10, < 13) - thor (~> 0.19) - devise (4.6.2) + rake (> 10, < 14) + ruby-statistics (>= 2.1) + thor (>= 0.19, < 2) + devise (4.7.2) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 4.1.0, < 6.0) + railties (>= 4.1.0) responders warden (~> 1.2.3) diff-lcs (1.3) @@ -154,21 +154,22 @@ GEM execjs (2.7.0) faraday (0.9.2) multipart-post (>= 1.2, < 3) - ffi (1.10.0) + ffi (1.13.1) filigree (0.3.3) font-awesome-rails (4.4.0.0) railties (>= 3.2, < 5.0) - get_process_mem (0.2.3) - handlebars (0.6.0) - handlebars-source (~> 1.3.0) - therubyracer (~> 0.12.0) - handlebars-source (1.3.0) + get_process_mem (0.2.5) + ffi (~> 1.0) + handlebars (0.8.0) + handlebars-source (~> 4.0.5) + therubyracer (~> 0.12.1) + handlebars-source (4.0.14) handlebars_assets (0.18) execjs (>= 1.2.9) multi_json sprockets (>= 2.0.3) tilt - hashie (3.4.3) + hashie (3.6.0) heapy (0.1.4) hike (1.2.3) html5_validator (1.0.0) @@ -197,28 +198,29 @@ GEM jwt (1.5.4) launchy (2.4.3) addressable (~> 2.3) - libv8 (3.16.14.7) + libv8 (3.16.14.19) mail (2.7.1) mini_mime (>= 0.1.1) - memory_profiler (0.9.13) + memory_profiler (0.9.14) mime-types (3.2.2) mime-types-data (~> 3.2015) mime-types-data (3.2019.0331) - mini_magick (4.0.1) + mini_magick (4.10.1) mini_mime (1.0.1) mini_portile2 (2.4.0) - minitest (5.11.3) + minitest (5.14.1) minitest-reporters (1.0.8) ansi builder minitest (>= 5.0) ruby-progressbar modernizr-rails (2.7.1) - multi_json (1.13.1) + multi_json (1.15.0) multi_xml (0.5.5) multipart-post (2.0.0) netrc (0.11.0) - nokogiri (1.9.1) + nio4r (2.5.2) + nokogiri (1.10.10) mini_portile2 (~> 2.4.0) oauth2 (1.0.0) faraday (>= 0.8, < 0.10) @@ -226,7 +228,7 @@ GEM multi_json (~> 1.3) multi_xml (~> 0.5) rack (~> 1.2) - omniauth (1.3.2) + omniauth (1.4.2) hashie (>= 1.2, < 4) rack (>= 1.0, < 3) omniauth-google-oauth2 (0.4.1) @@ -242,9 +244,10 @@ GEM ast (~> 2.2) pg (0.17.1) powerpack (0.0.9) - puma (3.7.1) + puma (4.3.5) + nio4r (~> 2.0) rack (1.5.5) - rack-cors (0.4.1) + rack-cors (1.0.3) rack-test (0.6.3) rack (>= 1.0) rails (4.1.16) @@ -264,12 +267,12 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.0.0) - rake (12.3.2) - rb-fsevent (0.10.3) - rb-inotify (0.10.0) + rake (13.0.1) + rb-fsevent (0.10.4) + rb-inotify (0.10.1) ffi (~> 1.0) - redcarpet (3.2.2) - ref (1.0.5) + redcarpet (3.5.0) + ref (2.0.0) remotipart (1.2.1) responders (1.1.2) railties (>= 3.2, < 4.2) @@ -303,12 +306,15 @@ GEM ruby-ole (1.2.11.8) ruby-prof (0.18.0) ruby-progressbar (1.7.1) - rubyzip (1.2.2) + ruby-statistics (2.1.2) + rubyzip (1.3.0) sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) + sassc (2.4.0) + ffi (~> 1.9) selenium-webdriver (2.46.1) childprocess (~> 0.5) multi_json (~> 1.0) @@ -319,7 +325,6 @@ GEM multi_json (~> 1.0) simplecov-html (~> 0.8.0) simplecov-html (0.8.0) - slop (3.6.0) spreadsheet (1.0.0) ruby-ole (>= 1.0) sprockets (2.12.5) @@ -334,15 +339,15 @@ GEM sqlite3 (1.3.10) summernote-rails (0.5.10.2) railties (>= 3.1) - therubyracer (0.12.1) - libv8 (~> 3.16.14.0) + therubyracer (0.12.3) + libv8 (~> 3.16.14.15) ref - thor (0.20.3) + thor (1.0.1) thread_safe (0.3.6) tilt (1.4.1) touchpunch-rails (1.0.3) railties (>= 3.1) - tzinfo (1.2.5) + tzinfo (1.2.7) thread_safe (~> 0.1) uglifier (2.6.1) execjs (>= 0.3.0) diff --git a/app/assets/javascripts/visualizations/highvis/table.coffee b/app/assets/javascripts/visualizations/highvis/table.coffee index 8b4c2ce7f..bba5878ea 100644 --- a/app/assets/javascripts/visualizations/highvis/table.coffee +++ b/app/assets/javascripts/visualizations/highvis/table.coffee @@ -200,12 +200,15 @@ $ -> search: false @table.jqGrid('navGrid','#toolbar_bottom', params) + operands = { "eq": "=", "ne": "!", "lt": "<", "le": "<=", "gt": ">", "ge": ">=", "bw": "^", "bn": "!^", "in": "=", "ni": "!=", "ew": "|", "en": "!@", "cn": "~", "nc": "!~", "nu": "#", "nn": "!#" } + params = stringResult: true searchOnEnter: false searchOperators: true operandTitle: 'Select Search Operation' resetIcon: '' + operands: operands @table.jqGrid('filterToolbar', params) # Set the time column formatters @@ -229,7 +232,7 @@ $ -> # Restore the search filter type and operator symbol operator = $('#' + inputId).closest('tr').find('.soptclass') $(operator).attr('soper', column.op) - operands = { "eq": "==", "ne": "!", "lt": "<", "le": "<=", \ + operands = { "eq": "=", "ne": "!", "lt": "<", "le": "<=", \ "gt": ">", "ge": ">=", "bw": "^", "bn": "!^", \ "in": "=", "ni": "!=", "ew": "|", "en": "!@", \ "cn": "~", "nc": "!~", "nu": "#", "nn": "!#" } diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 154aa0e24..b0f14fa51 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -17,7 +17,7 @@ def index sort = 'updated_at' end - if !params[:order].nil? + if !params[:order].nil? and ['ASC', 'DESC'].include? params[:order] order = params[:order] else order = 'DESC' diff --git a/app/controllers/visualizations_controller.rb b/app/controllers/visualizations_controller.rb index ded16f2ae..dee2af07e 100644 --- a/app/controllers/visualizations_controller.rb +++ b/app/controllers/visualizations_controller.rb @@ -19,13 +19,13 @@ def index # Main List @params = params - if !params[:sort].nil? + if !params[:sort].nil? and ['created_at', 'updated_at'].include? params[:sort] sort = params[:sort] else sort = 'created_at' end - if !params[:order].nil? + if !params[:order].nil? and ['ASC', 'DESC'].include? params[:order] order = params[:order] else order = 'DESC' diff --git a/test/unit/news_test.rb b/test/unit/news_test.rb index 3cebe6b32..c0199f343 100644 --- a/test/unit/news_test.rb +++ b/test/unit/news_test.rb @@ -27,8 +27,16 @@ def setup def base_asserts(obj, h) assert_equal obj.id, h[:id] - assert_equal obj.featured_media_id, h[:featuredMediaId] - assert_equal obj.title, h[:name] + if obj.featured_media_id + assert_equal obj.featured_media_id, h[:featuredMediaId] + else + assert_nil h[:featuredMediaId] + end + if obj.title + assert_equal obj.title, h[:name] + else + assert_nil h[:name] + end assert_equal obj.hidden, h[:hidden] assert_equal h[:timeAgoInWords], @year_diff assert_equal h[:createdAt], @year_text diff --git a/test/unit/tutorial_test.rb b/test/unit/tutorial_test.rb index 6b0a5b437..45177dc1c 100644 --- a/test/unit/tutorial_test.rb +++ b/test/unit/tutorial_test.rb @@ -24,7 +24,7 @@ def base_asserts(h, keys) assert_equal h[:id], @sample_id assert_equal h[:name], @sample_name assert_equal h[:category], @sample_category - assert_equal h[:youtubeUrl], @sample_url + assert_nil h[:youtubeUrl], @sample_url keys.each do |x| assert !h[x.to_sym].nil? assert !h[x.to_sym].empty? diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb index 2a2f1a061..23e97cb23 100644 --- a/test/unit/user_test.rb +++ b/test/unit/user_test.rb @@ -25,7 +25,11 @@ def setup # Passes if password_confirmation and password match test 'password_confirmation matches password' do - assert_equal @user.password, @user.password_confirmation, 'Password_confirmation does not match password.' + if @user.password + assert_equal @user.password, @user.password_confirmation, 'Password_confirmation does not match password.' + else + assert_nil @user.password_confirmation, 'Password_confirmation does not match password.' + end end # ---------------------------------------------------