From 7b9370d10a2d67b83610b8cf8b876734972c2ee9 Mon Sep 17 00:00:00 2001 From: RobertDober Date: Mon, 10 Apr 2017 11:03:11 +0200 Subject: Deprecation Warnings removed; Seeds corrected, Refs: #2070 --- Gemfile | 7 +- Gemfile.lock | 472 +++++------ README.md | 4 +- app/views/access_links/_form.html.slim | 2 +- app/views/connection_links/_form.html.slim | 2 +- config/application.rb | 1 + config/environment.rb | 2 +- config/environments/production.rb | 2 +- config/environments/test.rb | 2 +- config/initializers/formtastic.rb | 6 + db/migrate/20120515134710_create_imports.rb | 12 +- db/migrate/20170123131243_set_user_permissions.rb | 15 +- db/schema.rb | 887 --------------------- db/seeds.rb | 41 +- spec/controllers/routes_controller_spec.rb | 2 +- .../vehicle_journey_imports_controller_spec.rb | 2 - spec/features/networks_spec.rb | 2 +- spec/helpers/exports_helper_spec.rb | 2 +- spec/helpers/help_helper_spec.rb | 2 +- spec/helpers/imports_helper_spec.rb | 2 +- spec/helpers/referentials_helper_spec.rb | 2 +- spec/models/compliance_check_task_spec.rb | 9 +- spec/models/ninoxe_extension_spec.rb | 22 +- spec/models/organisation_spec.rb | 2 +- spec/models/vehicle_journey_import_spec.rb | 4 +- spec/routing/companies_spec.rb | 6 +- spec/routing/group_of_lines_spec.rb | 6 +- spec/routing/networks_spec.rb | 6 +- spec/routing/time_tables_spec.rb | 8 +- spec/support/type_ids_modelable.rb | 100 +++ spec/support/type_ids_modelable_spec.rb | 100 --- spec/views/companies/show.html.erb_spec.rb | 2 +- spec/views/connection_links/show.html.erb_spec.rb | 2 +- spec/views/layouts/application.html.erb_spec.rb | 2 +- spec/views/lines/show.html.erb_spec.rb | 2 +- spec/views/organisations/show.html.erb | 2 +- spec/views/routes/show.html.erb_spec.rb | 2 +- spec/views/stop_areas/show.html.erb_spec.rb | 2 +- 38 files changed, 447 insertions(+), 1299 deletions(-) delete mode 100644 db/schema.rb create mode 100644 spec/support/type_ids_modelable.rb delete mode 100644 spec/support/type_ids_modelable_spec.rb diff --git a/Gemfile b/Gemfile index d066d04bf..7fe54acfd 100644 --- a/Gemfile +++ b/Gemfile @@ -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.2.7.1' +gem 'rails', '~> 4.2.8' # Use SCSS for stylesheets gem 'sass-rails', '~> 4.0.3' @@ -86,7 +88,7 @@ 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' @@ -165,6 +167,7 @@ end group :test, :development do gem 'awesome_print' gem 'pry-rails' + gem 'pry-byebug' gem 'rspec-rails', '~> 3.5.0' gem 'fakeweb' gem 'webmock' diff --git a/Gemfile.lock b/Gemfile.lock index 1ed5de7ae..8be60d573 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,19 @@ +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 @@ -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/README.md b/README.md index 5161d5ca8..ee0a29c10 100644 --- a/README.md +++ b/README.md @@ -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/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/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 `
` 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/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/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/schema.rb b/db/schema.rb deleted file mode 100644 index 18952cfc6..000000000 --- a/db/schema.rb +++ /dev/null @@ -1,887 +0,0 @@ -# encoding: UTF-8 -# This file is auto-generated from the current state of the database. Instead -# of editing this file, please use the migrations feature of Active Record to -# incrementally modify your database, and then regenerate this schema definition. -# -# Note that this schema.rb definition is the authoritative source for your -# database schema. If you need to create the application database on another -# system, you should be using db:schema:load, not running all the migrations -# from scratch. The latter is a flawed and unsustainable approach (the more migrations -# you'll amass, the slower it'll run and the greater likelihood for issues). -# -# It's strongly recommended that you check this file into your version control system. - -ActiveRecord::Schema.define(version: 20170410134931) do - - # These are extensions that must be enabled in order to support this database - enable_extension "plpgsql" - enable_extension "postgis" - enable_extension "hstore" - - create_table "access_links", force: true do |t| - t.integer "access_point_id", limit: 8 - t.integer "stop_area_id", limit: 8 - t.string "objectid", limit: nil, null: false - t.integer "object_version", limit: 8 - t.string "creator_id", limit: nil - t.string "name", limit: nil - t.string "comment", limit: nil - t.decimal "link_distance", precision: 19, scale: 2 - t.boolean "lift_availability" - t.boolean "mobility_restricted_suitability" - t.boolean "stairs_availability" - t.time "default_duration" - t.time "frequent_traveller_duration" - t.time "occasional_traveller_duration" - t.time "mobility_restricted_traveller_duration" - t.string "link_type", limit: nil - t.integer "int_user_needs" - t.string "link_orientation", limit: nil - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "access_links", ["objectid"], :name => "access_links_objectid_key", :unique => true - - create_table "access_points", force: true do |t| - t.string "objectid", limit: nil - t.integer "object_version", limit: 8 - t.string "creator_id", limit: nil - t.string "name", limit: nil - t.string "comment", limit: nil - t.decimal "longitude", precision: 19, scale: 16 - t.decimal "latitude", precision: 19, scale: 16 - t.string "long_lat_type", limit: nil - t.string "country_code", limit: nil - t.string "street_name", limit: nil - t.string "contained_in", limit: nil - t.time "openning_time" - t.time "closing_time" - t.string "access_type", limit: nil - t.boolean "lift_availability" - t.boolean "mobility_restricted_suitability" - t.boolean "stairs_availability" - t.integer "stop_area_id", limit: 8 - t.string "zip_code", limit: nil - t.string "city_name", limit: nil - t.text "import_xml" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "access_points", ["objectid"], :name => "access_points_objectid_key", :unique => true - - create_table "api_keys", force: true do |t| - t.integer "referential_id", limit: 8 - t.string "token", limit: nil - t.string "name", limit: nil - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "calendars", force: true do |t| - t.string "name", limit: nil - t.string "short_name", limit: nil - t.daterange "date_ranges", array: true - t.date "dates", array: true - t.boolean "shared" - t.integer "organisation_id", limit: 8 - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "calendars", ["organisation_id"], :name => "index_calendars_on_organisation_id" - add_index "calendars", ["short_name"], :name => "index_calendars_on_short_name", :unique => true - - create_table "clean_up_results", force: true do |t| - t.string "message_key", limit: nil - t.hstore "message_attributs" - t.integer "clean_up_id", limit: 8 - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "clean_up_results", ["clean_up_id"], :name => "index_clean_up_results_on_clean_up_id" - - create_table "clean_ups", force: true do |t| - t.string "status", limit: nil - t.datetime "started_at" - t.datetime "ended_at" - t.integer "referential_id", limit: 8 - t.datetime "begin_date" - t.datetime "created_at" - t.datetime "updated_at" - t.datetime "end_date" - end - - add_index "clean_ups", ["referential_id"], :name => "index_clean_ups_on_referential_id" - - create_table "companies", force: true do |t| - t.string "objectid", limit: nil, null: false - t.integer "object_version", limit: 8 - t.string "creator_id", limit: nil - t.string "name", limit: nil - t.string "short_name", limit: nil - t.string "organizational_unit", limit: nil - t.string "operating_department_name", limit: nil - t.string "code", limit: nil - t.string "phone", limit: nil - t.string "fax", limit: nil - t.string "email", limit: nil - t.string "registration_number", limit: nil - t.string "url", limit: nil - t.string "time_zone", limit: nil - t.integer "line_referential_id", limit: 8 - t.text "import_xml" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "companies", ["line_referential_id"], :name => "index_companies_on_line_referential_id" - add_index "companies", ["objectid"], :name => "companies_objectid_key", :unique => true - add_index "companies", ["registration_number"], :name => "companies_registration_number_key" - - create_table "connection_links", force: true do |t| - t.integer "departure_id", limit: 8 - t.integer "arrival_id", limit: 8 - t.string "objectid", limit: nil, null: false - t.integer "object_version", limit: 8 - t.string "creator_id", limit: nil - t.string "name", limit: nil - t.string "comment", limit: nil - t.decimal "link_distance", precision: 19, scale: 2 - t.string "link_type", limit: nil - t.time "default_duration" - t.time "frequent_traveller_duration" - t.time "occasional_traveller_duration" - t.time "mobility_restricted_traveller_duration" - t.boolean "mobility_restricted_suitability" - t.boolean "stairs_availability" - t.boolean "lift_availability" - t.integer "int_user_needs" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "connection_links", ["objectid"], :name => "connection_links_objectid_key", :unique => true - - create_table "delayed_jobs", force: true do |t| - t.integer "priority", default: 0 - t.integer "attempts", default: 0 - t.text "handler" - t.text "last_error" - t.datetime "run_at" - t.datetime "locked_at" - t.datetime "failed_at" - t.string "locked_by" - t.string "queue" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority" - - create_table "exports", force: true do |t| - t.integer "referential_id", limit: 8 - t.string "status", limit: nil - t.string "type", limit: nil - t.string "options", limit: nil - t.datetime "created_at" - t.datetime "updated_at" - t.string "references_type", limit: nil - t.string "reference_ids", limit: nil - end - - add_index "exports", ["referential_id"], :name => "index_exports_on_referential_id" - - create_table "facilities", force: true do |t| - t.integer "stop_area_id", limit: 8 - t.integer "line_id", limit: 8 - t.integer "connection_link_id", limit: 8 - t.integer "stop_point_id", limit: 8 - t.string "objectid", limit: nil, null: false - t.integer "object_version", limit: 8 - t.datetime "creation_time" - t.string "creator_id", limit: nil - t.string "name", limit: nil - t.string "comment", limit: nil - t.string "description", limit: nil - t.boolean "free_access" - t.decimal "longitude", precision: 19, scale: 16 - t.decimal "latitude", precision: 19, scale: 16 - t.string "long_lat_type", limit: nil - t.decimal "x", precision: 19, scale: 2 - t.decimal "y", precision: 19, scale: 2 - t.string "projection_type", limit: nil - t.string "country_code", limit: nil - t.string "street_name", limit: nil - t.string "contained_in", limit: nil - end - - add_index "facilities", ["objectid"], :name => "facilities_objectid_key", :unique => true - - create_table "facilities_features", id: false, force: true do |t| - t.integer "facility_id", limit: 8 - t.integer "choice_code" - end - - create_table "footnotes", force: true do |t| - t.integer "line_id", limit: 8 - t.string "code", limit: nil - t.string "label", limit: nil - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "footnotes_vehicle_journeys", id: false, force: true do |t| - t.integer "vehicle_journey_id", limit: 8 - t.integer "footnote_id", limit: 8 - end - - create_table "group_of_lines", force: true do |t| - t.string "objectid", limit: nil, null: false - t.integer "object_version", limit: 8 - t.string "creator_id", limit: nil - t.string "name", limit: nil - t.string "comment", limit: nil - t.string "registration_number", limit: nil - t.integer "line_referential_id", limit: 8 - t.text "import_xml" - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "group_of_lines", ["line_referential_id"], :name => "index_group_of_lines_on_line_referential_id" - add_index "group_of_lines", ["objectid"], :name => "group_of_lines_objectid_key", :unique => true - - create_table "group_of_lines_lines", id: false, force: true do |t| - t.integer "group_of_line_id", limit: 8 - t.integer "line_id", limit: 8 - end - - create_table "import_messages", force: true do |t| - t.integer "criticity" - t.string "message_key", limit: nil - t.hstore "message_attributs" - t.integer "import_id", limit: 8 - t.integer "resource_id", limit: 8 - t.datetime "created_at" - t.datetime "updated_at" - t.hstore "resource_attributes" - end - - add_index "import_messages", ["import_id"], :name => "index_import_messages_on_import_id" - add_index "import_messages", ["resource_id"], :name => "index_import_messages_on_resource_id" - - create_table "import_resources", force: true do |t| - t.integer "import_id", limit: 8 - t.string "status", limit: nil - t.datetime "created_at" - t.datetime "updated_at" - t.string "type", limit: nil - t.string "reference", limit: nil - t.string "name", limit: nil - t.hstore "metrics" - end - - add_index "import_resources", ["import_id"], :name => "index_import_resources_on_import_id" - - create_table "imports", force: true do |t| - t.string "status", limit: nil - t.string "current_step_id", limit: nil - t.float "current_step_progress" - t.integer "workbench_id", limit: 8 - t.integer "referential_id", limit: 8 - t.string "name", limit: nil - t.datetime "created_at" - t.datetime "updated_at" - t.string "file", limit: nil - t.datetime "started_at" - t.datetime "ended_at" - t.string "token_download", limit: nil - t.string "type", limit: nil - end - - add_index "imports", ["referential_id"], :name => "index_imports_on_referential_id" - add_index "imports", ["workbench_id"], :name => "index_imports_on_workbench_id" - - create_table "journey_frequencies", force: true do |t| - t.integer "vehicle_journey_id", limit: 8 - t.time "scheduled_headway_interval", null: false - t.time "first_departure_time", null: false - t.time "last_departure_time" - t.boolean "exact_time", default: false - t.datetime "created_at" - t.datetime "updated_at" - t.integer "timeband_id", limit: 8 - end - - add_index "journey_frequencies", ["timeband_id"], :name => "index_journey_frequencies_on_timeband_id" - add_index "journey_frequencies", ["vehicle_journey_id"], :name => "index_journey_frequencies_on_vehicle_journey_id" - - create_table "journey_pattern_sections", force: true do |t| - t.integer "journey_pattern_id", limit: 8, null: false - t.integer "route_section_id", limit: 8, null: false - t.integer "rank", null: false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "journey_pattern_sections", ["journey_pattern_id", "route_section_id", "rank"], :name => "index_jps_on_journey_pattern_id_and_route_section_id_and_rank", :unique => true - add_index "journey_pattern_sections", ["journey_pattern_id"], :name => "index_journey_pattern_sections_on_journey_pattern_id" - add_index "journey_pattern_sections", ["route_section_id"], :name => "index_journey_pattern_sections_on_route_section_id" - - create_table "journey_patterns", force: true do |t| - t.integer "route_id", limit: 8 - t.string "objectid", limit: nil, null: false - t.integer "object_version", limit: 8 - t.string "creator_id", limit: nil - t.string "name", limit: nil - t.string "comment", limit: nil - t.string "registration_number", limit: nil - t.string "published_name", limit: nil - t.integer "departure_stop_point_id", limit: 8 - t.integer "arrival_stop_point_id", limit: 8 - t.integer "section_status", default: 0, null: false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "journey_patterns", ["objectid"], :name => "journey_patterns_objectid_key", :unique => true - - create_table "journey_patterns_stop_points", id: false, force: true do |t| - t.integer "journey_pattern_id", limit: 8 - t.integer "stop_point_id", limit: 8 - end - - add_index "journey_patterns_stop_points", ["journey_pattern_id"], :name => "index_journey_pattern_id_on_journey_patterns_stop_points" - - create_table "line_referential_memberships", force: true do |t| - t.integer "organisation_id", limit: 8 - t.integer "line_referential_id", limit: 8 - t.boolean "owner" - end - - create_table "line_referential_sync_messages", force: true do |t| - t.integer "criticity" - t.string "message_key", limit: nil - t.hstore "message_attributs" - t.integer "line_referential_sync_id", limit: 8 - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "line_referential_sync_messages", ["line_referential_sync_id"], :name => "line_referential_sync_id" - - create_table "line_referential_syncs", force: true do |t| - t.integer "line_referential_id", limit: 8 - t.datetime "created_at" - t.datetime "updated_at" - t.datetime "started_at" - t.datetime "ended_at" - t.string "status", limit: nil - end - - add_index "line_referential_syncs", ["line_referential_id"], :name => "index_line_referential_syncs_on_line_referential_id" - - create_table "line_referentials", force: true do |t| - t.string "name", limit: nil - t.datetime "created_at" - t.datetime "updated_at" - t.integer "sync_interval", default: 1 - end - - create_table "lines", force: true do |t| - t.integer "network_id", limit: 8 - t.integer "company_id", limit: 8 - t.string "objectid", limit: nil, null: false - t.integer "object_version", limit: 8 - t.string "creator_id", limit: nil - t.string "name", limit: nil - t.string "number", limit: nil - t.string "published_name", limit: nil - t.string "transport_mode", limit: nil - t.string "registration_number", limit: nil - t.string "comment", limit: nil - t.boolean "mobility_restricted_suitability" - t.integer "int_user_needs" - t.boolean "flexible_service" - t.string "url", limit: nil - t.string "color", limit: 6 - t.string "text_color", limit: 6 - t.string "stable_id", limit: nil - t.integer "line_referential_id", limit: 8 - t.boolean "deactivated", default: false - t.text "import_xml" - t.string "transport_submode", limit: nil - t.integer "secondary_company_ids", limit: 8, array: true - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "lines", ["line_referential_id"], :name => "index_lines_on_line_referential_id" - add_index "lines", ["objectid"], :name => "lines_objectid_key", :unique => true - add_index "lines", ["registration_number"], :name => "lines_registration_number_key" - add_index "lines", ["secondary_company_ids"], :name => "index_lines_on_secondary_company_ids" - - create_table "networks", force: true do |t| - t.string "objectid", limit: nil, null: false - t.integer "object_version", limit: 8 - t.string "creator_id", limit: nil - t.date "version_date" - t.string "description", limit: nil - t.string "name", limit: nil - t.string "registration_number", limit: nil - t.string "source_name", limit: nil - t.string "source_type", limit: nil - t.string "source_identifier", limit: nil - t.string "comment", limit: nil - t.text "import_xml" - t.integer "line_referential_id", limit: 8 - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "networks", ["line_referential_id"], :name => "index_networks_on_line_referential_id" - add_index "networks", ["objectid"], :name => "networks_objectid_key", :unique => true - add_index "networks", ["registration_number"], :name => "networks_registration_number_key" - - create_table "organisations", force: true do |t| - t.string "name", limit: nil - t.datetime "created_at" - t.datetime "updated_at" - t.string "data_format", limit: nil, default: "neptune" - t.string "code", limit: nil - t.datetime "synced_at" - t.hstore "sso_attributes" - end - - add_index "organisations", ["code"], :name => "index_organisations_on_code", :unique => true - - create_table "pt_links", force: true do |t| - t.integer "start_of_link_id", limit: 8 - t.integer "end_of_link_id", limit: 8 - t.integer "route_id", limit: 8 - t.string "objectid", limit: nil, null: false - t.integer "object_version", limit: 8 - t.string "creator_id", limit: nil - t.string "name", limit: nil - t.string "comment", limit: nil - t.decimal "link_distance", precision: 19, scale: 2 - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "pt_links", ["objectid"], :name => "pt_links_objectid_key", :unique => true - - create_table "referential_clonings", force: true do |t| - t.string "status", limit: nil - t.datetime "started_at" - t.datetime "ended_at" - t.integer "source_referential_id", limit: 8 - t.integer "target_referential_id", limit: 8 - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "referential_clonings", ["source_referential_id"], :name => "index_referential_clonings_on_source_referential_id" - add_index "referential_clonings", ["target_referential_id"], :name => "index_referential_clonings_on_target_referential_id" - - create_table "referential_metadata", force: true do |t| - t.integer "referential_id", limit: 8 - t.integer "line_ids", limit: 8, array: true - t.integer "referential_source_id", limit: 8 - t.datetime "created_at" - t.datetime "updated_at" - t.daterange "periodes", array: true - end - - add_index "referential_metadata", ["line_ids"], :name => "index_referential_metadata_on_line_ids" - add_index "referential_metadata", ["referential_id"], :name => "index_referential_metadata_on_referential_id" - add_index "referential_metadata", ["referential_source_id"], :name => "index_referential_metadata_on_referential_source_id" - - create_table "referentials", force: true do |t| - t.string "name", limit: nil - t.string "slug", limit: nil - t.datetime "created_at" - t.datetime "updated_at" - t.string "prefix", limit: nil - t.string "projection_type", limit: nil - t.string "time_zone", limit: nil - t.string "bounds", limit: nil - t.integer "organisation_id", limit: 8 - t.text "geographical_bounds" - t.integer "user_id", limit: 8 - t.string "user_name", limit: nil - t.string "data_format", limit: nil - t.integer "line_referential_id", limit: 8 - t.integer "stop_area_referential_id", limit: 8 - t.integer "workbench_id", limit: 8 - t.datetime "archived_at" - t.integer "created_from_id", limit: 8 - t.boolean "ready", default: false - end - - add_index "referentials", ["created_from_id"], :name => "index_referentials_on_created_from_id" - - create_table "route_sections", force: true do |t| - t.integer "departure_id", limit: 8 - t.integer "arrival_id", limit: 8 - t.spatial "input_geometry", limit: {:srid=>4326, :type=>"line_string"} - t.spatial "processed_geometry", limit: {:srid=>4326, :type=>"line_string"} - t.string "objectid", limit: nil, null: false - t.integer "object_version", limit: 8 - t.string "creator_id", limit: nil - t.float "distance" - t.boolean "no_processing" - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "routes", force: true do |t| - t.integer "line_id", limit: 8 - t.string "objectid", limit: nil, null: false - t.integer "object_version", limit: 8 - t.string "creator_id", limit: nil - t.string "name", limit: nil - t.string "comment", limit: nil - t.integer "opposite_route_id", limit: 8 - t.string "published_name", limit: nil - t.string "number", limit: nil - t.string "direction", limit: nil - t.string "wayback", limit: nil - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "routes", ["objectid"], :name => "routes_objectid_key", :unique => true - - create_table "routing_constraint_zones", force: true do |t| - t.string "name", limit: nil - t.integer "stop_area_ids", array: true - t.datetime "created_at" - t.datetime "updated_at" - t.string "objectid", limit: nil, null: false - t.integer "object_version", limit: 8 - t.string "creator_id", limit: nil - t.integer "route_id", limit: 8 - end - - create_table "routing_constraints_lines", id: false, force: true do |t| - t.integer "stop_area_id", limit: 8 - t.integer "line_id", limit: 8 - end - - create_table "rule_parameter_sets", force: true do |t| - t.text "parameters" - t.string "name", limit: nil - t.datetime "created_at" - t.datetime "updated_at" - t.integer "organisation_id", limit: 8 - end - - create_table "stop_area_referential_memberships", force: true do |t| - t.integer "organisation_id", limit: 8 - t.integer "stop_area_referential_id", limit: 8 - t.boolean "owner" - end - - create_table "stop_area_referential_sync_messages", force: true do |t| - t.integer "criticity" - t.string "message_key", limit: nil - t.hstore "message_attributs" - t.integer "stop_area_referential_sync_id", limit: 8 - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "stop_area_referential_sync_messages", ["stop_area_referential_sync_id"], :name => "stop_area_referential_sync_id" - - create_table "stop_area_referential_syncs", force: true do |t| - t.integer "stop_area_referential_id", limit: 8 - t.datetime "created_at" - t.datetime "updated_at" - t.datetime "ended_at" - t.datetime "started_at" - t.string "status", limit: nil - end - - add_index "stop_area_referential_syncs", ["stop_area_referential_id"], :name => "index_stop_area_referential_syncs_on_stop_area_referential_id" - - create_table "stop_area_referentials", force: true do |t| - t.string "name", limit: nil - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "stop_areas", force: true do |t| - t.integer "parent_id", limit: 8 - t.string "objectid", limit: nil, null: false - t.integer "object_version", limit: 8 - t.string "creator_id", limit: nil - t.string "name", limit: nil - t.string "comment", limit: nil - t.string "area_type", limit: nil - t.string "registration_number", limit: nil - t.string "nearest_topic_name", limit: nil - t.integer "fare_code" - t.decimal "longitude", precision: 19, scale: 16 - t.decimal "latitude", precision: 19, scale: 16 - t.string "long_lat_type", limit: nil - t.string "country_code", limit: nil - t.string "street_name", limit: nil - t.boolean "mobility_restricted_suitability" - t.boolean "stairs_availability" - t.boolean "lift_availability" - t.integer "int_user_needs" - t.string "zip_code", limit: nil - t.string "city_name", limit: nil - t.string "url", limit: nil - t.string "time_zone", limit: nil - t.integer "stop_area_referential_id", limit: 8 - t.string "status", limit: nil - t.text "import_xml" - t.datetime "deleted_at" - t.datetime "created_at" - t.datetime "updated_at" - t.string "stif_type", limit: nil - end - - add_index "stop_areas", ["name"], :name => "index_stop_areas_on_name" - add_index "stop_areas", ["objectid"], :name => "stop_areas_objectid_key", :unique => true - add_index "stop_areas", ["parent_id"], :name => "index_stop_areas_on_parent_id" - add_index "stop_areas", ["stop_area_referential_id"], :name => "index_stop_areas_on_stop_area_referential_id" - - create_table "stop_areas_stop_areas", id: false, force: true do |t| - t.integer "child_id", limit: 8 - t.integer "parent_id", limit: 8 - end - - create_table "stop_points", force: true do |t| - t.integer "route_id", limit: 8 - t.integer "stop_area_id", limit: 8 - t.string "objectid", limit: nil, null: false - t.integer "object_version", limit: 8 - t.string "creator_id", limit: nil - t.integer "position" - t.string "for_boarding", limit: nil - t.string "for_alighting", limit: nil - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "stop_points", ["objectid"], :name => "stop_points_objectid_key", :unique => true - - create_table "taggings", force: true do |t| - t.integer "tag_id", limit: 8 - t.integer "taggable_id", limit: 8 - t.string "taggable_type", limit: nil - t.integer "tagger_id", limit: 8 - t.string "tagger_type", limit: nil - t.string "context", limit: 128 - t.datetime "created_at" - end - - add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], :name => "taggings_idx", :unique => true - add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context" - - create_table "tags", force: true do |t| - t.string "name", limit: nil - t.integer "taggings_count", default: 0 - end - - add_index "tags", ["name"], :name => "index_tags_on_name", :unique => true - - create_table "time_table_dates", force: true do |t| - t.integer "time_table_id", limit: 8, null: false - t.date "date" - t.integer "position", null: false - t.boolean "in_out" - end - - add_index "time_table_dates", ["time_table_id"], :name => "index_time_table_dates_on_time_table_id" - - create_table "time_table_periods", force: true do |t| - t.integer "time_table_id", limit: 8, null: false - t.date "period_start" - t.date "period_end" - t.integer "position", null: false - end - - add_index "time_table_periods", ["time_table_id"], :name => "index_time_table_periods_on_time_table_id" - - create_table "time_tables", force: true do |t| - t.string "objectid", limit: nil, null: false - t.integer "object_version", limit: 8, default: 1 - t.string "creator_id", limit: nil - t.string "version", limit: nil - t.string "comment", limit: nil - t.integer "int_day_types", default: 0 - t.date "start_date" - t.date "end_date" - t.integer "calendar_id", limit: 8 - t.datetime "created_at" - t.datetime "updated_at" - t.string "color" - end - - add_index "time_tables", ["calendar_id"], :name => "index_time_tables_on_calendar_id" - add_index "time_tables", ["objectid"], :name => "time_tables_objectid_key", :unique => true - - create_table "time_tables_vehicle_journeys", id: false, force: true do |t| - t.integer "time_table_id", limit: 8 - t.integer "vehicle_journey_id", limit: 8 - end - - add_index "time_tables_vehicle_journeys", ["time_table_id"], :name => "index_time_tables_vehicle_journeys_on_time_table_id" - add_index "time_tables_vehicle_journeys", ["vehicle_journey_id"], :name => "index_time_tables_vehicle_journeys_on_vehicle_journey_id" - - create_table "timebands", force: true do |t| - t.string "objectid", limit: nil, null: false - t.integer "object_version", limit: 8 - t.string "creator_id", limit: nil - t.string "name", limit: nil - t.time "start_time", null: false - t.time "end_time", null: false - t.datetime "created_at" - t.datetime "updated_at" - end - - create_table "users", force: true do |t| - t.string "email", limit: nil, default: "", null: false - t.string "encrypted_password", limit: nil, default: "" - t.string "reset_password_token", limit: nil - t.datetime "reset_password_sent_at" - t.datetime "remember_created_at" - t.integer "sign_in_count", default: 0 - t.datetime "current_sign_in_at" - t.datetime "last_sign_in_at" - t.string "current_sign_in_ip", limit: nil - t.string "last_sign_in_ip", limit: nil - t.datetime "created_at" - t.datetime "updated_at" - t.integer "organisation_id", limit: 8 - t.string "name", limit: nil - t.string "confirmation_token", limit: nil - t.datetime "confirmed_at" - t.datetime "confirmation_sent_at" - t.string "unconfirmed_email", limit: nil - t.integer "failed_attempts", default: 0 - t.string "unlock_token", limit: nil - t.datetime "locked_at" - t.string "authentication_token", limit: nil - t.string "invitation_token", limit: nil - t.datetime "invitation_sent_at" - t.datetime "invitation_accepted_at" - t.integer "invitation_limit" - t.integer "invited_by_id", limit: 8 - t.string "invited_by_type", limit: nil - t.datetime "invitation_created_at" - t.string "username", limit: nil - t.datetime "synced_at" - t.string "permissions", limit: nil, array: true - end - - add_index "users", ["email"], :name => "index_users_on_email", :unique => true - add_index "users", ["invitation_token"], :name => "index_users_on_invitation_token", :unique => true - add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true - add_index "users", ["username"], :name => "index_users_on_username", :unique => true - - create_table "vehicle_journey_at_stops", force: true do |t| - t.integer "vehicle_journey_id", limit: 8 - t.integer "stop_point_id", limit: 8 - t.string "connecting_service_id", limit: nil - t.string "boarding_alighting_possibility", limit: nil - t.time "arrival_time" - t.time "departure_time" - t.string "for_boarding", limit: nil - t.string "for_alighting", limit: nil - t.integer "departure_day_offset" - t.integer "arrival_day_offset" - end - - add_index "vehicle_journey_at_stops", ["stop_point_id"], :name => "index_vehicle_journey_at_stops_on_stop_pointid" - add_index "vehicle_journey_at_stops", ["vehicle_journey_id"], :name => "index_vehicle_journey_at_stops_on_vehicle_journey_id" - - create_table "vehicle_journeys", force: true do |t| - t.integer "route_id", limit: 8 - t.integer "journey_pattern_id", limit: 8 - t.integer "company_id", limit: 8 - t.string "objectid", limit: nil, null: false - t.integer "object_version", limit: 8 - t.string "creator_id", limit: nil - t.string "comment", limit: nil - t.string "status_value", limit: nil - t.string "transport_mode", limit: nil - t.string "published_journey_name", limit: nil - t.string "published_journey_identifier", limit: nil - t.string "facility", limit: nil - t.string "vehicle_type_identifier", limit: nil - t.integer "number", limit: 8 - t.boolean "mobility_restricted_suitability" - t.boolean "flexible_service" - t.integer "journey_category", default: 0, null: false - t.datetime "created_at" - t.datetime "updated_at" - end - - add_index "vehicle_journeys", ["objectid"], :name => "vehicle_journeys_objectid_key", :unique => true - add_index "vehicle_journeys", ["route_id"], :name => "index_vehicle_journeys_on_route_id" - - create_table "workbenches", force: true do |t| - t.string "name", limit: nil - t.integer "organisation_id", limit: 8 - t.datetime "created_at" - t.datetime "updated_at" - t.integer "line_referential_id", limit: 8 - t.integer "stop_area_referential_id", limit: 8 - end - - add_index "workbenches", ["line_referential_id"], :name => "index_workbenches_on_line_referential_id" - add_index "workbenches", ["organisation_id"], :name => "index_workbenches_on_organisation_id" - add_index "workbenches", ["stop_area_referential_id"], :name => "index_workbenches_on_stop_area_referential_id" - - Foreigner.load - add_foreign_key "access_links", "access_points", name: "aclk_acpt_fkey" - - add_foreign_key "group_of_lines_lines", "group_of_lines", name: "groupofline_group_fkey", dependent: :delete - - add_foreign_key "journey_frequencies", "timebands", name: "fk_rails_60bb6f7bd3", dependent: :nullify - add_foreign_key "journey_frequencies", "vehicle_journeys", name: "fk_rails_d322c5d659", dependent: :nullify - - add_foreign_key "journey_pattern_sections", "journey_patterns", name: "fk_rails_73ae46b20f", dependent: :delete - add_foreign_key "journey_pattern_sections", "route_sections", name: "fk_rails_0dbc726f14", dependent: :delete - - add_foreign_key "journey_patterns", "routes", name: "jp_route_fkey", dependent: :delete - add_foreign_key "journey_patterns", "stop_points", name: "arrival_point_fkey", column: "arrival_stop_point_id", dependent: :nullify - add_foreign_key "journey_patterns", "stop_points", name: "departure_point_fkey", column: "departure_stop_point_id", dependent: :nullify - - add_foreign_key "journey_patterns_stop_points", "journey_patterns", name: "jpsp_jp_fkey", dependent: :delete - add_foreign_key "journey_patterns_stop_points", "stop_points", name: "jpsp_stoppoint_fkey", dependent: :delete - - add_foreign_key "route_sections", "stop_areas", name: "fk_rails_97b8dcfe1a", column: "departure_id" - add_foreign_key "route_sections", "stop_areas", name: "fk_rails_df1612606f", column: "arrival_id" - - add_foreign_key "routes", "routes", name: "route_opposite_route_fkey", column: "opposite_route_id" - - add_foreign_key "stop_areas", "stop_areas", name: "area_parent_fkey", column: "parent_id", dependent: :nullify - - add_foreign_key "stop_areas_stop_areas", "stop_areas", name: "stoparea_child_fkey", column: "child_id", dependent: :delete - add_foreign_key "stop_areas_stop_areas", "stop_areas", name: "stoparea_parent_fkey", column: "parent_id", dependent: :delete - - add_foreign_key "stop_points", "routes", name: "stoppoint_route_fkey", dependent: :delete - - add_foreign_key "time_table_dates", "time_tables", name: "tm_date_fkey", dependent: :delete - - add_foreign_key "time_table_periods", "time_tables", name: "tm_period_fkey", dependent: :delete - - add_foreign_key "time_tables_vehicle_journeys", "time_tables", name: "vjtm_tm_fkey", dependent: :delete - add_foreign_key "time_tables_vehicle_journeys", "vehicle_journeys", name: "vjtm_vj_fkey", dependent: :delete - - add_foreign_key "vehicle_journey_at_stops", "stop_points", name: "vjas_sp_fkey", dependent: :delete - add_foreign_key "vehicle_journey_at_stops", "vehicle_journeys", name: "vjas_vj_fkey", dependent: :delete - - add_foreign_key "vehicle_journeys", "journey_patterns", name: "vj_jp_fkey", dependent: :delete - add_foreign_key "vehicle_journeys", "routes", name: "vj_route_fkey", dependent: :delete - -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/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/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/support/type_ids_modelable.rb b/spec/support/type_ids_modelable.rb new file mode 100644 index 000000000..9ed341810 --- /dev/null +++ b/spec/support/type_ids_modelable.rb @@ -0,0 +1,100 @@ +require 'spec_helper' + +shared_examples_for TypeIdsModelable do + context 'class methods' do + it 'should be a TypeIdsModelable class' do + expect(described_class.type_ids_modelable_class?).to be_truthy + end + describe ".references_relation" do + it "shoud demodulize, underscore and puralize" do + expect(described_class.references_relation( Chouette::StopArea)).to eq("stop_areas") + end + end + end + + context 'with an instance' do + describe "#references" do + it "should be empty if references_type is nil" do + type_ids_model.references_type = nil + expect(type_ids_model.references).to be_empty + end + it "should be empty if reference_ids is blank" do + type_ids_model.reference_ids = "" + expect(type_ids_model.references).to be_empty + end + end + describe "#references=" do + let(:lines) { create_list :line, 3 } + + context "when references defined" do + before(:each) do + type_ids_model.references = lines + end + it "should set reference_ids to [data_a.id]" do + expect(type_ids_model.reference_ids).to eq(lines.map(&:id)) + end + it "should set references_type to EffectiveDataTypeA" do + expect(type_ids_model.references_type).to eq('Chouette::Line') + end + end + context "when references blank" do + before(:each) do + type_ids_model.references = "" + end + it "should set reference_ids to []" do + expect(type_ids_model.reference_ids).to eq([]) + end + it "should set references_type to nil" do + expect(type_ids_model.references_type).to be_nil + end + end + end + + describe "#references_relation" do + it "should be 'lines' when relation_type is 'Chouette::Line'" do + type_ids_model.references_type = "Chouette::Line" + expect(type_ids_model.references_relation).to eq("lines") + end + + it "should be 'networks' when relation_type is 'Chouette::Network'" do + type_ids_model.references_type = "Chouette::Network" + expect(type_ids_model.references_relation).to eq("networks") + end + + it "should be nil when relation_type is blank" do + type_ids_model.references_type = "" + expect(type_ids_model.references_relation).to be_nil + end + + it "should be nil when relation_type is 'dummy'" do + type_ids_model.references_type = "dummy" + expect(type_ids_model.references_relation).to be_nil + end + end + + describe "#reference_ids" do + it "should parse raw_reference_ids and returns ids" do + allow(type_ids_model).to receive_messages :raw_reference_ids => "1,2,3" + expect(type_ids_model.reference_ids).to eq([1,2,3]) + end + + it "should be empty if raw_reference_ids is blank" do + allow(type_ids_model).to receive_messages :raw_reference_ids => "" + expect(type_ids_model.reference_ids).to be_empty + end + end + + describe "#reference_ids=" do + it "should join ids with comma" do + type_ids_model.reference_ids = [1,2,3] + expect(type_ids_model.raw_reference_ids).to eq("1,2,3") + end + it "should be nil if records is blank" do + type_ids_model.reference_ids = [] + expect(type_ids_model.raw_reference_ids).to be_nil + end + end + end + + +end diff --git a/spec/support/type_ids_modelable_spec.rb b/spec/support/type_ids_modelable_spec.rb deleted file mode 100644 index 9ed341810..000000000 --- a/spec/support/type_ids_modelable_spec.rb +++ /dev/null @@ -1,100 +0,0 @@ -require 'spec_helper' - -shared_examples_for TypeIdsModelable do - context 'class methods' do - it 'should be a TypeIdsModelable class' do - expect(described_class.type_ids_modelable_class?).to be_truthy - end - describe ".references_relation" do - it "shoud demodulize, underscore and puralize" do - expect(described_class.references_relation( Chouette::StopArea)).to eq("stop_areas") - end - end - end - - context 'with an instance' do - describe "#references" do - it "should be empty if references_type is nil" do - type_ids_model.references_type = nil - expect(type_ids_model.references).to be_empty - end - it "should be empty if reference_ids is blank" do - type_ids_model.reference_ids = "" - expect(type_ids_model.references).to be_empty - end - end - describe "#references=" do - let(:lines) { create_list :line, 3 } - - context "when references defined" do - before(:each) do - type_ids_model.references = lines - end - it "should set reference_ids to [data_a.id]" do - expect(type_ids_model.reference_ids).to eq(lines.map(&:id)) - end - it "should set references_type to EffectiveDataTypeA" do - expect(type_ids_model.references_type).to eq('Chouette::Line') - end - end - context "when references blank" do - before(:each) do - type_ids_model.references = "" - end - it "should set reference_ids to []" do - expect(type_ids_model.reference_ids).to eq([]) - end - it "should set references_type to nil" do - expect(type_ids_model.references_type).to be_nil - end - end - end - - describe "#references_relation" do - it "should be 'lines' when relation_type is 'Chouette::Line'" do - type_ids_model.references_type = "Chouette::Line" - expect(type_ids_model.references_relation).to eq("lines") - end - - it "should be 'networks' when relation_type is 'Chouette::Network'" do - type_ids_model.references_type = "Chouette::Network" - expect(type_ids_model.references_relation).to eq("networks") - end - - it "should be nil when relation_type is blank" do - type_ids_model.references_type = "" - expect(type_ids_model.references_relation).to be_nil - end - - it "should be nil when relation_type is 'dummy'" do - type_ids_model.references_type = "dummy" - expect(type_ids_model.references_relation).to be_nil - end - end - - describe "#reference_ids" do - it "should parse raw_reference_ids and returns ids" do - allow(type_ids_model).to receive_messages :raw_reference_ids => "1,2,3" - expect(type_ids_model.reference_ids).to eq([1,2,3]) - end - - it "should be empty if raw_reference_ids is blank" do - allow(type_ids_model).to receive_messages :raw_reference_ids => "" - expect(type_ids_model.reference_ids).to be_empty - end - end - - describe "#reference_ids=" do - it "should join ids with comma" do - type_ids_model.reference_ids = [1,2,3] - expect(type_ids_model.raw_reference_ids).to eq("1,2,3") - end - it "should be nil if records is blank" do - type_ids_model.reference_ids = [] - expect(type_ids_model.raw_reference_ids).to be_nil - end - end - end - - -end 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 -- cgit v1.2.3