diff options
| author | RobertDober | 2017-04-11 17:25:06 +0200 |
|---|---|---|
| committer | RobertDober | 2017-04-11 17:25:06 +0200 |
| commit | 4a733e13aafd9cc6ff176892e853cd4f2cd13088 (patch) | |
| tree | 62ecda89ed448f38f3f1b4c9606c6278d57dbdb3 | |
| parent | c23203bf14150cfb2930e6250c0b485f8205c23e (diff) | |
| parent | 3228431fc7e96354df280ade84eb7c7c9f5d9c7f (diff) | |
| download | chouette-core-4a733e13aafd9cc6ff176892e853cd4f2cd13088.tar.bz2 | |
Merge branch 'update_rails_for_master'
61 files changed, 1816 insertions, 700 deletions
@@ -1,8 +1,10 @@ # coding: iso-8859-1 source 'http://rubygems.org' +ruby '2.3.1' + # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 4.1.10' +gem 'rails', '~> 4.2.8' # Use SCSS for stylesheets gem 'sass-rails', '~> 4.0.3' @@ -56,7 +58,7 @@ platforms :ruby do gem 'sqlite3' end -gem 'activerecord-postgis-adapter' +gem 'activerecord-postgis-adapter', "~> 3.0.0" gem 'polylines' # Codifligne API @@ -82,11 +84,11 @@ gem 'georuby', '2.3.0' # Fix version for georuby-ext because api has changed gem 'mimemagic' # User interface -gem 'language_engine', '0.0.6' +gem 'language_engine', github: 'af83/language_engine' gem 'calendar_helper', '0.2.5' gem 'cocoon' gem 'slim-rails', '~> 3.1' -gem 'formtastic', '2.3.1' +gem 'formtastic', '3.1.5' gem 'RedCloth', '~> 4.3.0' gem 'simple_form', '~> 3.1.0' gem 'font-awesome-sass', '~> 4.7' @@ -105,15 +107,14 @@ gem 'google-analytics-rails' # Model gem 'will_paginate' gem 'ransack' -gem 'squeel' +gem "squeel", :git => "git://github.com/activerecord-hackery/squeel.git" gem 'active_attr' gem 'draper' gem 'enumerize', '~> 0.10.0' -gem 'foreigner', '~> 1.7.4' gem 'deep_cloneable', '~> 2.0.0' -gem 'acts-as-taggable-on', '>= 3' +gem 'acts-as-taggable-on', '~> 4.0.0' gem 'acts_as_list', '~> 0.6.0' gem 'acts_as_tree', '~> 2.1.0', require: 'acts_as_tree' @@ -137,11 +138,11 @@ group :development do gem 'capistrano-ext' gem 'capistrano-npm', require: false gem 'guard' - gem 'guard-rspec' + gem 'guard-rspec', "~> 4.5.0" gem 'rails-erd' # MetaRequest is incompatible with rgeo-activerecord # gem 'meta_request' - gem 'quiet_assets', '~> 1.0' + gem 'quiet_assets' gem 'license_finder' gem 'bundler-audit' @@ -166,7 +167,8 @@ end group :test, :development do gem 'awesome_print' gem 'pry-rails' - gem 'rspec-rails', '~> 3.1.0' + gem 'pry-byebug' + gem 'rspec-rails', '~> 3.5.0' gem 'fakeweb' gem 'webmock' gem 'capybara', '~> 2.4.0' @@ -177,7 +179,7 @@ group :test, :development do gem 'rb-inotify', require: RUBY_PLATFORM.include?('linux') && 'rb-inotify' gem 'rb-fsevent', require: RUBY_PLATFORM.include?('darwin') && 'rb-fsevent' gem 'transpec' - gem 'shoulda-matchers' + gem 'shoulda-matchers', '~> 3.1' gem "teaspoon-jasmine" gem "phantomjs" end diff --git a/Gemfile.lock b/Gemfile.lock index 1ed5de7ae..8be60d573 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,4 +1,20 @@ GIT + remote: git://github.com/activerecord-hackery/squeel.git + revision: 5542266d502db8022e14105f9dfb455a79d6fc4a + specs: + squeel (1.2.3) + activerecord (>= 3.0) + activesupport (>= 3.0) + polyamorous (~> 1.1.0) + +GIT + remote: git://github.com/af83/language_engine.git + revision: 591595e0262e0ee5f97fa4cf837cefbcf37a6c56 + specs: + language_engine (0.0.6) + rails (~> 4.2) + +GIT remote: git://github.com/af83/whenever.git revision: b7963381a11243affe4f35881c85be0710f434e3 specs: @@ -16,14 +32,14 @@ GIT GIT remote: git@github.com:AF83/stif-codifline-api.git - revision: 9afe38cce298165765d98936f6d63f8d3cc33bce + revision: 72d53d7666736523b5cbef41a2de7e466d58ea1a specs: codifligne (0.0.2) nokogiri (~> 1.6) GIT remote: git@github.com:AF83/stif-reflex-api.git - revision: 7c517b98c3900c9bb0b81dd0ccab97f8e8f5f249 + revision: 2c01010dce3a6cb39339995c373faf89ae00f3f3 specs: reflex (0.0.1) nokogiri (~> 1.6) @@ -34,69 +50,77 @@ GEM specs: RedCloth (4.3.2) SyslogLogger (2.0) - aasm (4.5.2) - actionmailer (4.1.10) - actionpack (= 4.1.10) - actionview (= 4.1.10) + aasm (4.11.1) + actionmailer (4.2.8) + actionpack (= 4.2.8) + actionview (= 4.2.8) + activejob (= 4.2.8) mail (~> 2.5, >= 2.5.4) - actionpack (4.1.10) - actionview (= 4.1.10) - activesupport (= 4.1.10) - rack (~> 1.5.2) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (4.2.8) + actionview (= 4.2.8) + activesupport (= 4.2.8) + rack (~> 1.6) rack-test (~> 0.6.2) - actionview (4.1.10) - activesupport (= 4.1.10) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (4.2.8) + activesupport (= 4.2.8) builder (~> 3.1) erubis (~> 2.7.0) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.3) active_attr (0.9.0) activemodel (>= 3.0.2, < 5.1) activesupport (>= 3.0.2, < 5.1) - activemodel (4.1.10) - activesupport (= 4.1.10) + activejob (4.2.8) + activesupport (= 4.2.8) + globalid (>= 0.3.0) + activemodel (4.2.8) + activesupport (= 4.2.8) builder (~> 3.1) - activerecord (4.1.10) - activemodel (= 4.1.10) - activesupport (= 4.1.10) - arel (~> 5.0.0) - activerecord-postgis-adapter (2.2.2) - activerecord (>= 4.0.0, < 4.2.0) - rgeo-activerecord (~> 1.2) - activesupport (4.1.10) - i18n (~> 0.6, >= 0.6.9) - json (~> 1.7, >= 1.7.7) + activerecord (4.2.8) + activemodel (= 4.2.8) + activesupport (= 4.2.8) + arel (~> 6.0) + activerecord-postgis-adapter (3.0.0) + activerecord (~> 4.2) + rgeo-activerecord (~> 4.0) + activesupport (4.2.8) + i18n (~> 0.7) minitest (~> 5.1) - thread_safe (~> 0.1) + thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - acts-as-taggable-on (3.5.0) - activerecord (>= 3.2, < 5) + acts-as-taggable-on (4.0.0) + activerecord (>= 4.0) acts_as_list (0.6.0) activerecord (>= 3.0) acts_as_tree (2.1.0) activerecord (>= 3.0.0) - addressable (2.3.7) - apartment (1.0.0) + addressable (2.3.8) + apartment (1.0.2) activerecord (>= 3.1.2, < 5.0) rack (>= 1.3.6) - arel (5.0.1.20140414130214) - ast (2.0.0) - astrolabe (1.3.0) - parser (>= 2.2.0.pre.3, < 3.0) - awesome_print (1.6.1) + arel (6.0.4) + ast (2.3.0) + astrolabe (1.3.1) + parser (~> 2.2) + awesome_print (1.7.0) bcrypt (3.1.11) - bcrypt (3.1.11-java) better_errors (2.1.1) coderay (>= 1.0.0) erubis (>= 2.6.6) rack (>= 0.9.0) binding_of_caller (0.7.2) debug_inspector (>= 0.0.1) - breadcrumbs_on_rails (2.3.0) + breadcrumbs_on_rails (3.0.1) browserify-rails (1.1.0) railties (>= 4.0.0, < 5.0) - builder (3.2.2) + builder (3.2.3) bundler-audit (0.5.0) bundler (~> 1.2) thor (~> 0.18) + byebug (9.0.6) calendar_helper (0.2.5) open4 capistrano (2.13.5) @@ -119,23 +143,20 @@ GEM activemodel (>= 4.0.0) activesupport (>= 4.0.0) mime-types (>= 1.16) - celluloid (0.16.0) - timers (~> 4.0.0) - choice (0.1.7) + choice (0.2.0) chronic (0.10.2) cliver (0.3.2) - cocoon (1.2.6) - coderay (1.1.0) + cocoon (1.2.9) + coderay (1.1.1) coffee-rails (4.0.1) coffee-script (>= 2.2.0) railties (>= 4.0.0, < 5.0) - coffee-script (2.3.0) + coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.9.1) + coffee-script-source (1.11.1) concurrent-ruby (1.0.2) - concurrent-ruby (1.0.2-java) - connection_pool (2.2.0) + connection_pool (2.2.1) crack (0.4.3) safe_yaml (~> 1.0.0) cucumber (2.4.0) @@ -148,16 +169,16 @@ GEM multi_test (>= 0.1.2) cucumber-core (1.5.0) gherkin (~> 4.0) - cucumber-rails (1.4.4) + cucumber-rails (1.4.5) capybara (>= 1.1.2, < 3) - cucumber (>= 1.3.8, < 3) + cucumber (>= 1.3.8, < 4) mime-types (>= 1.16, < 4) nokogiri (~> 1.5) railties (>= 3, < 5.1) cucumber-wire (0.0.1) - daemons (1.1.9) - database_cleaner (1.4.1) - dbf (3.0.3) + daemons (1.2.4) + database_cleaner (1.5.3) + dbf (3.0.8) debug_inspector (0.0.2) deep_cloneable (2.0.2) activerecord (>= 3.1.0, < 5.0.0) @@ -168,16 +189,16 @@ GEM responders thread_safe (~> 0.1) warden (~> 1.2.3) - devise-async (0.9.0) - devise (~> 3.2) + devise-async (0.10.2) + devise (>= 3.2, < 4.0) devise-encryptable (0.2.0) devise (>= 2.1.0) - devise-i18n (0.11.4) - devise_cas_authenticatable (1.9.0) + devise-i18n (1.1.1) + devise_cas_authenticatable (1.9.2) devise (>= 1.2.0) rubycas-client (>= 2.2.1) - devise_invitable (1.4.1) - actionmailer (>= 3.2.6, < 5) + devise_invitable (1.6.1) + actionmailer (>= 3.2.6) devise (>= 3.2.0) diff-lcs (1.2.5) docile (1.1.5) @@ -195,32 +216,29 @@ GEM enumerize (0.10.1) activesupport (>= 3.2) erubis (2.7.0) - execjs (2.6.0) + execjs (2.7.0) fabrication (2.14.1) - factory_girl (4.5.0) + factory_girl (4.7.0) activesupport (>= 3.0.0) - factory_girl_rails (4.5.0) - factory_girl (~> 4.5.0) + factory_girl_rails (4.7.0) + factory_girl (~> 4.7.0) railties (>= 3.0.0) faker (1.7.3) i18n (~> 0.5) fakeweb (1.3.0) - faraday (0.9.1) + faraday (0.9.2) multipart-post (>= 1.2, < 3) - faraday_middleware (0.9.1) + faraday_middleware (0.9.2) faraday (>= 0.7.4, < 0.10) ffaker (2.1.0) - ffi (1.9.10) - ffi (1.9.10-java) - ffi-geos (1.1.0) + ffi (1.9.14) + ffi-geos (1.1.1) ffi (>= 1.0.0) font-awesome-sass (4.7.0) sass (>= 3.2) - foreigner (1.7.4) - activerecord (>= 3.0.0) formatador (0.2.5) - formtastic (2.3.1) - actionpack (>= 3.0) + formtastic (3.1.5) + actionpack (>= 3.2.13) geokit (1.6.7) multi_json (>= 1.3.2) georuby (2.3.0) @@ -233,10 +251,12 @@ GEM georuby (>= 1.9.8) rgeo (>= 0.3.20) gherkin (4.0.0) - google-analytics-rails (0.0.6) - guard (2.12.4) + globalid (0.3.7) + activesupport (>= 4.1.0) + google-analytics-rails (1.1.0) + guard (2.14.0) formatador (>= 0.2.4) - listen (~> 2.7) + listen (>= 2.7, < 4.0) lumberjack (~> 1.0) nenv (~> 0.1) notiffany (~> 0.0) @@ -244,210 +264,212 @@ GEM shellany (~> 0.0) thor (>= 0.18.1) guard-compat (1.2.1) - guard-rspec (4.5.0) + guard-rspec (4.5.2) guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) has_scope (0.6.0) actionpack (>= 3.2, < 5) activesupport (>= 3.2, < 5) - hashdiff (0.3.0) - highline (1.7.1) + hashdiff (0.3.1) + highline (1.7.8) hike (1.2.3) - hitimes (1.2.2) - hitimes (1.2.2-java) httparty (0.14.0) multi_xml (>= 0.5.2) - i18n (0.7.0) - i18n-tasks (0.8.6) - activesupport + i18n (0.8.1) + i18n-tasks (0.9.6) + activesupport (>= 4.0.2) + ast (>= 2.1.0) easy_translate (>= 0.5.0) erubis - highline + highline (>= 1.7.3) i18n - term-ansicolor + parser (>= 2.2.3.0) + term-ansicolor (>= 1.3.2) terminal-table (>= 1.5.1) inherited_resources (1.6.0) actionpack (>= 3.2, < 5) has_scope (~> 0.6.0.rc) railties (>= 3.2, < 5) responders - jbuilder (2.2.11) - activesupport (>= 3.0.0, < 5) + jbuilder (2.6.1) + activesupport (>= 3.0.0, < 5.1) multi_json (~> 1.2) jquery-rails (3.1.4) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) - json (1.8.3) - json (1.8.3-java) - language_engine (0.0.6) - rails (~> 4.1.1) + json (1.8.6) launchy (2.4.3) addressable (~> 2.3) - launchy (2.4.3-java) - addressable (~> 2.3) - spoon (~> 0.0.1) letter_opener (1.4.1) launchy (~> 2.2) - libv8 (3.16.14.11) + libv8 (3.16.14.17) license_finder (2.1.2) bundler httparty rubyzip thor xml-simple - listen (2.8.6) - celluloid (>= 0.15.2) - rb-fsevent (>= 0.9.3) - rb-inotify (>= 0.9) - lumberjack (1.0.9) - mail (2.6.3) - mime-types (>= 1.16, < 3) + listen (3.1.5) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + ruby_dep (~> 1.2) + loofah (2.0.3) + nokogiri (>= 1.5.9) + lumberjack (1.0.10) + mail (2.6.4) + mime-types (>= 1.16, < 4) map_layers (0.0.4) method_source (0.8.2) - mime-types (2.4.3) - mimemagic (0.3.0) + mime-types (3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0521) + mimemagic (0.3.2) mini_portile2 (2.1.0) - minitest (5.9.1) - multi_json (1.11.2) + minitest (5.10.1) + multi_json (1.12.1) multi_test (0.1.2) - multi_xml (0.5.5) + multi_xml (0.6.0) multipart-post (2.0.0) - nenv (0.2.0) + nenv (0.3.0) net-scp (1.2.1) net-ssh (>= 2.6.5) net-sftp (2.1.2) net-ssh (>= 2.6.5) - net-ssh (2.9.2) + net-ssh (3.2.0) net-ssh-gateway (1.2.0) net-ssh (>= 2.6.5) - newrelic_rpm (3.11.2.286) - nokogiri (1.7.0.1) + newrelic_rpm (3.17.1.326) + nokogiri (1.7.1) mini_portile2 (~> 2.1.0) - nokogiri (1.7.0.1-java) - notiffany (0.0.6) + notiffany (0.1.1) nenv (~> 0.1) shellany (~> 0.0) open4 (1.3.4) orm_adapter (0.5.0) - parser (2.2.0.3) - ast (>= 1.1, < 3.0) + parser (2.3.3.1) + ast (~> 2.2) pg (0.19.0) phantomjs (2.1.1.0) - poltergeist (1.6.0) + poltergeist (1.12.0) capybara (~> 2.1) cliver (~> 0.3.1) - multi_json (~> 1.0) websocket-driver (>= 0.2.0) polyamorous (1.1.0) activerecord (>= 3.0) polylines (0.3.0) - pry (0.10.1) - coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - pry (0.10.1-java) + pry (0.10.4) coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) - spoon (~> 0.0) + pry-byebug (3.4.2) + byebug (~> 9.0) + pry (~> 0.10) pry-rails (0.3.4) pry (>= 0.9.10) pundit (1.1.0) activesupport (>= 3.0.0) quiet_assets (1.1.0) railties (>= 3.1, < 5.0) - rabl (0.11.6) + rabl (0.13.1) activesupport (>= 2.3.14) - rack (1.5.5) + rack (1.6.5) rack-protection (1.5.3) rack rack-test (0.6.3) rack (>= 1.0) - rails (4.1.10) - actionmailer (= 4.1.10) - actionpack (= 4.1.10) - actionview (= 4.1.10) - activemodel (= 4.1.10) - activerecord (= 4.1.10) - activesupport (= 4.1.10) + rails (4.2.8) + actionmailer (= 4.2.8) + actionpack (= 4.2.8) + actionview (= 4.2.8) + activejob (= 4.2.8) + activemodel (= 4.2.8) + activerecord (= 4.2.8) + activesupport (= 4.2.8) bundler (>= 1.3.0, < 2.0) - railties (= 4.1.10) - sprockets-rails (~> 2.0) - rails-assets-bootstrap-sass-official (3.3.4) - rails-assets-jquery (>= 1.9.0) + railties (= 4.2.8) + sprockets-rails + rails-assets-bootstrap-sass-official (3.3.7) + rails-assets-jquery (>= 1.9.1, < 4) rails-assets-footable (2.0.3) rails-assets-jquery (>= 1.4.4) - rails-assets-jquery (2.1.4) + rails-assets-jquery (3.1.1) rails-assets-jquery-tokeninput (1.7.0) rails-assets-jquery (>= 1.5) rails-assets-modernizr (2.0.6) rails-assets-respond (1.4.2) rails-assets-tagmanager (3.0.1) rails-assets-jquery (>= 1.0.0) - rails-erd (1.3.1) + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.8) + activesupport (>= 4.2.0.beta, < 5.0) + nokogiri (~> 1.6) + rails-deprecated_sanitizer (>= 1.0.1) + rails-erd (1.5.0) activerecord (>= 3.2) activesupport (>= 3.2) - choice (~> 0.1.6) - ruby-graphviz (~> 1.0.4) - rails-i18n (4.0.4) - i18n (~> 0.6) + choice (~> 0.2.0) + ruby-graphviz (~> 1.2) + rails-html-sanitizer (1.0.3) + loofah (~> 2.0) + rails-i18n (4.0.9) + i18n (~> 0.7) railties (~> 4.0) rails-observers (0.1.2) activemodel (~> 4.0) - railties (4.1.10) - actionpack (= 4.1.10) - activesupport (= 4.1.10) + railties (4.2.8) + actionpack (= 4.2.8) + activesupport (= 4.2.8) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rainbow (2.0.0) - rake (11.3.0) - ransack (1.6.3) + rainbow (2.1.0) + rake (12.0.0) + ransack (1.6.5) actionpack (>= 3.0) activerecord (>= 3.0) activesupport (>= 3.0) i18n polyamorous (~> 1.1) - rb-fsevent (0.9.4) - rb-inotify (0.9.5) + rb-fsevent (0.9.8) + rb-inotify (0.9.7) ffi (>= 0.5.0) - rdoc (4.2.0) - json (~> 1.4) - redis (3.3.1) + rdoc (4.3.0) + redis (3.3.2) ref (2.0.0) request_store (1.3.1) - responders (1.1.2) - railties (>= 3.2, < 4.2) - rgeo (0.5.2) - rgeo-activerecord (1.2.0) - activerecord (~> 4.0) + responders (2.3.0) + railties (>= 4.2.0, < 5.1) + rgeo (0.5.3) + rgeo-activerecord (4.0.5) + activerecord (~> 4.2) rgeo (~> 0.3) - roo (1.13.2) - nokogiri - rubyzip - spreadsheet (> 0.6.4) - rspec (3.1.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-core (3.1.7) - rspec-support (~> 3.1.0) - rspec-expectations (3.1.2) + roo (2.5.1) + nokogiri (~> 1) + rubyzip (~> 1.1, < 2.0.0) + rspec (3.5.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-core (3.5.4) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-mocks (3.5.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.1.0) - rspec-mocks (3.1.3) - rspec-support (~> 3.1.0) - rspec-rails (3.1.0) + rspec-support (~> 3.5.0) + rspec-rails (3.5.2) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-support (~> 3.1.0) - rspec-support (3.1.2) - ruby-graphviz (1.0.9) - ruby-ole (1.2.11.8) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) + ruby-graphviz (1.2.2) + ruby_dep (1.5.0) rubycas-client (2.3.9) activesupport rubyzip (1.1.7) @@ -461,24 +483,25 @@ GEM sawyer (0.6.0) addressable (~> 2.3.5) faraday (~> 0.8, < 0.10) - sdoc (0.4.1) + sdoc (0.4.2) json (~> 1.7, >= 1.7.7) rdoc (~> 4.0) select2-rails (4.0.3) thor (~> 0.14) shellany (0.0.1) - shoulda-matchers (2.8.0) - activesupport (>= 3.0.0) - sidekiq (4.1.0) + shoulda-matchers (3.1.1) + activesupport (>= 4.0.0) + sidekiq (4.2.7) concurrent-ruby (~> 1.0) connection_pool (~> 2.2, >= 2.2.0) + rack-protection (>= 1.5.0) redis (~> 3.2, >= 3.2.1) - simple_form (3.1.0) + simple_form (3.1.1) actionpack (~> 4.0) activemodel (~> 4.0) - simplecov (0.10.0) + simplecov (0.12.0) docile (~> 1.1.0) - json (~> 1.8) + json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.0) simplecov-rcov (0.2.3) @@ -490,75 +513,66 @@ GEM slim (3.0.7) temple (~> 0.7.6) tilt (>= 1.3.3, < 2.1) - slim-rails (3.1.0) + slim-rails (3.1.1) actionpack (>= 3.1) railties (>= 3.1) slim (~> 3.0) slop (3.6.0) - spoon (0.0.4) - ffi - spreadsheet (1.0.2) - ruby-ole (>= 1.0) - spring (1.7.2) - sprockets (2.12.3) + spring (2.0.0) + activesupport (>= 4.2) + sprockets (2.12.4) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.2.4) + sprockets-rails (2.3.3) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) - sqlite3 (1.3.10) - squeel (1.2.3) - activerecord (>= 3.0) - activesupport (>= 3.0) - polyamorous (~> 1.1.0) + sqlite3 (1.3.12) teaspoon (1.1.5) railties (>= 3.2.5, < 6) teaspoon-jasmine (2.3.4) teaspoon (>= 1.0.0) temple (0.7.7) - term-ansicolor (1.3.2) + term-ansicolor (1.4.0) tins (~> 1.0) - terminal-table (1.6.0) + terminal-table (1.7.3) + unicode-display_width (~> 1.1.1) therubyracer (0.12.2) libv8 (~> 3.16.14.0) ref thor (0.19.4) thread (0.2.2) - thread_safe (0.3.5) - thread_safe (0.3.5-java) + thread_safe (0.3.6) tilt (1.4.1) - timers (4.0.1) - hitimes - tins (1.10.2) - transpec (3.1.0) + tins (1.13.0) + transpec (3.2.2) activesupport (>= 3.0, < 5.0) astrolabe (~> 1.2) bundler (~> 1.3) json (~> 1.8) - parser (~> 2.2) + parser (>= 2.3.0.7) rainbow (>= 1.99.1, < 3.0) - turbolinks (2.5.3) - coffee-rails - tzinfo (1.2.2) + turbolinks (5.0.1) + turbolinks-source (~> 5) + turbolinks-source (5.0.0) + tzinfo (1.2.3) thread_safe (~> 0.1) uglifier (2.7.2) execjs (>= 0.3.0) json (>= 1.8.0) + unicode-display_width (1.1.2) warden (1.2.6) rack (>= 1.0) - webmock (2.1.0) + webmock (2.3.1) addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff - websocket-driver (0.5.3) - websocket-extensions (>= 0.1.0) - websocket-driver (0.5.3-java) + websocket-driver (0.6.4) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.2) - will_paginate (3.1.5) + will_paginate (3.0.12) will_paginate-bootstrap (1.0.1) will_paginate (>= 3.0.3) xml-simple (1.1.5) @@ -566,7 +580,6 @@ GEM nokogiri (~> 1.3) PLATFORMS - java ruby DEPENDENCIES @@ -574,8 +587,8 @@ DEPENDENCIES SyslogLogger aasm active_attr - activerecord-postgis-adapter - acts-as-taggable-on (>= 3) + activerecord-postgis-adapter (~> 3.0.0) + acts-as-taggable-on (~> 4.0.0) acts_as_list (~> 0.6.0) acts_as_tree (~> 2.1.0) apartment (~> 1.0.0) @@ -614,20 +627,19 @@ DEPENDENCIES faraday_middleware (~> 0.9.1) ffaker (~> 2.1.0) font-awesome-sass (~> 4.7) - foreigner (~> 1.7.4) - formtastic (= 2.3.1) + formtastic (= 3.1.5) georuby (= 2.3.0) georuby-ext (= 0.0.5) google-analytics-rails guard - guard-rspec + guard-rspec (~> 4.5.0) has_array_of! i18n-tasks inherited_resources jbuilder (~> 2.0) jquery-rails (~> 3.1.4) json - language_engine (= 0.0.6) + language_engine! launchy letter_opener license_finder @@ -638,11 +650,12 @@ DEPENDENCIES phantomjs poltergeist polylines + pry-byebug pry-rails pundit - quiet_assets (~> 1.0) + quiet_assets rabl - rails (~> 4.1.10) + rails (~> 4.2.8) rails-assets-bootstrap-sass-official (~> 3.3.0)! rails-assets-footable (~> 2.0.3)! rails-assets-jquery-tokeninput (~> 1.7.0)! @@ -659,13 +672,13 @@ DEPENDENCIES reflex! rgeo (~> 0.5.2) roo - rspec-rails (~> 3.1.0) + rspec-rails (~> 3.5.0) rubyzip (~> 1.1.7) sass-rails (~> 4.0.3) sawyer (~> 0.6.0) sdoc (~> 0.4.0) select2-rails (~> 4.0, >= 4.0.3) - shoulda-matchers + shoulda-matchers (~> 3.1) sidekiq simple_form (~> 3.1.0) simplecov @@ -674,7 +687,7 @@ DEPENDENCIES slim-rails (~> 3.1) spring sqlite3 - squeel + squeel! teaspoon-jasmine therubyracer (~> 0.12) transpec @@ -685,5 +698,8 @@ DEPENDENCIES will_paginate will_paginate-bootstrap +RUBY VERSION + ruby 2.3.1p112 + BUNDLED WITH - 1.13.6 + 1.14.6 diff --git a/INSTALL.md b/INSTALL.md index 16514d5c4..c8dbf97ba 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -68,3 +68,12 @@ Get yourself an invitation to [Stif Portail](http://stif-portail-dev.af83.priv/) on your [profile page](http://stif-portail-dev.af83.priv/users/edit) +# Troubleshouting + +If PG complains about illegal type `hstore` in your tests that is probably because the shared extension is not installed, here is waht to do: + + bundle exec rake db:schema:dump # if not up to date + + RAILS_ENV=test bundle exec rake db:drop + RAILS_ENV=test bundle exec rake db:create + RAILS_ENV=test bundle exec rake db:schema:load @@ -94,7 +94,7 @@ Configure for Generating URLs in Action Mailer Views. * see [Action Mailer Configuration documentation](http://guides.rubyonrails.org/action_mailer_basics.html) Configure assets access (Must be true if you use Webrick, or false if you use Apache or Nginx). -* Edit [production.rb](./config/environments/production.rb) and change ```config.serve_static_assets``` +* Edit [production.rb](./config/environments/production.rb) and change ```config.serve_static_files``` Configure SMTP settings. * Edit [production.rb](./config/environments/production.rb) and change ```ActionMailer::Base.smtp_settings``` @@ -144,7 +144,7 @@ This task may be added in system start-up configuration. Instead of using WEBrick, Rails application may be deployed on [Phusion Passenger](https://www.phusionpassenger.com/) with an [Apache](http://httpd.apache.org/) or [NGinx](http://nginx.com/) front-end, to make server faster and more robust. Apache like NGinx can serve static resources, -so change parameter ```serve_static_assets``` to false in [production.rb](./config/environments/production.rb) +so change parameter ```serve_static_files``` to false in [production.rb](./config/environments/production.rb) Test ---- diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js index 7837cdbff..1f5e5e98f 100644 --- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js +++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js @@ -6,6 +6,7 @@ var Select2 = require('react-select2') // get JSON full path var origin = window.location.origin var path = window.location.pathname.split('/', 3).join('/') +var line = window.location.pathname.split('/')[4] class BSelect4 extends React.Component{ @@ -27,7 +28,7 @@ class BSelect4 extends React.Component{ width: '100%', placeholder: 'Filtrer par transporteur...', ajax: { - url: origin + path + '/companies.json', + url: origin + path + '/companies.json' + '?line_id=' + line, dataType: 'json', delay: '500', data: function(params) { diff --git a/app/assets/stylesheets/components/_select2.sass b/app/assets/stylesheets/components/_select2.sass index 5e3741bf0..cbb3a80da 100644 --- a/app/assets/stylesheets/components/_select2.sass +++ b/app/assets/stylesheets/components/_select2.sass @@ -50,9 +50,19 @@ .form-filter .form-group.select2ed - .select2-container--bootstrap .select2-selection--single - height: 31px - padding: 4px 24px 5px 12px + .select2-container--bootstrap + .select2-selection--single, .select2-selection--multiple + height: 31px + padding: 0px 3px 4px 6px + + .select2-selection--single + line-height: 31px + + .select2-selection--multiple + min-height: 31px + + .select2-search--inline .select2-search__field + height: 28px .select2-container--bootstrap .select2-selection border-color: rgba($grey, 0.3) diff --git a/app/controllers/referential_companies_controller.rb b/app/controllers/referential_companies_controller.rb index 0966389b4..e8b104d14 100644 --- a/app/controllers/referential_companies_controller.rb +++ b/app/controllers/referential_companies_controller.rb @@ -27,7 +27,12 @@ class ReferentialCompaniesController < ChouetteController end def collection - @q = referential.workbench.companies.search(params[:q]) + scope = referential.line_referential.companies + if params[:line_id] + scope = referential.line_referential.lines.find(params[:line_id]).companies + end + + @q = scope.search(params[:q]) if sort_column && sort_direction @companies ||= @q.result(:distinct => true).order(sort_column + ' ' + sort_direction).paginate(:page => params[:page]) diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index 2e03485f2..cb7c96e03 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -95,7 +95,7 @@ class TimeTablesController < ChouetteController def collection ransack_params = params[:q] # Hack to delete params can't be used by ransack - tag_search = ransack_params["tag_search"].split(",").collect(&:strip) if ransack_params.present? && ransack_params["tag_search"].present? + tag_search = ransack_params["tag_search"] if ransack_params.present? && ransack_params["tag_search"].present? ransack_params.delete("tag_search") if ransack_params.present? selected_time_tables = tag_search ? select_time_tables.tagged_with(tag_search, :wild => true, :any => true) : select_time_tables diff --git a/app/models/chouette/line.rb b/app/models/chouette/line.rb index 50dd9b1b3..f44375e7d 100644 --- a/app/models/chouette/line.rb +++ b/app/models/chouette/line.rb @@ -14,6 +14,7 @@ class Chouette::Line < Chouette::ActiveRecord belongs_to :company belongs_to :network + belongs_to :line_referential has_array_of :secondary_companies, class_name: 'Chouette::Company' @@ -75,4 +76,8 @@ class Chouette::Line < Chouette::ActiveRecord [name, company.try(:name)].compact.join(' - ') end + def companies + line_referential.companies.where(id: ([company_id] + Array(secondary_company_ids)).compact) + end + end diff --git a/app/models/chouette/stop_point.rb b/app/models/chouette/stop_point.rb index b77189fc1..8a3262dd0 100644 --- a/app/models/chouette/stop_point.rb +++ b/app/models/chouette/stop_point.rb @@ -2,7 +2,7 @@ module Chouette class StopPoint < TridentActiveRecord include ForBoardingEnumerations include ForAlightingEnumerations - + # FIXME http://jira.codehaus.org/browse/JRUBY-6358 self.primary_key = "id" @@ -16,7 +16,7 @@ module Chouette validates_presence_of :stop_area validate :stop_area_id_validation - scope :default_order, order("position") + scope :default_order, -> { order("position") } before_destroy :remove_dependent_journey_pattern_stop_points def remove_dependent_journey_pattern_stop_points @@ -25,7 +25,7 @@ module Chouette jp.stop_point_ids = jp.stop_point_ids - [id] end end - end + end def stop_area_id_validation if stop_area_id.nil? diff --git a/app/models/referential.rb b/app/models/referential.rb index b6a83c6c3..2c64a9a5c 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -232,11 +232,19 @@ class Referential < ActiveRecord::Base def self.referential_ids_in_periode(range) subquery = "SELECT DISTINCT(public.referential_metadata.referential_id) FROM public.referential_metadata, LATERAL unnest(periodes) period " - subquery << "WHERE period && '#{ActiveRecord::ConnectionAdapters::PostgreSQLColumn.range_to_string(range)}'" + subquery << "WHERE period && '#{range_to_string(range)}'" query = "SELECT * FROM public.referentials WHERE referentials.id IN (#{subquery})" self.connection.select_values(query).map(&:to_i) end + # Copied from Rails 4.1 activerecord/lib/active_record/connection_adapters/postgresql/cast.rb + # TODO: Relace with the appropriate Rais 4.2 / 5.x helper if one is found. + def self.range_to_string(object) + from = object.begin.respond_to?(:infinite?) && object.begin.infinite? ? '' : object.begin + to = object.end.respond_to?(:infinite?) && object.end.infinite? ? '' : object.end + "[#{from},#{to}#{object.exclude_end? ? ')' : ']'}" + end + def overlapped_referential_ids return [] unless metadatas.present? @@ -248,7 +256,7 @@ class Referential < ActiveRecord::Base not_myself = "and referential_id != #{id}" if persisted? periods_query = periodes.map do |periode| - "period && '#{ActiveRecord::ConnectionAdapters::PostgreSQLColumn.range_to_string(periode)}'" + "period && '[#{periode.begin},#{periode.end})'" end.join(" OR ") query = "select distinct(public.referential_metadata.referential_id) FROM public.referential_metadata, unnest(line_ids) line, LATERAL unnest(periodes) period diff --git a/app/views/access_links/_form.html.slim b/app/views/access_links/_form.html.slim index 463cdf9e3..db5ed2d9b 100644 --- a/app/views/access_links/_form.html.slim +++ b/app/views/access_links/_form.html.slim @@ -21,4 +21,4 @@ = form.actions do = form.action :submit, as: :button - = form.action :cancel, as: :link
\ No newline at end of file + = form.action :cancel, as: :link diff --git a/app/views/connection_links/_form.html.slim b/app/views/connection_links/_form.html.slim index afef3bba7..e5b4d0f0c 100644 --- a/app/views/connection_links/_form.html.slim +++ b/app/views/connection_links/_form.html.slim @@ -18,4 +18,4 @@ = form.actions do = form.action :submit, as: :button - = form.action :cancel, as: :link
\ No newline at end of file + = form.action :cancel, as: :link diff --git a/app/views/time_tables/index.html.slim b/app/views/time_tables/index.html.slim index 6653d6015..84ad539c2 100644 --- a/app/views/time_tables/index.html.slim +++ b/app/views/time_tables/index.html.slim @@ -9,37 +9,35 @@ .container-fluid .row .col-lg-12 - = search_form_for @q, :url => referential_time_tables_path(@referential), remote: true, :html => {:method => :get, class: "form-inline", :id => "search", role: "form"} do |f| - .panel.panel-default - .panel-heading - .input-group.col-md-9 - = f.text_field :comment_cont, :placeholder => "#{t('.comment')}", class: 'form-control' - - .input-group-btn - button.btn.btn-default type="submit" - i.fa.fa-search - - a data-toggle="collapse" data-parent="#search" href="#advanced_search" - i.fa.fa-plus - = "#{t('.advanced_search')}" - - #advanced_search.panel-collapse.collapse - .panel-body - div - label = "#{t('.from')}" - = f.text_field :start_date_gteq, :placeholder => "#{t('.start_date')}", class: 'form-control date_picker', :type => "date" - - label = "#{t('.to')}" - = f.text_field :end_date_lteq, :placeholder => "#{t('.end_date')}", class: 'form-control date_picker', :type => "date" - - div - = f.text_field :tag_search, :placeholder => "#{t('.tag_search')}", class: 'form-control' + = search_form_for @q, url: referential_time_tables_path(@referential), html: { method: :get, class: 'form form-filter' } do |f| + .ffg-row + .input-group.search_bar + = f.text_field :comment_cont, :placeholder => "#{t('.comment')}", class: 'form-control' + span.input-group-btn + button.btn.btn-default type='submit' + span.fa.fa-search + + .ffg-row + .form-group + = f.label @time_tables.human_attribute_name(:tag_search), required: false, class: 'control-label' + = f.input :tag_search, as: :tags, collection: Chouette::TimeTable.tags_on(:tags).pluck(:name), label: false, input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': 'Indiquez une étiquette...' }, wrapper_html: { class: 'select2ed'}, include_blank: false + + / .form-group.togglable + / = f.label @time_tables.human_attribute_name(:bounding_dates), required: false, class: 'control-label' + / .filter_menu + / = f.input :start_date_gteq, as: :date, label: t('simple_form.from'), wrapper_html: { class: 'date filter_menu-item' } + / = f.input :end_date_lteq, as: :date, label: t('simple_form.to'), wrapper_html: { class: 'date filter_menu-item' } + + + .actions + = link_to 'Effacer', @workbench, class: 'btn btn-link' + = f.submit 'Filtrer', class: 'btn btn-default' - if @time_tables.any? .row .col-lg-12 = table_builder @time_tables, - { :comment => 'comment', :color => '', + { :comment => 'comment', :color => Proc.new{|tt| tt.color ? content_tag(:span, '', class: 'fa fa-circle', style: "color:#{tt.color}") : '-' }, "Période de validité englobante" => Proc.new{ |tt| tt.bounding_dates.empty? ? '-' : t('bounding_dates', debut: l(tt.bounding_dates.min), end: l(tt.bounding_dates.max)) }, :calendar => Proc.new{ |tt| tt.calendar ? tt.calendar.try(:name) : '-' }, :updated_at => Proc.new {|tt| l(tt.updated_at, format: :short)} }, [:show, :edit, :duplicate, :delete], [], @@ -48,6 +46,6 @@ = new_pagination @time_tables, 'pull-right' - unless @time_tables.any? - .row + .row.mt-xs .col-lg-12 = replacement_msg t('time_tables.search_no_results') diff --git a/config/application.rb b/config/application.rb index 70b927855..06f931765 100644 --- a/config/application.rb +++ b/config/application.rb @@ -31,6 +31,7 @@ module ChouetteIhm config.browserify_rails.commandline_options = "-t [ babelify --presets [ react es2015 ] ]" config.active_record.observers = :route_observer + config.active_record.raise_in_transactional_callbacks = true unless Rails.env.production? # Work around sprockets+teaspoon mismatch: diff --git a/config/environment.rb b/config/environment.rb index 592eda45a..4d27bfaec 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -6,4 +6,4 @@ require File.expand_path('../application', __FILE__) Rails.application.initialize! # Fix version -APP_VERSION = 'Itération 7' +APP_VERSION = 'Itération 9' diff --git a/config/environments/production.rb b/config/environments/production.rb index 71fe99fe8..41b31b1e8 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -19,7 +19,7 @@ Rails.application.configure do # config.action_dispatch.rack_cache = true # Disable Rails's static asset server (Apache or nginx will already do this). - config.serve_static_assets = false + config.serve_static_files = false # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier diff --git a/config/environments/test.rb b/config/environments/test.rb index b77a26273..d83b4fd85 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -15,7 +15,7 @@ Rails.application.configure do config.eager_load = false # Configure static asset server for tests with Cache-Control for performance. - config.serve_static_assets = true + config.serve_static_files = true config.static_cache_control = 'public, max-age=3600' # Show full error reports and disable caching. diff --git a/config/initializers/formtastic.rb b/config/initializers/formtastic.rb index 2cdc37243..e2341f037 100644 --- a/config/initializers/formtastic.rb +++ b/config/initializers/formtastic.rb @@ -74,3 +74,9 @@ Formtastic::FormBuilder.default_text_area_width = 50 # this to false. Doing so will add a `novalidate` attribute to the `<form>` tag. # See http://diveintohtml5.org/forms.html#validation for more info. # Formtastic::FormBuilder.perform_browser_validations = true + + +# ------------------------------------------------------------------------------------ +# Preparing Formtastic 4.0 +Formtastic::FormBuilder.action_class_finder = Formtastic::ActionClassFinder +Formtastic::FormBuilder.input_class_finder = Formtastic::InputClassFinder diff --git a/config/initializers/postgresql_adapter_patch.rb b/config/initializers/postgresql_adapter_patch.rb index 2e4d73f85..bb8dbe17b 100644 --- a/config/initializers/postgresql_adapter_patch.rb +++ b/config/initializers/postgresql_adapter_patch.rb @@ -1,46 +1,7 @@ -# module ::ArJdbc -# module PostgreSQL -# def quote_column_name(name) -# if name.is_a?(Array) -# name.collect { |n| %("#{n.to_s.gsub("\"", "\"\"")}") }.join(',') -# else -# %("#{name.to_s.gsub("\"", "\"\"")}") -# end -# end -# end -# end -# ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:primary_key] = "bigserial primary key" - -# Add missing double-quote to write array of daterange in SQL query -# See #1782 - -class ActiveRecord::ConnectionAdapters::PostgreSQLColumn - - def self.array_to_string(value, column, adapter) - casted_values = value.map do |val| - if String === val - if val == "NULL" - "\"#{val}\"" - else - quote_and_escape(adapter.type_cast(val, column, true)) - end - elsif Range === val - casted_value = adapter.type_cast(val, column, true) - "\"#{casted_value}\"" - else - adapter.type_cast(val, column, true) - end - end - "{#{casted_values.join(',')}}" - end - -end - -module ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID +# Transform Wed, 22 Feb 2017...Fri, 24 Feb 201 into Wed, 22 Feb 2017..Thu, 23 Feb 201 +module ActiveRecord::ConnectionAdapters::PostgreSQL::OID class DateRange < Range - # Unnormalize daterange - # [2016-11-19,2016-12-26) -> 2016-11-19..2016-12-25 - def type_cast(value) + def cast_value(value) result = super value if result.respond_to?(:exclude_end?) && result.exclude_end? @@ -50,5 +11,13 @@ module ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID end end end - register_type 'daterange', DateRange.new(:date) +end + +ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do + def initialize_type_map_with_daterange mapping + initialize_type_map_without_daterange mapping + mapping.register_type 3912, ActiveRecord::ConnectionAdapters::PostgreSQL::OID::DateRange.new(mapping.lookup('date'), :daterange) + end + + alias_method_chain :initialize_type_map, :daterange end diff --git a/config/initializers/squeel.rb b/config/initializers/squeel.rb index 821e72952..9fb8b24b2 100644 --- a/config/initializers/squeel.rb +++ b/config/initializers/squeel.rb @@ -1,8 +1,8 @@ -Squeel.configure do |config| +# Squeel.configure do |config| # To load hash extensions (to allow for AND (&), OR (|), and NOT (-) against # hashes of conditions): # - config.load_core_extensions :hash + # config.load_core_extensions :hash # To load symbol extensions (for a subset of the old MetaWhere functionality, # via Arel predicate methods on Symbols: :name.matches, etc): @@ -21,4 +21,4 @@ Squeel.configure do |config| # "less_than_any" and "less_than_all" as well: # # config.alias_predicate :less_than, :lt -end +# end diff --git a/db/migrate/20120515134710_create_imports.rb b/db/migrate/20120515134710_create_imports.rb index 5bc5b367b..5da398fc9 100644 --- a/db/migrate/20120515134710_create_imports.rb +++ b/db/migrate/20120515134710_create_imports.rb @@ -1,13 +1,11 @@ class CreateImports < ActiveRecord::Migration def change - unless table_exists? :imports - create_table :imports do |t| - t.belongs_to :referential - t.string :status + create_table :imports do |t| + t.belongs_to :referential + t.string :status - t.timestamps - end - add_index :imports, :referential_id + t.timestamps end + add_index :imports, :referential_id end end diff --git a/db/migrate/20130207123618_add_foreign_keys.ninoxe_engine.rb b/db/migrate/20130207123618_add_foreign_keys.ninoxe_engine.rb index cab9d13f0..da4ee27de 100644 --- a/db/migrate/20130207123618_add_foreign_keys.ninoxe_engine.rb +++ b/db/migrate/20130207123618_add_foreign_keys.ninoxe_engine.rb @@ -2,277 +2,165 @@ require "forwardable" class AddForeignKeys < ActiveRecord::Migration - def up - # t.remove_foreign_key does not works if foreign key doesn't exists so check before if keys already exists - change_table :access_links do |t| - if @connection.foreign_keys(:access_links).any? - @connection.foreign_keys(:access_links).map do |f| - name = f.options[:name] - if (name == "aclk_acpt_fkey" || name == "aclk_area_fkey" ) - remove_foreign_key :access_links, :name => name - end - end - end - t.foreign_key :access_points, :dependent => :delete, :name => 'aclk_acpt_fkey' - t.foreign_key :stop_areas, :dependent => :delete, :name => 'aclk_area_fkey' - end - change_table :access_points do |t| - if @connection.foreign_keys(:access_points).any? - @connection.foreign_keys(:access_points).map do |f| - name = f.options[:name] - if (name == "access_area_fkey" ) - remove_foreign_key :access_points, :name => name - end - end - end - t.foreign_key :stop_areas, :dependent => :delete, :name => 'access_area_fkey' - end - change_table :connection_links do |t| - if @connection.foreign_keys(:connection_links).any? - @connection.foreign_keys(:connection_links).map do |f| - name = f.options[:name] - if (name == "colk_endarea_fkey" || name == "colk_startarea_fkey" ) - remove_foreign_key :connection_links, :name => name - end - end - end - t.foreign_key :stop_areas, :dependent => :delete, :column => 'arrival_id', :name => 'colk_endarea_fkey' - t.foreign_key :stop_areas, :dependent => :delete, :column => 'departure_id', :name => 'colk_startarea_fkey' - end - change_table :group_of_lines_lines do |t| - if @connection.foreign_keys(:group_of_lines_lines).any? - @connection.foreign_keys(:group_of_lines_lines).map do |f| - name = f.options[:name] - if (name == "groupofline_group_fkey" || name == "groupofline_line_fkey" ) - remove_foreign_key :group_of_lines_lines, :name => name - end - end - end - t.foreign_key :group_of_lines, :dependent => :delete, :name => 'groupofline_group_fkey' - t.foreign_key :lines, :dependent => :delete, :name => 'groupofline_line_fkey' - end - change_table :journey_patterns do |t| - if @connection.foreign_keys(:journey_patterns).any? - @connection.foreign_keys(:journey_patterns).map do |f| - name = f.options[:name] - if (name == "arrival_point_fkey" || name == "departure_point_fkey" || name == "jp_route_fkey") - remove_foreign_key :journey_patterns, :name => name - end - end - end - t.foreign_key :stop_points, :dependent => :nullify, :column => 'arrival_stop_point_id', :name => 'arrival_point_fkey' - t.foreign_key :stop_points, :dependent => :nullify, :column => 'departure_stop_point_id', :name => 'departure_point_fkey' - t.foreign_key :routes, :dependent => :delete, :name => 'jp_route_fkey' - end - change_table :journey_patterns_stop_points do |t| - if @connection.foreign_keys(:journey_patterns_stop_points).any? - @connection.foreign_keys(:journey_patterns_stop_points).map do |f| - name = f.options[:name] - if (name == "jpsp_jp_fkey" || name == "jpsp_stoppoint_fkey" ) - remove_foreign_key :journey_patterns_stop_points, :name => name - end - end - end - t.foreign_key :journey_patterns, :dependent => :delete, :name => 'jpsp_jp_fkey' - t.foreign_key :stop_points, :dependent => :delete, :name => 'jpsp_stoppoint_fkey' - end - change_table :lines do |t| - if @connection.foreign_keys(:lines).any? - @connection.foreign_keys(:lines).map do |f| - name = f.options[:name] - if (name == "line_company_fkey" || name == "line_ptnetwork_fkey" ) - remove_foreign_key :lines, :name => name - end - end - end - t.foreign_key :companies, :dependent => :nullify, :name => 'line_company_fkey' - t.foreign_key :networks, :dependent => :nullify, :name => 'line_ptnetwork_fkey' - end - change_table :routes do |t| - if @connection.foreign_keys(:routes).any? - @connection.foreign_keys(:routes).map do |f| - name = f.options[:name] - if (name == "route_line_fkey" ) - remove_foreign_key :routes, :name => name - end - end - end - t.foreign_key :lines, :dependent => :delete, :name => 'route_line_fkey' - end - change_table :routing_constraints_lines do |t| - if @connection.foreign_keys(:routing_constraints_lines).any? - @connection.foreign_keys(:routing_constraints_lines).map do |f| - name = f.options[:name] - if (name == "routingconstraint_line_fkey" || name == "routingconstraint_stoparea_fkey" ) - remove_foreign_key :routing_constraints_lines, :name => name - end - end - end - t.foreign_key :lines, :dependent => :delete, :name => 'routingconstraint_line_fkey' - t.foreign_key :stop_areas, :dependent => :delete, :name => 'routingconstraint_stoparea_fkey' - end - change_table :stop_areas do |t| - if @connection.foreign_keys(:stop_areas).any? - @connection.foreign_keys(:stop_areas).map do |f| - name = f.options[:name] - if (name == "area_parent_fkey" ) - remove_foreign_key :stop_areas, :name => name - end - end - end - t.foreign_key :stop_areas, :dependent => :nullify, :column => 'parent_id', :name => 'area_parent_fkey' - end - change_table :stop_areas_stop_areas do |t| - if @connection.foreign_keys(:stop_areas_stop_areas).any? - @connection.foreign_keys(:stop_areas_stop_areas).map do |f| - name = f.options[:name] - if (name == "stoparea_child_fkey" || name == "stoparea_parent_fkey" ) - remove_foreign_key :stop_areas_stop_areas, :name => name - end - end - end - t.foreign_key :stop_areas, :dependent => :delete, :column => 'child_id', :name => 'stoparea_child_fkey' - t.foreign_key :stop_areas, :dependent => :delete, :column => 'parent_id', :name => 'stoparea_parent_fkey' - end - change_table :stop_points do |t| - if @connection.foreign_keys(:stop_points).any? - @connection.foreign_keys(:stop_points).map do |f| - name = f.options[:name] - if (name == "stoppoint_area_fkey" || name == "stoppoint_route_fkey" ) - remove_foreign_key :stop_points, :name => name - end - end - end - t.foreign_key :stop_areas, :name => 'stoppoint_area_fkey' - t.foreign_key :routes, :dependent => :delete, :name => 'stoppoint_route_fkey' - end - change_table :time_table_dates do |t| - if @connection.foreign_keys(:time_table_dates).any? - @connection.foreign_keys(:time_table_dates).map do |f| - name = f.options[:name] - if (name == "tm_date_fkey" ) - remove_foreign_key :time_table_dates, :name => name - end - end - end - t.foreign_key :time_tables, :dependent => :delete, :name => 'tm_date_fkey' - end - change_table :time_table_periods do |t| - if @connection.foreign_keys(:time_table_periods).any? - @connection.foreign_keys(:time_table_periods).map do |f| - name = f.options[:name] - if (name == "tm_period_fkey" ) - remove_foreign_key :time_table_periods, :name => name - end - end - end - t.foreign_key :time_tables, :dependent => :delete, :name => 'tm_period_fkey' - end - change_table :time_tables_vehicle_journeys do |t| - if @connection.foreign_keys(:time_tables_vehicle_journeys).any? - @connection.foreign_keys(:time_tables_vehicle_journeys).map do |f| - name = f.options[:name] - if (name == "vjtm_tm_fkey" || name == "vjtm_vj_fkey" ) - remove_foreign_key :time_tables_vehicle_journeys, :name => name - end - end - end - t.foreign_key :time_tables, :dependent => :delete, :name => 'vjtm_tm_fkey' - t.foreign_key :vehicle_journeys, :dependent => :delete, :name => 'vjtm_vj_fkey' - end - change_table :vehicle_journey_at_stops do |t| - if @connection.foreign_keys(:vehicle_journey_at_stops).any? - @connection.foreign_keys(:vehicle_journey_at_stops).map do |f| - name = f.options[:name] - if (name == "vjas_sp_fkey" || name == "vjas_vj_fkey" ) - remove_foreign_key :vehicle_journey_at_stops, :name => name + def disable_foreign_key(table, name) + if foreign_key?(table, name) + remove_foreign_key table, name: name end end - end - t.foreign_key :stop_points, :dependent => :delete, :name => 'vjas_sp_fkey' - t.foreign_key :vehicle_journeys, :dependent => :delete, :name => 'vjas_vj_fkey' - end - change_table :vehicle_journeys do |t| - if @connection.foreign_keys(:vehicle_journeys).any? - @connection.foreign_keys(:vehicle_journeys).map do |f| - name = f.options[:name] - if (name == "vj_company_fkey" || name == "vj_jp_fkey" || name == "vj_route_fkey") - remove_foreign_key :vehicle_journeys, :name => name + + def foreign_key?(table, name) + @connection.foreign_keys(table).any? do |foreign_key| + foreign_key.options[:name] == name.to_s end end - end - t.foreign_key :companies, :dependent => :nullify, :name => 'vj_company_fkey' - t.foreign_key :journey_patterns, :dependent => :delete, :name => 'vj_jp_fkey' - t.foreign_key :routes, :dependent => :delete, :name => 'vj_route_fkey' - end - + + def up + disable_foreign_key :access_links, :aclk_acpt_fkey + disable_foreign_key :access_links, :aclk_area_fkey + + add_foreign_key :access_links, :access_points, dependent: :cascade, :name => 'aclk_acpt_fkey' + add_foreign_key :access_links, :stop_areas, dependent: :cascade, :name => 'aclk_area_fkey' + + disable_foreign_key :access_points, :access_area_fkey + add_foreign_key :access_points, :stop_areas, dependent: :cascade, name: :access_area_fkey + + disable_foreign_key :connection_links, :colk_endarea_fkey + disable_foreign_key :connection_links, :colk_startarea_fkey + + add_foreign_key :connection_links, :stop_areas, :on_delete => :cascade, :column => 'arrival_id', :name => 'colk_endarea_fkey' + add_foreign_key :connection_links, :stop_areas, :on_delete => :cascade, :column => 'departure_id', :name => 'colk_startarea_fkey' + + disable_foreign_key :group_of_lines_lines, :groupofline_group_fkey + disable_foreign_key :group_of_lines_lines, :groupofline_line_fkey + + add_foreign_key :group_of_lines_lines, :group_of_lines, :on_delete => :cascade, :name => 'groupofline_group_fkey' + add_foreign_key :group_of_lines_lines, :lines, :on_delete => :cascade, :name => 'groupofline_line_fkey' + + + disable_foreign_key :journey_patterns, :arrival_point_fkey + disable_foreign_key :journey_patterns, :departure_point_fkey + disable_foreign_key :journey_patterns, :jp_route_fkey + + add_foreign_key :journey_patterns, :stop_points, :on_delete => :nullify, :column => 'arrival_stop_point_id', :name => 'arrival_point_fkey' + add_foreign_key :journey_patterns, :stop_points, :on_delete => :nullify, :column => 'departure_stop_point_id', :name => 'departure_point_fkey' + add_foreign_key :journey_patterns, :routes, :on_delete => :cascade, :name => 'jp_route_fkey' + + disable_foreign_key :journey_patterns_stop_points, :jpsp_jp_fkey + disable_foreign_key :journey_patterns_stop_points, :jpsp_stoppoint_fkey + + add_foreign_key :journey_patterns_stop_points, :journey_patterns, :on_delete => :cascade, :name => 'jpsp_jp_fkey' + add_foreign_key :journey_patterns_stop_points, :stop_points, :on_delete => :cascade, :name => 'jpsp_stoppoint_fkey' + + disable_foreign_key :lines, :line_company_fkey + disable_foreign_key :lines, :line_ptnetwork_fkey + + add_foreign_key :lines, :companies, :on_delete => :nullify, :name => 'line_company_fkey' + add_foreign_key :lines, :networks, :on_delete => :nullify, :name => 'line_ptnetwork_fkey' + + disable_foreign_key :routes, :route_line_fkey + add_foreign_key :routes, :lines, :on_delete => :cascade, :name => 'route_line_fkey' + + + disable_foreign_key :routing_constraints_lines, :routingconstraint_line_fkey + disable_foreign_key :routing_constraints_lines, :routingconstraint_stoparea_fkey + + add_foreign_key :routing_constraints_lines, :lines, :on_delete => :cascade, :name => 'routingconstraint_line_fkey' + add_foreign_key :routing_constraints_lines, :stop_areas, :on_delete => :cascade, :name => 'routingconstraint_stoparea_fkey' + + + + disable_foreign_key :stop_areas, :area_parent_fkey + add_foreign_key :stop_areas, :stop_areas, :on_delete => :nullify, :column => 'parent_id', :name => 'area_parent_fkey' + + disable_foreign_key :stop_areas_stop_areas, :stoparea_child_fkey + disable_foreign_key :stop_areas_stop_areas, :stoparea_parent_fkey + + add_foreign_key :stop_areas_stop_areas, :stop_areas, :on_delete => :cascade, :column => 'child_id', :name => 'stoparea_child_fkey' + add_foreign_key :stop_areas_stop_areas, :stop_areas, :on_delete => :cascade, :column => 'parent_id', :name => 'stoparea_parent_fkey' + + disable_foreign_key :stop_points, :stoppoint_area_fkey + disable_foreign_key :stop_points, :stoppoint_route_fkey + + add_foreign_key :stop_points, :stop_areas, :name => 'stoppoint_area_fkey' + add_foreign_key :stop_points, :routes, :on_delete => :cascade, :name => 'stoppoint_route_fkey' + + disable_foreign_key :time_table_dates, :tm_date_fkey + add_foreign_key :time_table_dates, :time_tables, :on_delete => :cascade, :name => 'tm_date_fkey' + + + disable_foreign_key :time_table_periods, :tm_period_fkey + add_foreign_key :time_table_periods, :time_tables, :on_delete => :cascade, :name => 'tm_period_fkey' + + disable_foreign_key :time_tables_vehicle_journeys, :vjtm_tm_fkey + disable_foreign_key :time_tables_vehicle_journeys, :vjtm_vj_fkey + add_foreign_key :time_tables_vehicle_journeys, :time_tables, :on_delete => :cascade, :name => 'vjtm_tm_fkey' + add_foreign_key :time_tables_vehicle_journeys, :vehicle_journeys, :on_delete => :cascade, :name => 'vjtm_vj_fkey' + + + disable_foreign_key :vehicle_journey_at_stops, :vjas_sp_fkey + disable_foreign_key :vehicle_journey_at_stops, :vjas_vj_fkey + add_foreign_key :vehicle_journey_at_stops, :stop_points, :on_delete => :cascade, :name => 'vjas_sp_fkey' + add_foreign_key :vehicle_journey_at_stops, :vehicle_journeys, :on_delete => :cascade, :name => 'vjas_vj_fkey' + + + disable_foreign_key :vehicle_journeys, :vj_company_fkey + disable_foreign_key :vehicle_journeys, :vj_jp_fkey + disable_foreign_key :vehicle_journeys, :vj_route_fkey + + add_foreign_key :vehicle_journeys, :companies, :on_delete => :nullify, :name => 'vj_company_fkey' + add_foreign_key :vehicle_journeys, :journey_patterns, :on_delete => :cascade, :name => 'vj_jp_fkey' + add_foreign_key :vehicle_journeys, :routes, :on_delete => :cascade, :name => 'vj_route_fkey' end + def down - change_table :access_links do |t| - t.remove_foreign_key :name => :aclk_acpt_fkey - t.remove_foreign_key :name => :aclk_area_fkey - end - change_table :access_points do |t| - t.remove_foreign_key :name => :access_area_fkey - end - change_table :connection_links do |t| - t.remove_foreign_key :name => :colk_endarea_fkey - t.remove_foreign_key :name => :colk_startarea_fkey - end - change_table :group_of_lines_lines do |t| - t.remove_foreign_key :name => :groupofline_group_fkey - t.remove_foreign_key :name => :groupofline_line_fkey - end - change_table :journey_patterns do |t| - t.remove_foreign_key :name => :arrival_point_fkey - t.remove_foreign_key :name => :departure_point_fkey - t.remove_foreign_key :name => :jp_route_fkey - end - change_table :journey_patterns_stop_points do |t| - t.remove_foreign_key :name => :jpsp_jp_fkey - t.remove_foreign_key :name => :jpsp_stoppoint_fkey - end - change_table :lines do |t| - t.remove_foreign_key :name => :line_company_fkey - t.remove_foreign_key :name => :line_ptnetwork_fkey - end - change_table :routes do |t| - t.remove_foreign_key :name => :route_line_fkey - end - change_table :routing_constraints_lines do |t| - t.remove_foreign_key :name => :routingconstraint_line_fkey - t.remove_foreign_key :name => :routingconstraint_stoparea_fkey - end - change_table :stop_areas do |t| - t.remove_foreign_key :name => :area_parent_fkey - end - change_table :stop_areas_stop_areas do |t| - t.remove_foreign_key :name => :stoparea_child_fkey - t.remove_foreign_key :name => :stoparea_parent_fkey - end - change_table :stop_points do |t| - t.remove_foreign_key :name => :stoppoint_area_fkey - t.remove_foreign_key :name => :stoppoint_route_fkey - end - change_table :time_table_dates do |t| - t.remove_foreign_key :name => :tm_date_fkey - end - change_table :time_table_periods do |t| - t.remove_foreign_key :name => :tm_period_fkey - end - change_table :time_tables_vehicle_journeys do |t| - t.remove_foreign_key :name => :vjtm_tm_fkey - t.remove_foreign_key :name => :vjtm_vj_fkey - end - change_table :vehicle_journey_at_stops do |t| - t.remove_foreign_key :name => :vjas_sp_fkey - t.remove_foreign_key :name => :vjas_vj_fkey - end - change_table :vehicle_journeys do |t| - t.remove_foreign_key :name => :vj_company_fkey - t.remove_foreign_key :name => :vj_jp_fkey - t.remove_foreign_key :name => :vj_route_fkey - end + remove_foreign_key :access_links, :name => :aclk_acpt_fkey + remove_foreign_key :access_links, :name => :aclk_area_fkey + + remove_foreign_key :access_points, :name => :access_area_fkey + + remove_foreign_key :connection_links, :name => :colk_endarea_fkey + remove_foreign_key :connection_links, :name => :colk_startarea_fkey + + remove_foreign_key :group_of_lines_lines, :name => :groupofline_group_fkey + remove_foreign_key :group_of_lines_lines, :name => :groupofline_line_fkey + + remove_foreign_key :journey_patterns, :name => :arrival_point_fkey + remove_foreign_key :journey_patterns, :name => :departure_point_fkey + remove_foreign_key :journey_patterns, :name => :jp_route_fkey + + remove_foreign_key :journey_patterns_stop_points, :name => :jpsp_jp_fkey + remove_foreign_key :journey_patterns_stop_points, :name => :jpsp_stoppoint_fkey + + remove_foreign_key :lines, :name => :line_company_fkey + remove_foreign_key :lines, :name => :line_ptnetwork_fkey + + remove_foreign_key :routes, :name => :route_line_fkey + + remove_foreign_key :routing_constraints_lines, :name => :routingconstraint_line_fkey + remove_foreign_key :routing_constraints_lines, :name => :routingconstraint_stoparea_fkey + + remove_foreign_key :stop_areas, :name => :area_parent_fkey + + remove_foreign_key :stop_areas_stop_areas, :name => :stoparea_child_fkey + remove_foreign_key :stop_areas_stop_areas, :name => :stoparea_parent_fkey + + remove_foreign_key :stop_points, :name => :stoppoint_area_fkey + remove_foreign_key :stop_points, :name => :stoppoint_route_fkey + + remove_foreign_key :time_table_dates, :name => :tm_date_fkey + + remove_foreign_key :time_table_periods, :name => :tm_period_fkey + + remove_foreign_key :time_tables_vehicle_journeys, :name => :vjtm_tm_fkey + remove_foreign_key :time_tables_vehicle_journeys, :name => :vjtm_vj_fkey + + remove_foreign_key :vehicle_journey_at_stops, :name => :vjas_sp_fkey + remove_foreign_key :vehicle_journey_at_stops, :name => :vjas_vj_fkey + + remove_foreign_key :vehicle_journeys, :name => :vj_company_fkey + remove_foreign_key :vehicle_journeys, :name => :vj_jp_fkey + remove_foreign_key :vehicle_journeys, :name => :vj_route_fkey + end end diff --git a/db/migrate/20131029110239_create_import_tasks.rb b/db/migrate/20131029110239_create_import_tasks.rb index fa2faec37..ae1c45e40 100644 --- a/db/migrate/20131029110239_create_import_tasks.rb +++ b/db/migrate/20131029110239_create_import_tasks.rb @@ -13,8 +13,8 @@ class CreateImportTasks < ActiveRecord::Migration t.text :result # import report : objects statistics t.text :progress_info # percentage of progress and step code t.timestamps - t.foreign_key :referentials, :dependent => :delete end + add_foreign_key :import_tasks, :referentials, :on_delete => :cascade end end diff --git a/db/migrate/20131029115751_create_compliance_check_tasks.rb b/db/migrate/20131029115751_create_compliance_check_tasks.rb index 9195556b2..897700a1e 100644 --- a/db/migrate/20131029115751_create_compliance_check_tasks.rb +++ b/db/migrate/20131029115751_create_compliance_check_tasks.rb @@ -11,9 +11,9 @@ class CreateComplianceCheckTasks < ActiveRecord::Migration t.string :user_name # name of the user who has requested this task t.text :progress_info # percentage of progress and step code t.timestamps - t.foreign_key :referentials, :dependent => :delete - t.foreign_key :import_tasks, :dependent => :delete end + add_foreign_key :compliance_check_tasks, :referentials, :on_delete => :cascade + add_foreign_key :compliance_check_tasks, :import_tasks, :on_delete => :cascade end end diff --git a/db/migrate/20131029115820_create_compliance_check_results.rb b/db/migrate/20131029115820_create_compliance_check_results.rb index 8b72aa4c0..7f5c8e436 100644 --- a/db/migrate/20131029115820_create_compliance_check_results.rb +++ b/db/migrate/20131029115820_create_compliance_check_results.rb @@ -9,8 +9,8 @@ class CreateComplianceCheckResults < ActiveRecord::Migration t.integer :violation_count # number of violation occurences t.text :detail # detail of violation location t.timestamps - t.foreign_key :compliance_check_tasks, :dependent => :delete end + add_foreign_key :compliance_check_results, :compliance_check_tasks, :on_delete => :cascade end end diff --git a/db/migrate/20150312104557_set_default_value_for_data_format_in_organisation.rb b/db/migrate/20150312104557_set_default_value_for_data_format_in_organisation.rb index 03d48e0bb..cc99366b1 100644 --- a/db/migrate/20150312104557_set_default_value_for_data_format_in_organisation.rb +++ b/db/migrate/20150312104557_set_default_value_for_data_format_in_organisation.rb @@ -1,7 +1,22 @@ class SetDefaultValueForDataFormatInOrganisation < ActiveRecord::Migration def change - Organisation.where(data_format: nil).update_all(data_format: "neptune") - execute "update referentials set data_format = organisations.data_format from organisations where referentials.data_format is null and referentials.organisation_id = organisations.id" + Organisation.all.each do |organisation| + if organisation.data_format.neptune? + organisation.update_attribute(:data_format, "neptune") + end + end + Referential.all.each do |referential| + if referential.data_format.neptune? + referential.update_attribute :data_format, "neptune" + elsif referential.data_format.netex? + referential.update_attribute :data_format, "netex" + elsif referential.data_format.gtfs? + referential.update_attribute :data_format, "gtfs" + elsif referential.data_format.hub? + referential.update_attribute :data_format, "hub" + end + end + change_column :organisations, :data_format, :string, :default => "neptune" end end diff --git a/db/migrate/20150526081746_add_foreign_key_to_routes.ninoxe_engine.rb b/db/migrate/20150526081746_add_foreign_key_to_routes.ninoxe_engine.rb index 32e2a05e4..3594bfe49 100644 --- a/db/migrate/20150526081746_add_foreign_key_to_routes.ninoxe_engine.rb +++ b/db/migrate/20150526081746_add_foreign_key_to_routes.ninoxe_engine.rb @@ -2,28 +2,15 @@ class AddForeignKeyToRoutes < ActiveRecord::Migration require "forwardable" def up - Chouette::Route.all.map do |route| - if route.opposite_route_id.present? && !Chouette::Route.exists?(route.opposite_route_id) + Chouette::Route.all.map do |route| + if route.opposite_route_id.present? && !Chouette::Route.exists?(route.opposite_route_id) route.update_attributes :opposite_route_id => nil - end - end - change_table :routes do |t| - if @connection.foreign_keys(:routes).any? - @connection.foreign_keys(:routes).map do |f| - name = f.options[:name] - if (name == "route_opposite_route_fkey" ) - remove_foreign_key :routes, :name => name - end - end - end - t.foreign_key :routes, :dependent => :nullify, :column => 'opposite_route_id', :name => 'route_opposite_route_fkey' + end end - + add_foreign_key :routes, :routes, dependent: :nullify, name: 'route_opposite_route_fkey', column: 'opposite_route_id' end def down - change_table :routes do |t| - t.remove_foreign_key :name => :route_opposite_route_fkey - end + remove_foreign_key :routes, name: :route_opposite_route_fkey end end diff --git a/db/migrate/20151203132113_create_journey_pattern_sections.ninoxe_engine.rb b/db/migrate/20151203132113_create_journey_pattern_sections.ninoxe_engine.rb index 254e64567..3cfb245cf 100644 --- a/db/migrate/20151203132113_create_journey_pattern_sections.ninoxe_engine.rb +++ b/db/migrate/20151203132113_create_journey_pattern_sections.ninoxe_engine.rb @@ -5,11 +5,11 @@ class CreateJourneyPatternSections < ActiveRecord::Migration t.references :journey_pattern, null: false, index: true, limit: 8 t.references :route_section, null: false, index: true, limit: 8 t.integer :rank, null: false - t.foreign_key :journey_patterns, dependent: :delete - t.foreign_key :route_sections, dependent: :delete - t.timestamps end + add_foreign_key :journey_pattern_sections, :journey_patterns, on_delete: :cascade + add_foreign_key :journey_pattern_sections, :route_sections, on_delete: :cascade + add_index :journey_pattern_sections, [:journey_pattern_id, :route_section_id, :rank], unique: true, name: 'index_jps_on_journey_pattern_id_and_route_section_id_and_rank' end diff --git a/db/migrate/20151215175635_add_limit_and_foreign_key_to_journey_frequencies.ninoxe_engine.rb b/db/migrate/20151215175635_add_limit_and_foreign_key_to_journey_frequencies.ninoxe_engine.rb index fc8869f1c..c69ae12f5 100644 --- a/db/migrate/20151215175635_add_limit_and_foreign_key_to_journey_frequencies.ninoxe_engine.rb +++ b/db/migrate/20151215175635_add_limit_and_foreign_key_to_journey_frequencies.ninoxe_engine.rb @@ -3,8 +3,8 @@ class AddLimitAndForeignKeyToJourneyFrequencies < ActiveRecord::Migration def up change_column :journey_frequencies, :vehicle_journey_id, :integer, limit: 8 change_column :journey_frequencies, :timeband_id, :integer, limit: 8 - add_foreign_key :journey_frequencies, :vehicle_journeys, dependent: :nullify - add_foreign_key :journey_frequencies, :timebands, dependent: :nullify + add_foreign_key :journey_frequencies, :vehicle_journeys, on_delete: :nullify + add_foreign_key :journey_frequencies, :timebands, on_delete: :nullify end def down diff --git a/db/migrate/20170123131243_set_user_permissions.rb b/db/migrate/20170123131243_set_user_permissions.rb index d9f18c10a..8b9288073 100644 --- a/db/migrate/20170123131243_set_user_permissions.rb +++ b/db/migrate/20170123131243_set_user_permissions.rb @@ -1,7 +1,16 @@ class SetUserPermissions < ActiveRecord::Migration def change - User.update_all(permissions: ['routes.create', 'routes.edit', 'routes.destroy', 'journey_patterns.create', 'journey_patterns.edit', 'journey_patterns.destroy', - 'vehicle_journeys.create', 'vehicle_journeys.edit', 'vehicle_journeys.destroy', 'time_tables.create', 'time_tables.edit', 'time_tables.destroy', - 'footnotes.edit', 'footnotes.create', 'footnotes.destroy', 'routing_constraint_zones.create', 'routing_constraint_zones.edit', 'routing_constraint_zones.destroy']) + permissions = ['routes.create', 'routes.edit', + 'routes.destroy', 'journey_patterns.create', + 'journey_patterns.edit', 'journey_patterns.destroy', + 'vehicle_journeys.create', 'vehicle_journeys.edit', + 'vehicle_journeys.destroy', 'time_tables.create', + 'time_tables.edit', 'time_tables.destroy', + 'footnotes.edit', 'footnotes.create', + 'footnotes.destroy', 'routing_constraint_zones.create', + 'routing_constraint_zones.edit', 'routing_constraint_zones.destroy'] + # TODO: Make this more idiomatic + User.update_all( permissions: permissions ) + # User.update_all( permissions: "{#{permissions.join(",")}}" ) end end diff --git a/db/seeds.rb b/db/seeds.rb index 7526330ed..815327300 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -7,25 +7,9 @@ # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) # Mayor.create(:name => 'Emanuel', :city => cities.first) - -stop_area_referential = StopAreaReferential.find_or_create_by(name: "Reflex") -line_referential = LineReferential.find_or_create_by(name: "CodifLigne") - stif = Organisation.find_or_create_by!(name: "STIF") do |org| org.code = 'STIF' end -operator = Organisation.find_or_create_by!(code: 'transporteur-a') do |organisation| - organisation.name = "Transporteur A" -end - -line_referential.add_member stif, owner: true -line_referential.add_member operator - -stop_area_referential.add_member stif, owner: true -stop_area_referential.add_member operator - -line_referential.save -stop_area_referential.save stif.users.find_or_create_by!(username: "admin") do |user| user.email = 'stif-boiv@af83.com' @@ -33,18 +17,33 @@ stif.users.find_or_create_by!(username: "admin") do |user| user.name = "STIF Administrateur" end + +operator = Organisation.find_or_create_by!(code: 'transporteur-a') do |organisation| + organisation.name = "Transporteur A" +end + operator.users.find_or_create_by!(username: "transporteur") do |user| user.email = 'stif-boiv+transporteur@af83.com' user.password = "secret" user.name = "Martin Lejeune" end +stop_area_referential = StopAreaReferential.find_or_create_by!(name: "Reflex") do |referential| + referential.add_member stif, owner: true + referential.add_member operator +end + 10.times do |n| - stop_area_referential.stop_areas.find_or_create_by name: "Test #{n}", area_type: "Quay", objectid: "StopArea: #{n}" + stop_area_referential.stop_areas.find_or_create_by! name: "Test #{n}", area_type: "zdep", objectid: "StopArea: #{n}" +end + +line_referential = LineReferential.find_or_create_by!(name: "CodifLigne") do |referential| + referential.add_member stif, owner: true + referential.add_member operator end -LineReferentialSync.find_or_create_by(line_referential: line_referential) -StopAreaReferentialSync.find_or_create_by(stop_area_referential: stop_area_referential) +LineReferentialSync.find_or_create_by!(line_referential: line_referential) +StopAreaReferentialSync.find_or_create_by!(stop_area_referential: stop_area_referential) 10.times do |n| line_referential.lines.find_or_create_by name: "Test #{n}" do |l| @@ -56,9 +55,11 @@ workbench = Workbench.find_by(name: "Gestion de l'offre") [["parissudest201604", "Paris Sud-Est Avril 2016"], ["parissudest201605", "Paris Sud-Est Mai 2016"]].each do |slug, name| - operator.referentials.find_or_create_by!(slug: slug) do |referential| + operator.referentials.find_or_create_by(slug: slug) do |referential| referential.name = name referential.prefix = slug referential.workbench = workbench + referential.line_referential = line_referential + referential.stop_area_referential = stop_area_referential end end diff --git a/lib/stif/reflex_synchronization.rb b/lib/stif/reflex_synchronization.rb index fee54f4c1..a7dda7e30 100644 --- a/lib/stif/reflex_synchronization.rb +++ b/lib/stif/reflex_synchronization.rb @@ -153,6 +153,7 @@ module Stif :city_name => 'Town', :stif_type => 'OBJECT_STATUS' }.each do |k, v| stop[k] = entry[v] end + # TODO: use stop.update_attributes instead of the above if entry['gml:pos'] stop['longitude'] = entry['gml:pos'][:lng] diff --git a/public/uploads/import/file/1/terminated_job.json b/public/uploads/import/file/1/terminated_job.json new file mode 100644 index 000000000..417bd62ad --- /dev/null +++ b/public/uploads/import/file/1/terminated_job.json @@ -0,0 +1,578 @@ +< HTTP/1.1 200 OK +< Connection: keep-alive +< Cache-Control: no-transform, max-age=2147483647 +< X-Powered-By: Undertow/1 +* Server WildFly/8 is not blacklisted +< Server: WildFly/8 +< Transfer-Encoding: chunked +< Content-Type: application/json +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/data/9151/Citura_050115_220215.zip>; rel="data" +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/data/9151/action_parameters.json>; rel="action_params" +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/data/9151/validation_parameters.json>; rel="validation_params" +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/reports/9151>; rel="location" +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/reports/9151>; rel="delete" +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/data/9151/validation.json>; rel="validation" +< Date: Fri, 13 Mar 2015 09:18:07 GMT +< +{ + "id": 9151, + "referential": "tatrotest", + "action": "importer", + "type": "neptune", + "created": 1425984896098, + "updated": 1425984896542, + "status": "TERMINATED", + "action_report": { + "result": "OK", + "zip_file": { + "status": "OK", + "name": "Citura_050115_220215.zip" + }, + "files": [ + { + "name": "C_NEPTUNE_reseau_5_39901717.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901712.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901718.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901710.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901709.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901727.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901746.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901719.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901715.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901716.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901721.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901734.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901725.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901731.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901711.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901722.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901724.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901733.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901726.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901732.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901736.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901708.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901730.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901720.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901745.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901713.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901723.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901729.xml", + "status": "OK", + "error": [] + } + ], + "lines": [ + { + "name": "03 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 95, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "17", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 66, + "access_point_count": 0, + "vehicle_journey_count": 45, + "journey_pattern_count": 2 + } + }, + { + "name": "TRAMWAY", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 10, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 67, + "access_point_count": 0, + "vehicle_journey_count": 769, + "journey_pattern_count": 10 + } + }, + { + "name": "02", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 3, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 68, + "access_point_count": 0, + "vehicle_journey_count": 388, + "journey_pattern_count": 3 + } + }, + { + "name": "01", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 6, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 84, + "access_point_count": 0, + "vehicle_journey_count": 385, + "journey_pattern_count": 6 + } + }, + { + "name": "10", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 6, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 79, + "access_point_count": 0, + "vehicle_journey_count": 253, + "journey_pattern_count": 6 + } + }, + { + "name": "15", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 31, + "access_point_count": 0, + "vehicle_journey_count": 8, + "journey_pattern_count": 2 + } + }, + { + "name": "13 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 22, + "access_point_count": 0, + "vehicle_journey_count": 17, + "journey_pattern_count": 2 + } + }, + { + "name": "05", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 14, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 109, + "access_point_count": 0, + "vehicle_journey_count": 378, + "journey_pattern_count": 14 + } + }, + { + "name": "02 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 68, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "08", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 9, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 104, + "access_point_count": 0, + "vehicle_journey_count": 236, + "journey_pattern_count": 9 + } + }, + { + "name": "05 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 94, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "12", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 6, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 100, + "access_point_count": 0, + "vehicle_journey_count": 236, + "journey_pattern_count": 6 + } + }, + { + "name": "13", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 101, + "access_point_count": 0, + "vehicle_journey_count": 81, + "journey_pattern_count": 4 + } + }, + { + "name": "03", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 5, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 97, + "access_point_count": 0, + "vehicle_journey_count": 387, + "journey_pattern_count": 5 + } + }, + { + "name": "07", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 105, + "access_point_count": 0, + "vehicle_journey_count": 238, + "journey_pattern_count": 4 + } + }, + { + "name": "11", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 96, + "access_point_count": 0, + "vehicle_journey_count": 251, + "journey_pattern_count": 2 + } + }, + { + "name": "09 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 29, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "CITADINE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 61, + "access_point_count": 0, + "vehicle_journey_count": 77, + "journey_pattern_count": 2 + } + }, + { + "name": "14", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 2, + "stop_area_count": 65, + "access_point_count": 0, + "vehicle_journey_count": 130, + "journey_pattern_count": 2 + } + }, + { + "name": "01 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 84, + "access_point_count": 0, + "vehicle_journey_count": 11, + "journey_pattern_count": 4 + } + }, + { + "name": "04 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 102, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "07 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 50, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "09", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 105, + "access_point_count": 0, + "vehicle_journey_count": 268, + "journey_pattern_count": 4 + } + }, + { + "name": "18", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 3, + "connection_link_count": 0, + "time_table_count": 4, + "stop_area_count": 27, + "access_point_count": 0, + "vehicle_journey_count": 8, + "journey_pattern_count": 3 + } + }, + { + "name": "04", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 8, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 112, + "access_point_count": 0, + "vehicle_journey_count": 381, + "journey_pattern_count": 8 + } + }, + { + "name": "06", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 5, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 67, + "access_point_count": 0, + "vehicle_journey_count": 279, + "journey_pattern_count": 5 + } + }, + { + "name": "16", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 63, + "access_point_count": 0, + "vehicle_journey_count": 42, + "journey_pattern_count": 4 + } + } + ], + "stats": { + "line_count": 28, + "route_count": 119, + "connection_link_count": 0, + "time_table_count": 60, + "stop_area_count": 2151, + "access_point_count": 0, + "vehicle_journey_count": 4928, + "journey_pattern_count": 119 + } + } +} diff --git a/public/uploads/import/file/2/terminated_job.json b/public/uploads/import/file/2/terminated_job.json new file mode 100644 index 000000000..417bd62ad --- /dev/null +++ b/public/uploads/import/file/2/terminated_job.json @@ -0,0 +1,578 @@ +< HTTP/1.1 200 OK +< Connection: keep-alive +< Cache-Control: no-transform, max-age=2147483647 +< X-Powered-By: Undertow/1 +* Server WildFly/8 is not blacklisted +< Server: WildFly/8 +< Transfer-Encoding: chunked +< Content-Type: application/json +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/data/9151/Citura_050115_220215.zip>; rel="data" +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/data/9151/action_parameters.json>; rel="action_params" +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/data/9151/validation_parameters.json>; rel="validation_params" +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/reports/9151>; rel="location" +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/reports/9151>; rel="delete" +< Link: <http://localhost:8080/mobi.chouette.api/referentials/tatrotest/data/9151/validation.json>; rel="validation" +< Date: Fri, 13 Mar 2015 09:18:07 GMT +< +{ + "id": 9151, + "referential": "tatrotest", + "action": "importer", + "type": "neptune", + "created": 1425984896098, + "updated": 1425984896542, + "status": "TERMINATED", + "action_report": { + "result": "OK", + "zip_file": { + "status": "OK", + "name": "Citura_050115_220215.zip" + }, + "files": [ + { + "name": "C_NEPTUNE_reseau_5_39901717.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901712.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901718.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901710.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901709.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901727.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901746.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901719.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901715.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901716.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901721.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901734.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901725.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901731.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901711.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901722.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901724.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901733.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901726.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901732.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901736.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901708.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901730.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901720.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901745.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901713.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901723.xml", + "status": "OK", + "error": [] + }, + { + "name": "C_NEPTUNE_reseau_5_39901729.xml", + "status": "OK", + "error": [] + } + ], + "lines": [ + { + "name": "03 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 95, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "17", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 66, + "access_point_count": 0, + "vehicle_journey_count": 45, + "journey_pattern_count": 2 + } + }, + { + "name": "TRAMWAY", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 10, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 67, + "access_point_count": 0, + "vehicle_journey_count": 769, + "journey_pattern_count": 10 + } + }, + { + "name": "02", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 3, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 68, + "access_point_count": 0, + "vehicle_journey_count": 388, + "journey_pattern_count": 3 + } + }, + { + "name": "01", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 6, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 84, + "access_point_count": 0, + "vehicle_journey_count": 385, + "journey_pattern_count": 6 + } + }, + { + "name": "10", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 6, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 79, + "access_point_count": 0, + "vehicle_journey_count": 253, + "journey_pattern_count": 6 + } + }, + { + "name": "15", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 31, + "access_point_count": 0, + "vehicle_journey_count": 8, + "journey_pattern_count": 2 + } + }, + { + "name": "13 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 22, + "access_point_count": 0, + "vehicle_journey_count": 17, + "journey_pattern_count": 2 + } + }, + { + "name": "05", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 14, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 109, + "access_point_count": 0, + "vehicle_journey_count": 378, + "journey_pattern_count": 14 + } + }, + { + "name": "02 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 68, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "08", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 9, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 104, + "access_point_count": 0, + "vehicle_journey_count": 236, + "journey_pattern_count": 9 + } + }, + { + "name": "05 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 94, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "12", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 6, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 100, + "access_point_count": 0, + "vehicle_journey_count": 236, + "journey_pattern_count": 6 + } + }, + { + "name": "13", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 101, + "access_point_count": 0, + "vehicle_journey_count": 81, + "journey_pattern_count": 4 + } + }, + { + "name": "03", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 5, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 97, + "access_point_count": 0, + "vehicle_journey_count": 387, + "journey_pattern_count": 5 + } + }, + { + "name": "07", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 105, + "access_point_count": 0, + "vehicle_journey_count": 238, + "journey_pattern_count": 4 + } + }, + { + "name": "11", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 96, + "access_point_count": 0, + "vehicle_journey_count": 251, + "journey_pattern_count": 2 + } + }, + { + "name": "09 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 29, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "CITADINE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 61, + "access_point_count": 0, + "vehicle_journey_count": 77, + "journey_pattern_count": 2 + } + }, + { + "name": "14", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 2, + "stop_area_count": 65, + "access_point_count": 0, + "vehicle_journey_count": 130, + "journey_pattern_count": 2 + } + }, + { + "name": "01 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 84, + "access_point_count": 0, + "vehicle_journey_count": 11, + "journey_pattern_count": 4 + } + }, + { + "name": "04 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 102, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "07 SOIREE", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 2, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 50, + "access_point_count": 0, + "vehicle_journey_count": 10, + "journey_pattern_count": 2 + } + }, + { + "name": "09", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 105, + "access_point_count": 0, + "vehicle_journey_count": 268, + "journey_pattern_count": 4 + } + }, + { + "name": "18", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 3, + "connection_link_count": 0, + "time_table_count": 4, + "stop_area_count": 27, + "access_point_count": 0, + "vehicle_journey_count": 8, + "journey_pattern_count": 3 + } + }, + { + "name": "04", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 8, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 112, + "access_point_count": 0, + "vehicle_journey_count": 381, + "journey_pattern_count": 8 + } + }, + { + "name": "06", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 5, + "connection_link_count": 0, + "time_table_count": 3, + "stop_area_count": 67, + "access_point_count": 0, + "vehicle_journey_count": 279, + "journey_pattern_count": 5 + } + }, + { + "name": "16", + "status": "OK", + "stats": { + "line_count": 1, + "route_count": 4, + "connection_link_count": 0, + "time_table_count": 1, + "stop_area_count": 63, + "access_point_count": 0, + "vehicle_journey_count": 42, + "journey_pattern_count": 4 + } + } + ], + "stats": { + "line_count": 28, + "route_count": 119, + "connection_link_count": 0, + "time_table_count": 60, + "stop_area_count": 2151, + "access_point_count": 0, + "vehicle_journey_count": 4928, + "journey_pattern_count": 119 + } + } +} diff --git a/spec/controllers/routes_controller_spec.rb b/spec/controllers/routes_controller_spec.rb index de6d16c8b..18067dec7 100644 --- a/spec/controllers/routes_controller_spec.rb +++ b/spec/controllers/routes_controller_spec.rb @@ -9,7 +9,7 @@ describe RoutesController, :type => :controller do shared_examples_for "redirected to referential_line_path(referential,line)" do it "should redirect_to referential_line_path(referential,line)" do - #response.should redirect_to( referential_line_path(referential,route.line) ) + # expect(response).to redirect_to( referential_line_path(referential,route.line) ) end end shared_examples_for "line and referential linked" do diff --git a/spec/controllers/vehicle_journey_imports_controller_spec.rb b/spec/controllers/vehicle_journey_imports_controller_spec.rb index ef1ec882a..633f90b70 100644 --- a/spec/controllers/vehicle_journey_imports_controller_spec.rb +++ b/spec/controllers/vehicle_journey_imports_controller_spec.rb @@ -2,6 +2,4 @@ require 'spec_helper' describe ImportTasksController, :type => :controller do login_user - - end diff --git a/spec/features/networks_spec.rb b/spec/features/networks_spec.rb index 523b2e898..75070e7fa 100644 --- a/spec/features/networks_spec.rb +++ b/spec/features/networks_spec.rb @@ -81,7 +81,7 @@ describe "Networks", :type => :feature do # click_link "Supprimer ce réseau" # page.evaluate_script('window.confirm = function() { return true; }') # click_button "Valider" - # page.should have_no_content(subject.name) + # expect(page).to have_no_content(subject.name) # end # end diff --git a/spec/helpers/exports_helper_spec.rb b/spec/helpers/exports_helper_spec.rb index fec8252d5..3d6b8e70e 100644 --- a/spec/helpers/exports_helper_spec.rb +++ b/spec/helpers/exports_helper_spec.rb @@ -6,7 +6,7 @@ require 'spec_helper' # describe ExportsHelper do # describe "string concat" do # it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" +# expect(helper.concat_strings("this","that")).to == "this that" # end # end # end diff --git a/spec/helpers/help_helper_spec.rb b/spec/helpers/help_helper_spec.rb index 3df091c10..0b0de512b 100644 --- a/spec/helpers/help_helper_spec.rb +++ b/spec/helpers/help_helper_spec.rb @@ -6,7 +6,7 @@ require 'spec_helper' # describe HelpHelper do # describe "string concat" do # it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" +# expect(helper.concat_strings("this","that")).to == "this that" # end # end # end diff --git a/spec/helpers/imports_helper_spec.rb b/spec/helpers/imports_helper_spec.rb index ec3bb05c5..12cddeb25 100644 --- a/spec/helpers/imports_helper_spec.rb +++ b/spec/helpers/imports_helper_spec.rb @@ -6,7 +6,7 @@ require 'spec_helper' # describe ImportsHelper do # describe "string concat" do # it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" +# expect(helper.concat_strings("this","that")).to == "this that" # end # end # end diff --git a/spec/helpers/referentials_helper_spec.rb b/spec/helpers/referentials_helper_spec.rb index 6efc13822..6b659dc8b 100644 --- a/spec/helpers/referentials_helper_spec.rb +++ b/spec/helpers/referentials_helper_spec.rb @@ -6,7 +6,7 @@ require 'spec_helper' # describe ReferentialsHelper do # describe "string concat" do # it "concats two strings with spaces" do -# helper.concat_strings("this","that").should == "this that" +# expect(helper.concat_strings("this","that")).to == "this that" # end # end # end diff --git a/spec/models/compliance_check_task_spec.rb b/spec/models/compliance_check_task_spec.rb index 2e5379de7..a062fdb58 100644 --- a/spec/models/compliance_check_task_spec.rb +++ b/spec/models/compliance_check_task_spec.rb @@ -1,5 +1,8 @@ # require 'spec_helper' +# TODO: Can we get rid of this??? +# ************************* + # describe ComplianceCheckTask, :type => :model do # subject { Factory( :compliance_check_task ) } @@ -274,19 +277,19 @@ # # # # it "should create a ComplianceCheckResult :started when started" do # # subject.validate -# # subject.compliance_check_results.first.should be_log_message(:key => "started") + # expect(subject.compliance_check_results.first).to be_log_message(:key => "started") # # end # # # # it "should create a ComplianceCheckResult :completed when completed" do # # subject.validate -# # subject.compliance_check_results.last.should be_log_message(:key => "completed") + # expect(subject.compliance_check_results.last).to be_log_message(:key => "completed") # # end # # # # it "should create a ComplianceCheckResult :failed when failed" do # # pending # # # subject.loader.stub(:export).and_raise("export failed") # # subject.validate -# # subject.compliance_check_results.last.should be_log_message(:key => "failed") + # expect(subject.compliance_check_results.last).to be_log_message(:key => "failed") # # end # # # # end diff --git a/spec/models/ninoxe_extension_spec.rb b/spec/models/ninoxe_extension_spec.rb index b8892f053..016e10496 100644 --- a/spec/models/ninoxe_extension_spec.rb +++ b/spec/models/ninoxe_extension_spec.rb @@ -8,23 +8,23 @@ describe Chouette::StopArea do # FIXME #821 # it "should return referential projection " do # subject.referential.projection_type='27572' - # subject.projection.should == subject.referential.projection_type + # expect(subject.projection).to eq(subject.referential.projection_type) # end # it "should return projection coordinates when referential has projection" do # subject.latitude = 45 # subject.longitude = 0 # subject.referential.projection_type='27572' - # subject.projection_x.should_not be_nil - # subject.projection_y.should_not be_nil + # expect(subject.projection_x).not_to be_nil + # expect(subject.projection_y).not_to be_nil # end # it "should return nil projection coordinates when referential has no projection" do # subject.latitude = 45 # subject.longitude = 0 # subject.referential.projection_type=nil - # subject.projection_x.should be_nil - # subject.projection_y.should be_nil + # expect(subject.projection_x).to be_nil + # expect(subject.projection_y).to be_nil # end end @@ -34,25 +34,25 @@ describe Chouette::AccessPoint do subject {create(:access_point)} - it "should return referential projection " do + it "should return referential projection" do subject.referential.projection_type='27572' - subject.projection.should == subject.referential.projection_type + expect(subject.projection).to eq(subject.referential.projection_type) end it "should return projection coordinates when referential has projection" do subject.latitude = 45 subject.longitude = 0 subject.referential.projection_type='27572' - subject.projection_x.should_not be_nil - subject.projection_y.should_not be_nil + expect(subject.projection_x).not_to be_nil + expect(subject.projection_y).not_to be_nil end it "should return nil projection coordinates when referential has no projection" do subject.latitude = 45 subject.longitude = 0 subject.referential.projection_type=nil - subject.projection_x.should be_nil - subject.projection_y.should be_nil + expect(subject.projection_x).to be_nil + expect(subject.projection_y).to be_nil end end diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb index 9b4235755..527f71015 100644 --- a/spec/models/organisation_spec.rb +++ b/spec/models/organisation_spec.rb @@ -10,7 +10,7 @@ describe Organisation, :type => :model do it "create a rule_parameter_set" do organisation = create(:organisation) - organisation.rule_parameter_sets.size.should == 1 + expect(organisation.rule_parameter_sets.size).to eq(1) end describe "Portail sync" do diff --git a/spec/models/referential_metadata_spec.rb b/spec/models/referential_metadata_spec.rb index ede589860..0f628c8d1 100644 --- a/spec/models/referential_metadata_spec.rb +++ b/spec/models/referential_metadata_spec.rb @@ -118,6 +118,19 @@ RSpec.describe ReferentialMetadata, :type => :model do end + describe "#periodes" do + + let(:referential_metadata) { create(:referential_metadata).reload } + + it "should not exclude end" do + expect(referential_metadata.periodes).to_not be_empty + referential_metadata.periodes.each do |periode| + expect(periode).to_not be_exclude_end + end + end + + end + describe "before_validation" do let(:referential_metadata) do create(:referential_metadata).tap do |metadata| diff --git a/spec/models/vehicle_journey_import_spec.rb b/spec/models/vehicle_journey_import_spec.rb index c4d452f84..a743bdecb 100644 --- a/spec/models/vehicle_journey_import_spec.rb +++ b/spec/models/vehicle_journey_import_spec.rb @@ -119,7 +119,7 @@ describe VehicleJourneyImport, :type => :model do it "should return false when stop points in file are not the same in the route" do vehicle_journey_import = VehicleJourneyImport.new(:route => other_route, :file => valid_file) - expect { vehicle_journey_import.load_imported_vehicle_journeys }.to raise_exception + expect { vehicle_journey_import.load_imported_vehicle_journeys }.to raise_error(RuntimeError) end # it "should return errors when vehicle journeys in file are invalid" do @@ -130,7 +130,7 @@ describe VehicleJourneyImport, :type => :model do it "should return errors when vehicle journey at stops in file are invalid" do vehicle_journey_import = VehicleJourneyImport.new(:route => route, :file => invalid_file_on_vjas) - expect { vehicle_journey_import.load_imported_vehicle_journeys }.to raise_exception + expect { vehicle_journey_import.load_imported_vehicle_journeys }.to raise_error(ArgumentError) end it "should return errors when vehicle journey at stops are not in ascendant order" do diff --git a/spec/routing/companies_spec.rb b/spec/routing/companies_spec.rb index df16079f3..774431dc3 100644 --- a/spec/routing/companies_spec.rb +++ b/spec/routing/companies_spec.rb @@ -3,19 +3,19 @@ require 'spec_helper' describe CompaniesController do describe "routing" do it "not recognize #routes" do - get( "/line_referentials/1/companies/2/routes").should_not route_to( + expect(get( "/line_referentials/1/companies/2/routes")).not_to route_to( :controller => "companies", :action => "routes", :line_referential_id => "1", :id => "2" ) end it "not recognize #lines" do - get( "/line_referentials/1/companies/2/lines").should_not route_to( + expect(get( "/line_referentials/1/companies/2/lines")).not_to route_to( :controller => "companies", :action => "lines", :line_referential_id => "1", :id => "2" ) end it "recognize and generate #show" do - get( "/line_referentials/1/companies/2").should route_to( + expect(get( "/line_referentials/1/companies/2")).to route_to( :controller => "companies", :action => "show", :line_referential_id => "1", :id => "2" ) diff --git a/spec/routing/group_of_lines_spec.rb b/spec/routing/group_of_lines_spec.rb index 8bc437249..2a7262893 100644 --- a/spec/routing/group_of_lines_spec.rb +++ b/spec/routing/group_of_lines_spec.rb @@ -3,19 +3,19 @@ require 'spec_helper' describe GroupOfLinesController do describe "routing" do it "not recognize #routes" do - get( "/line_referentials/1/group_of_lines/2/routes").should_not route_to( + expect(get( "/line_referentials/1/group_of_lines/2/routes")).not_to route_to( :controller => "group_of_lines", :action => "routes", :line_referential_id => "1", :id => "2" ) end it "not recognize #lines" do - get( "/line_referentials/1/group_of_lines/2/lines").should_not route_to( + expect(get( "/line_referentials/1/group_of_lines/2/lines")).not_to route_to( :controller => "group_of_lines", :action => "lines", :line_referential_id => "1", :id => "2" ) end it "recognize and generate #show" do - get( "/line_referentials/1/group_of_lines/2").should route_to( + expect(get( "/line_referentials/1/group_of_lines/2")).to route_to( :controller => "group_of_lines", :action => "show", :line_referential_id => "1", :id => "2" ) diff --git a/spec/routing/networks_spec.rb b/spec/routing/networks_spec.rb index 8d5366f88..941f98c1e 100644 --- a/spec/routing/networks_spec.rb +++ b/spec/routing/networks_spec.rb @@ -3,19 +3,19 @@ require 'spec_helper' describe NetworksController do describe "routing" do it "not recognize #routes" do - get( "/line_referentials/1/networks/2/routes").should_not route_to( + expect(get( "/line_referentials/1/networks/2/routes")).not_to route_to( :controller => "networks", :action => "routes", :line_referential_id => "1", :id => "2" ) end it "not recognize #lines" do - get( "/line_referentials/1/networks/2/lines").should_not route_to( + expect(get( "/line_referentials/1/networks/2/lines")).not_to route_to( :controller => "networks", :action => "lines", :line_referential_id => "1", :id => "2" ) end it "recognize and generate #show" do - get( "/line_referentials/1/networks/2").should route_to( + expect(get( "/line_referentials/1/networks/2")).to route_to( :controller => "networks", :action => "show", :line_referential_id => "1", :id => "2" ) diff --git a/spec/routing/time_tables_spec.rb b/spec/routing/time_tables_spec.rb index 45e426f4c..720ae0815 100644 --- a/spec/routing/time_tables_spec.rb +++ b/spec/routing/time_tables_spec.rb @@ -3,25 +3,25 @@ require 'spec_helper' describe TimeTablesController do describe "routing" do it "not recognize #routes" do - get( "/referentials/1/time_tables/2/routes").should_not route_to( + expect(get( "/referentials/1/time_tables/2/routes")).not_to route_to( :controller => "time_tables", :action => "routes", :referential_id => "1", :id => "2" ) end it "not recognize #lines" do - get( "/referentials/1/time_tables/2/lines").should_not route_to( + expect(get( "/referentials/1/time_tables/2/lines")).not_to route_to( :controller => "time_tables", :action => "lines", :referential_id => "1", :id => "2" ) end it "not recognize #time_table_periods" do - get( "/referentials/1/time_tables/2/time_table_periods").should_not route_to( + expect(get( "/referentials/1/time_tables/2/time_table_periods")).not_to route_to( "time_table_periods#index", :referential_id => "1", :time_table_id => "2" ) end it "recognize and generate #show" do - get( "/referentials/1/time_tables/2").should route_to( + expect(get( "/referentials/1/time_tables/2")).to route_to( :controller => "time_tables", :action => "show", :referential_id => "1", :id => "2" ) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index dd062bc84..f32d8a0fc 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -87,3 +87,20 @@ RSpec.configure do |config| config.infer_spec_type_from_file_location! end + +Shoulda::Matchers.configure do |config| + config.integrate do |with| + # Choose a test framework: + with.test_framework :rspec + # with.test_framework :minitest + # with.test_framework :minitest_4 + # with.test_framework :test_unit + + # Choose one or more libraries: + # with.library :active_record + # with.library :active_model + # with.library :action_controller + # Or, choose the following (which implies all of the above): + with.library :rails + end +end diff --git a/spec/support/type_ids_modelable_spec.rb b/spec/support/type_ids_modelable.rb index 9ed341810..9ed341810 100644 --- a/spec/support/type_ids_modelable_spec.rb +++ b/spec/support/type_ids_modelable.rb diff --git a/spec/tasks/reflex_rake_spec.rb b/spec/tasks/reflex_rake_spec.rb index 04c5886aa..49874231e 100644 --- a/spec/tasks/reflex_rake_spec.rb +++ b/spec/tasks/reflex_rake_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe 'reflex:sync' do - context 'On first sync' do + pending 'On first sync' do before(:each) do ['getOP', 'getOR'].each do |method| stub_request(:get, "#{Rails.application.config.reflex_api_url}/?format=xml&idRefa=0&method=#{method}"). diff --git a/spec/views/companies/show.html.erb_spec.rb b/spec/views/companies/show.html.erb_spec.rb index f0a8a99d4..dbc544f63 100644 --- a/spec/views/companies/show.html.erb_spec.rb +++ b/spec/views/companies/show.html.erb_spec.rb @@ -12,7 +12,7 @@ describe "/companies/show", :type => :view do # it "should display a map with class 'company'" do # render - # rendered.should have_selector("#map", :class => 'company') + # expect(rendered).to have_selector("#map", :class => 'company') # end it "should render a link to edit the company" do diff --git a/spec/views/connection_links/show.html.erb_spec.rb b/spec/views/connection_links/show.html.erb_spec.rb index 1a7ad3d16..c04a4f3f1 100644 --- a/spec/views/connection_links/show.html.erb_spec.rb +++ b/spec/views/connection_links/show.html.erb_spec.rb @@ -18,7 +18,7 @@ describe "/connection_links/show", :type => :view do # it "should display a map with class 'connection_link'" do # pending ": map not yet implemented" # render -# rendered.should have_selector("#map", :class => 'connection_link') +# expect(rendered).to have_selector("#map", :class => 'connection_link') # end it "should render a link to edit the connection_link" do diff --git a/spec/views/layouts/application.html.erb_spec.rb b/spec/views/layouts/application.html.erb_spec.rb index 700084922..80e3e6f86 100644 --- a/spec/views/layouts/application.html.erb_spec.rb +++ b/spec/views/layouts/application.html.erb_spec.rb @@ -12,7 +12,7 @@ describe "/layouts/application", :type => :view do it "should display referential name as title" #do # render - # rendered.should_not have_selector("h1") + # expect(rendered).not_to have_selector("h1") # end end diff --git a/spec/views/lines/show.html.erb_spec.rb b/spec/views/lines/show.html.erb_spec.rb index 939d6bc83..3a9efa0ce 100644 --- a/spec/views/lines/show.html.erb_spec.rb +++ b/spec/views/lines/show.html.erb_spec.rb @@ -19,7 +19,7 @@ describe "/lines/show", :type => :view do # it "should display a map with class 'line'" do # render - # rendered.should have_selector("#map", :class => 'line') + # expect(rendered).to have_selector("#map", :class => 'line') # end # FIXME #2018 xit "should render a link to edit the line" do diff --git a/spec/views/organisations/show.html.erb b/spec/views/organisations/show.html.erb index 69f5e2956..84af3b044 100644 --- a/spec/views/organisations/show.html.erb +++ b/spec/views/organisations/show.html.erb @@ -10,7 +10,7 @@ describe "/organisations/show" do it "should render each User" do render organisation.users.each do |user| - rendered.should have_selector("div.user span.name", :text => user.name) + expect(rendered).to have_selector("div.user span.name", :text => user.name) end end diff --git a/spec/views/routes/show.html.erb_spec.rb b/spec/views/routes/show.html.erb_spec.rb index 787bf72d0..7557ede27 100644 --- a/spec/views/routes/show.html.erb_spec.rb +++ b/spec/views/routes/show.html.erb_spec.rb @@ -26,7 +26,7 @@ describe "/routes/show", :type => :view do # it "should display a map with class 'line'" do # render - # rendered.should have_selector("#map", :class => 'line') + # expect(rendered).to have_selector("#map", :class => 'line') # end # it "should render a link to edit the route" do diff --git a/spec/views/stop_areas/show.html.erb_spec.rb b/spec/views/stop_areas/show.html.erb_spec.rb index 0c9c6663b..a22379402 100644 --- a/spec/views/stop_areas/show.html.erb_spec.rb +++ b/spec/views/stop_areas/show.html.erb_spec.rb @@ -14,7 +14,7 @@ describe "/stop_areas/show", :type => :view do # it "should display a map with class 'stop_area'" do # render - # rendered.should have_selector("#map", :class => 'stop_area') + # expect(rendered).to have_selector("#map", :class => 'stop_area') # end it "should render a link to edit the stop_area" do |
