diff options
| author | Marc Florisson | 2012-06-06 18:34:48 +0200 |
|---|---|---|
| committer | Marc Florisson | 2012-06-06 18:34:48 +0200 |
| commit | bfcaec8ebed6cc7cfeb1ab64a48d9182a5c3e567 (patch) | |
| tree | 8a3cbe9f7694c236729feac6c1563e37b33b2efa | |
| parent | 0d86b44384c89c593773f9236eed76b623c1a557 (diff) | |
| parent | aa00d31ffe2ec040504b6699213fe60763563fda (diff) | |
| download | chouette-core-bfcaec8ebed6cc7cfeb1ab64a48d9182a5c3e567.tar.bz2 | |
Merge branch 'master' into journey_pattern
40 files changed, 301 insertions, 56 deletions
diff --git a/Gemfile.lock b/Gemfile.lock index 4a2e405e8..854660c94 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://chouette.dryade.priv/ninoxe - revision: 309a0bbec119e9ec57acb6cefa5b2b913278cd3b + revision: 1b68352e83c2ef898fdab7cd4c4eeddba6a977d5 specs: ninoxe (0.0.8) GeoRuby @@ -190,7 +190,6 @@ GEM jruby-rack (1.1.5) jruby-rack-worker (0.3-java) jruby-rack (>= 1.0.1) - json (1.7.3) json (1.7.3-java) json_pure (1.7.3) launchy (2.1.0) @@ -207,7 +206,7 @@ GEM treetop (~> 1.4.8) map_layers (0.0.5) mime-types (1.18) - multi_json (1.3.5) + multi_json (1.3.6) net-scp (1.0.4) net-ssh (>= 1.99.1) net-sftp (2.0.5) diff --git a/app/assets/stylesheets/layout.css.scss b/app/assets/stylesheets/layout.css.scss index b9a715465..e93ec699c 100644 --- a/app/assets/stylesheets/layout.css.scss +++ b/app/assets/stylesheets/layout.css.scss @@ -7,6 +7,15 @@ $text_color: #222; @import "user_interface/layout"; +#header .infos div.title h1 { + border: 1px solid white; + font-size: 30px; + margin: 20px 0 0 100px; + padding: 3px 15px 3px 15px; + font-weight: bold; +} + + #sidebar ul { padding: 0 8px; diff --git a/app/maps/connection_link_map.rb b/app/maps/connection_link_map.rb index a6fb8517c..897da8a5d 100644 --- a/app/maps/connection_link_map.rb +++ b/app/maps/connection_link_map.rb @@ -17,8 +17,11 @@ class ConnectionLinkMap < ApplicationMap page << map.add_layer(google_hybrid) page << map.add_layer(google_satellite) + page.assign "stop_areas_layer", kml_layer(polymorphic_path([referential, connection_link, :stop_areas], :format => :kml), :styleMap => StyleMap::StopAreasStyleMap.new.style_map) + page << map.add_layer(:stop_areas_layer) + page << map.add_control( hover_control_display_name(:stop_areas_layer) ) #page << map.add_layer(kml_layer(connection_link, :styleMap => StyleMap::ConnectionLinkStyleMap.new( :style => connection_link_style).style_map)) - page << map.add_layer(kml_layer(polymorphic_path([referential, connection_link, :stop_areas], :format => :kml), :styleMap => StyleMap::StopAreasStyleMap.new.style_map)) + #page << map.add_layer(kml_layer(polymorphic_path([referential, connection_link, :stop_areas], :format => :kml), :styleMap => StyleMap::StopAreasStyleMap.new.style_map)) page << map.zoom_to_extent(bounds) if bounds end end diff --git a/app/models/import.rb b/app/models/import.rb index 64b5b5624..b08f8e8f3 100644 --- a/app/models/import.rb +++ b/app/models/import.rb @@ -11,6 +11,14 @@ class Import < ActiveRecord::Base has_many :log_messages, :class_name => "ImportLogMessage", :order => :position, :dependent => :destroy + serialize :options + + after_initialize :define_options + + def define_options + self.options = {} + end + def loader @loader ||= ::Chouette::Loader.new(referential.slug) end @@ -55,6 +63,10 @@ class Import < ActiveRecord::Base "#{Import.model_name.humanize} #{id}" end + def import_options + {} + end + def import begin log_messages.create :key => :started @@ -64,7 +76,7 @@ class Import < ActiveRecord::Base loader.import file end else - loader.import saved_resources + loader.import saved_resources, import_options end update_attribute :status, "completed" rescue => e diff --git a/app/models/neptune_import.rb b/app/models/neptune_import.rb new file mode 100644 index 000000000..f00947129 --- /dev/null +++ b/app/models/neptune_import.rb @@ -0,0 +1,7 @@ +class NeptuneImport < Import + + def import_options + { :format => :neptune } + end + +end diff --git a/app/models/referential.rb b/app/models/referential.rb index d7c5bba7e..2d6d5b8d5 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -1,9 +1,19 @@ class Referential < ActiveRecord::Base validates_presence_of :name validates_presence_of :slug + validates_presence_of :prefix + validates_presence_of :time_zone + validates_uniqueness_of :slug + validates_uniqueness_of :name + validates_format_of :slug, :with => %r{\A[0-9a-z_]+\Z} + validates_format_of :prefix, :with => %r{\A[0-9a-zA-Z_]+\Z} has_many :imports, :dependent => :destroy + def human_attribute_name(*args) + self.class.human_attribute_name(*args) + end + def lines Chouette::Line.scoped end diff --git a/app/views/connection_links/select_areas.html.erb b/app/views/connection_links/select_areas.html.erb index 0c46395d7..2df3831b4 100644 --- a/app/views/connection_links/select_areas.html.erb +++ b/app/views/connection_links/select_areas.html.erb @@ -9,7 +9,8 @@ <%= form.buttons do %> <%= form.commit_button %> - ou <%= link_to "revenir", [@referential, @connection_link] %> + <%= t('or') %> + <%= link_to t('cancel'), [@referential, @connection_link] %> <% end %> </div> <% end %> diff --git a/app/views/help/dataspaces.textile b/app/views/help/dataspaces.textile index 68e88173b..51c32e59d 100644 --- a/app/views/help/dataspaces.textile +++ b/app/views/help/dataspaces.textile @@ -13,6 +13,7 @@ h3. Attributs - Code := code de l'espace de données - Préfixe Neptune := préfixe utilisé par défaut pour la génération des identifiants Neptune - Projection géographique := référentiel de projection des coordonnées cartographiques en complément du WGS84 +- Fuseau horaire := fuseau horaire applicable pour les horaires des courses. (cf "Tz_database":http://fr.wikipedia.org/wiki/Tz_database) h3. Implémentation diff --git a/app/views/help/documentation.textile b/app/views/help/documentation.textile new file mode 100644 index 000000000..2b3d1ff93 --- /dev/null +++ b/app/views/help/documentation.textile @@ -0,0 +1,6 @@ +--- +layout: default +title: Documentation +--- + +La documentation de Chouette est disponible sur le site "Chouette.mobi":http://www.chouette.mobi/spip.php?rubrique15
\ No newline at end of file diff --git a/app/views/help/index.textile b/app/views/help/index.textile index d776a8d8d..bea9502ec 100644 --- a/app/views/help/index.textile +++ b/app/views/help/index.textile @@ -3,7 +3,7 @@ layout: default title: Présentation --- -Chouette v2 : itération 6 du 22/05/2012 +Chouette v2 : itération 7 du 04/06/2012 Cette itération présente les formulaires de : @@ -11,6 +11,7 @@ Cette itération présente les formulaires de : * transporteurs * lignes ** séquences d'arrêts +** missions * arrêts * calendriers d'application * correspondances @@ -20,12 +21,16 @@ l'avancement actuel permet de : * créer, modifier et supprimer les objets * consulter les cartes +** les noms des arrêts sont affiché sous forme de bulle d'aide sur les cartes du réseau, des lignes et des correspondances * déplacer un arrêt depuis la carte (voir mode opératoire dans l'aide des arrêts) * associer les arrêts à leurs parents * ajouter des fils à un arrêt * importer des lignes au format Neptune (fichier ZIP uniquement) * éditer des séquences d'arrêts : ** ajouter, déplacer et retirer des arrêts dans la séquence +** ajouter, modifier les missions de la séquence +* préciser des paramètres généraux de l'espace de données + les actions suivantes ne sont pas encore disponible : @@ -33,5 +38,7 @@ les actions suivantes ne sont pas encore disponible : * associer une ITL à une ligne * imports à d'autres formats que Neptune * exports de données -* consulter les missions et les horaires des lignes +* définir l'emprise générale du réseau +* gérer le second référentiel de projection +* consulter/créer/éditer les courses et les horaires diff --git a/app/views/help/journeypatterns.textile b/app/views/help/journeypatterns.textile new file mode 100644 index 000000000..727e3772b --- /dev/null +++ b/app/views/help/journeypatterns.textile @@ -0,0 +1,35 @@ +--- +layout: default +title: Missions +--- + +h3. Définition + +Si on considère la suite ordonnée des arrêts d'une séquence d'arrêts, la mission se définit comme une suite extraite. Autrement dit, toutes les courses d'une séquence d'arrêts qui desservent les mêmes arrêts et dans le même ordre, à des horaires différents éventuellement, référencent la même mission. La mission correspond donc à une suite ordonnée d'arrêts de la séquence d'arrêts. + +h3. Attributs + +- Nom := nom de la mission +- Nom public := nom public pour les voyageurs +- Numéro d'enregistrement := Le numéro d'enregistrement est unique. Aucune règle de nommage ne s'applique sur ce numéro. Celui-ci doit être unique sur l'ensemble des missions de la ligne. +- Commentaire := zone de texte libre + +p(attr_data). Données de gestion : + +- Identifiant Neptune := +clé unique pérenne identifiant la mission pour les échanges Neptune +cet identifiant est composé de 3 parties : préfixe:type:id_technique +* préfixe : clé identifiant un producteur de données unique +* type = JourneyPattern : clé identifiant le type d'objet (valeur imposée) +* id_technique : valeur identifiant un seul object d'un type donné pour un même producteur +ce champ obligatoire est automatiquement généré s'il n'est pas renseigné +il est possible aussi de ne renseigner que l'identifiant technique auquel cas la valeur sera complétée automatiquement. +=: +- Date de création := date à laquelle l'objet a été créé ou modifié pour la dernière fois +- Version := version de l'objet (auto incrémenté à chaque modification) +- Créé par := compte utilisateur ayant procédé à la dernière modification + +h3. Implémentation + +p. TODO + diff --git a/app/views/help/routes.textile b/app/views/help/routes.textile index 30234c492..e34ccc162 100644 --- a/app/views/help/routes.textile +++ b/app/views/help/routes.textile @@ -13,7 +13,7 @@ h3. Attributs - Nom public := nom public pour les voyageurs - Commentaire := zone de texte libre sur le réseau - Direction := orientation principale (points cardinaux, circulaire ou aller/retour) -- Indoce := numéro de la séquence d'arrêts +- Indice := numéro de la séquence d'arrêts - Sens := aller ou retour - Itinéraire associé en sens opposé := référence de l'itinéraire de sens opposé associé diff --git a/app/views/help/toc.textile b/app/views/help/toc.textile index e3ed1ba6f..1ce35cac2 100644 --- a/app/views/help/toc.textile +++ b/app/views/help/toc.textile @@ -7,12 +7,14 @@ h3. Sommaire # "Généralités":introduction ## "Normalisation":normalisation +## "Documentation":documentation # "Espaces de données":dataspaces # "Réseaux":networks # "Transporteurs":companies # "Lignes":lines ## "Séquences d'arrêts":routes -## Horaires +## "Missions":journeypatterns +## "Courses/Horaires":vehiclejourneys # "Arrêts":stop_areas ## "Correspondances":connection_links ## Accès @@ -20,6 +22,7 @@ h3. Sommaire # "Calendriers d'application":timetables # Outils ## Imports +## Exports ## Validation # Divers ## "API Rest":restapis diff --git a/app/views/help/vehiclejourneys.textile b/app/views/help/vehiclejourneys.textile new file mode 100644 index 000000000..84547ebe7 --- /dev/null +++ b/app/views/help/vehiclejourneys.textile @@ -0,0 +1,37 @@ +--- +layout: default +title: Courses +--- + +h3. Définition + +Une course décrit le déplacement d'un véhicule de transport public sur une séquence d'arrêts de la ligne. La course parcourt les arrêts de la séquence d'arrêts dans l'ordre, sans nécessairement s'arrêter à chacun des arrêts. A chaque arrêt desservi, la course précise l'horaire de passage. +De plus, la course est rattachée à un nombre variable de calendriers d'application. + +h3. Attributs + +- Nom := nom de la course +- Nom public := nom public pour les voyageurs +- Commentaire := zone de texte libre +- Mode de transport := mode de transport pour la course; par défaut, c'est le mode de transport de la ligne qui est appliqué +- Particularité := champs libre pouvant préciser des modes de fonctionnement (TAD par exemple) + +p(attr_data). Données de gestion : + +- Identifiant Neptune := +clé unique pérenne identifiant la course pour les échanges Neptune +cet identifiant est composé de 3 parties : préfixe:type:id_technique +* préfixe : clé identifiant un producteur de données unique +* type = VehicleJourney : clé identifiant le type d'objet (valeur imposée) +* id_technique : valeur identifiant un seul object d'un type donné pour un même producteur +ce champ obligatoire est automatiquement généré s'il n'est pas renseigné +il est possible aussi de ne renseigner que l'identifiant technique auquel cas la valeur sera complétée automatiquement. +=: +- Date de création := date à laquelle l'objet a été créé ou modifié pour la dernière fois +- Version := version de l'objet (auto incrémenté à chaque modification) +- Créé par := compte utilisateur ayant procédé à la dernière modification + +h3. Implémentation + +p. TODO + diff --git a/app/views/imports/new.html.erb b/app/views/imports/new.html.erb index 0d1c54202..02ad61ede 100644 --- a/app/views/imports/new.html.erb +++ b/app/views/imports/new.html.erb @@ -8,6 +8,6 @@ <%= form.buttons do %> <%= form.commit_button true %> <li><%= t('or') %></li> - <li><%= link_to t('back'), :back %></li> + <li><%= link_to t('cancel'), :back %></li> <% end %> <% end %> diff --git a/app/views/journey_patterns/_form.html.erb b/app/views/journey_patterns/_form.html.erb index ef2bcc9d2..b6c37ab1b 100644 --- a/app/views/journey_patterns/_form.html.erb +++ b/app/views/journey_patterns/_form.html.erb @@ -4,8 +4,8 @@ <%= form.input :published_name %> <%= form.input :registration_number %> <%= form.input :comment %> - <%= form.input :stop_point_ids, :as => :check_boxes, :collection => @route.stop_points.map { |s| [s.stop_area.name, s.id.to_s]} %> - <% if @route.new_record? %> + <%= form.input :stop_point_ids, :as => :check_boxes, :collection => @route.stop_points.map { |s| [s.stop_area.name, s.id.to_s]}, :input_html => (@journey_pattern.new_record? ? { :checked => 'checked' }:{}) %> + <% if @journey_pattern.new_record? %> <%= form.input :objectid %> <% else %> <li> diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 110594cb5..4eb3b1b70 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -22,7 +22,7 @@ <% if selected_referential? %> <h1><%= @referential.name %></h1> <% elsif help_page? %> - <h1>Documentation</h1> + <h1>Guide d'utilisation</h1> <% end %> </div> <div class="interaction"> diff --git a/app/views/referentials/_form.erb b/app/views/referentials/_form.erb index 34d515c4a..c82649909 100644 --- a/app/views/referentials/_form.erb +++ b/app/views/referentials/_form.erb @@ -1,7 +1,17 @@ <%= semantic_form_for @referential do |form| %> <%= form.inputs do %> <%= form.input :name %> - <%= form.input :slug%> + <% if @referential.new_record? %> + <%= form.input :slug%> + <% else %> + <li> + <label><%= @referential.human_attribute_name("slug") %></label> + <%= @referential.slug %> + </li> + <% end %> + <%= form.input :prefix%> + <%= form.input :projection_type%> + <%= form.input :time_zone%> <% if @referential.new_record? %> <%= form.input :resources, :as => :file %> diff --git a/app/views/referentials/show.html.erb b/app/views/referentials/show.html.erb index 146e19a67..e72c0ad06 100644 --- a/app/views/referentials/show.html.erb +++ b/app/views/referentials/show.html.erb @@ -5,11 +5,24 @@ <label><%= Referential.human_attribute_name("slug") %>: </label> <%= @referential.slug %> </p> + <p> + <label><%= Referential.human_attribute_name("prefix") %>: </label> + <%= @referential.prefix %> + </p> + <p> + <label><%= Referential.human_attribute_name("projection_type") %>: </label> + <%= @referential.projection_type %> + </p> + <p> + <label><%= Referential.human_attribute_name("time_zone") %>: </label> + <%= @referential.time_zone %> + </p> </div> <% content_for :sidebar do %> <ul class="actions"> - <li><%= link_to t('referentials.actions.destroy'), referential_path(@referential), :method => :delete, :confirm => t('referentials.actions.destroy_confirm'), :class => "remove" %></li> + <li><%= link_to t('referentials.actions.edit'), edit_referential_path(@referential), :class => "edit" %></li> + <li><%= link_to t('referentials.actions.destroy'), referential_path(@referential), :method => :delete, :confirm => t('referentials.actions.destroy_confirm'), :class => "remove" %></li> <br> </ul> <% end %> diff --git a/app/views/stop_areas/add_children.html.erb b/app/views/stop_areas/add_children.html.erb index a8b29146a..ff3323dab 100644 --- a/app/views/stop_areas/add_children.html.erb +++ b/app/views/stop_areas/add_children.html.erb @@ -8,7 +8,8 @@ <%= form.buttons do %> <%= form.commit_button %> - ou <%= link_to "revenir", [@referential, @stop_area] %> + <%= t('or') %> + <%= link_to t('cancel'), [@referential, @stop_area] %> <% end %> </div> <% end %> diff --git a/app/views/stop_areas/select_parent.html.erb b/app/views/stop_areas/select_parent.html.erb index bf361b869..26baf984a 100644 --- a/app/views/stop_areas/select_parent.html.erb +++ b/app/views/stop_areas/select_parent.html.erb @@ -8,7 +8,8 @@ <%= form.buttons do %> <%= form.commit_button %> - ou <%= link_to "revenir", [@referential, @stop_area] %> + <%= t('or') %> + <%= link_to t('cancel'), [@referential, @stop_area] %> <% end %> </div> <% end %> diff --git a/app/views/stop_areas/show.html.erb b/app/views/stop_areas/show.html.erb index 41d7576b5..28867de45 100644 --- a/app/views/stop_areas/show.html.erb +++ b/app/views/stop_areas/show.html.erb @@ -93,7 +93,6 @@ <%= link_to([@referential, @stop_area.parent]) do %> <%= image_tag "map/" + @stop_area.parent.stop_area_type + ".png" %><span><%= @stop_area.parent.name %></span> <% end %> - <%= link_to image_tag("user_interface/ui/remove.png"), referential_stop_area_path(@referential, @stop_area.parent), :method => :delete, :confirm => t('stop_areas.actions.destroy_confirm'), :class => "remove" %> </div> <div class="link"><%= image_tag "icons/link.png"%></div> <% else %> @@ -114,7 +113,6 @@ <%= link_to([@referential, child]) do %> <%= image_tag "map/" + child.stop_area_type + ".png" %><span><%= child.name %></span> <% end %> - <%= link_to image_tag("user_interface/ui/remove.png"), referential_stop_area_path(@referential, child), :method => :delete, :confirm => t('stop_areas.actions.destroy_confirm'), :class => "remove" %> </div> <% end %> </div> diff --git a/config/locales/referentials.yml b/config/locales/referentials.yml index dc0a160ed..7aa60fc1d 100644 --- a/config/locales/referentials.yml +++ b/config/locales/referentials.yml @@ -19,6 +19,14 @@ en: referential: name: Name slug: Code + prefix: Neptune Object Id prefix + projection_type: Alternate projection code (SRID) + time_zone: time zone + formtastic: + hints: + referential: + slug: only lowercase alphanumerical or underscore characters + prefix: only alphanumerical or underscore characters fr: referentials: @@ -41,3 +49,11 @@ fr: referential: name: Nom slug: Code + prefix: Préfixe des identifiants Neptune + projection_type: Code (SRID) de la seconde projection + time_zone: Fuseau horaire + formtastic: + hints: + referential: + slug: "caractères autorisés : alphanumériques minuscules et 'souligné'" + prefix: "caractères autorisés : alphanumériques et 'souligné'" diff --git a/config/locales/stop_areas.yml b/config/locales/stop_areas.yml index 1029e7e21..d6050cc79 100644 --- a/config/locales/stop_areas.yml +++ b/config/locales/stop_areas.yml @@ -8,8 +8,8 @@ en: edit: Edit this stop destroy: Remove this stop destroy_confirm: Are you sure you want destroy this stop? - select_parent: Select Parent - add_children: Add Children + select_parent: Manage Parent + add_children: Manage Children new: title: Add a new stop edit: @@ -26,9 +26,9 @@ en: selection_all: All area_type: Area Type select_parent: - title: Select parent of stop area %{stop_area} + title: Manage parent of stop area %{stop_area} add_children: - title: Add children of stop area %{stop_area} + title: Manage children of stop area %{stop_area} activerecord: models: stop_area: @@ -73,8 +73,8 @@ fr: edit: Modifier cet arrêt destroy: Supprimer cet arrêt destroy_confirm: Etes vous sûr de détruire cet arrêt ? - select_parent: Sélectionner le parent - add_children: Ajouter un fils + select_parent: Gérer le parent + add_children: Gérer les fils new: title: Ajouter un arrêt edit: @@ -91,9 +91,9 @@ fr: selection_all: Tous area_type: "Type d'arrêt" select_parent: - title: "Sélection du parent de l'arrêt %{stop_area}" + title: "Gérer le parent de l'arrêt %{stop_area}" add_children: - title: "Ajouter les enfants de l'arrêt %{stop_area}" + title: "Gérer les fils de l'arrêt %{stop_area}" activerecord: models: stop_area: @@ -121,7 +121,7 @@ fr: object_version: Version creation_time: Créé le creator_id: Créé par - children_ids: Enfants + children_ids: Fils parent: Parent formtastic: hints: diff --git a/db/migrate/20120523123806_add_fields_to_referentials.rb b/db/migrate/20120523123806_add_fields_to_referentials.rb new file mode 100644 index 000000000..3958ed106 --- /dev/null +++ b/db/migrate/20120523123806_add_fields_to_referentials.rb @@ -0,0 +1,7 @@ +class AddFieldsToReferentials < ActiveRecord::Migration + def change + add_column :referentials, :prefix, :string + add_column :referentials, :projection_type, :string + add_column :referentials, :time_zone, :string + end +end diff --git a/db/migrate/20120531070108_add_type_and_options_to_import.rb b/db/migrate/20120531070108_add_type_and_options_to_import.rb new file mode 100644 index 000000000..490427c8a --- /dev/null +++ b/db/migrate/20120531070108_add_type_and_options_to_import.rb @@ -0,0 +1,8 @@ +class AddTypeAndOptionsToImport < ActiveRecord::Migration + def change + change_table :imports do |t| + t.string :type, :options + end + Import.update_all :type => "NeptuneImport" + end +end diff --git a/db/schema.rb b/db/schema.rb index d8532b785..d4c07cdc1 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -184,6 +184,8 @@ ActiveRecord::Schema.define(:version => 20120531091529) do t.string "status" t.datetime "created_at" t.datetime "updated_at" + t.string "type" + t.string "options" end add_index "imports", ["referential_id"], :name => "index_imports_on_referential_id" @@ -269,6 +271,9 @@ ActiveRecord::Schema.define(:version => 20120531091529) do t.string "slug" t.datetime "created_at" t.datetime "updated_at" + t.string "prefix" + t.string "projection_type" + t.string "time_zone" end create_table "routes", :force => true do |t| diff --git a/spec/factories.rb b/spec/factories.rb index c5c1c0ff0..c36f1c71a 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -3,6 +3,8 @@ FactoryGirl.define do factory :referential do |f| f.sequence(:name) { |n| "Test #{n}" } f.sequence(:slug) { |n| "test_#{n}" } + f.sequence(:prefix) { |n| "test_#{n}" } + f.time_zone "Europe/Paris" end factory :user do |f| diff --git a/spec/models/import_spec.rb b/spec/models/import_spec.rb index f307b59db..f0b76c15e 100644 --- a/spec/models/import_spec.rb +++ b/spec/models/import_spec.rb @@ -34,4 +34,12 @@ describe Import do end + describe "#options" do + + it "should be empty by default" do + subject.options.should be_empty + end + + end + end diff --git a/spec/models/referential_spec.rb b/spec/models/referential_spec.rb index 363fe237f..bb6158d4f 100644 --- a/spec/models/referential_spec.rb +++ b/spec/models/referential_spec.rb @@ -4,5 +4,7 @@ describe Referential do it { should validate_presence_of(:name) } it { should validate_presence_of(:slug) } + it { should validate_presence_of(:prefix) } + it { should validate_presence_of(:time_zone) } end
\ No newline at end of file diff --git a/spec/requests/companies_spec.rb b/spec/requests/companies_spec.rb index f21662356..f0716dcd9 100644 --- a/spec/requests/companies_spec.rb +++ b/spec/requests/companies_spec.rb @@ -4,12 +4,13 @@ require 'spec_helper' describe "Companies" do login_user - let!(:referential) { create(:referential).switch } - let!(:companies) { referential; Array.new(2) { create(:company) } } + let(:referential) { create(:referential).switch } + let(:companies) { referential; Array.new(2) { create(:company) } } subject { companies.first } describe "list" do it "display companies" do + pending visit referential_companies_path(referential) page.should have_content(companies.first.name) page.should have_content(companies.last.name) @@ -19,6 +20,7 @@ describe "Companies" do describe "show" do it "display company" do + pending visit referential_companies_path(referential) click_link "#{companies.first.name}" page.should have_content(companies.first.name) @@ -28,6 +30,7 @@ describe "Companies" do describe "new" do it "creates company and return to show" do + pending visit referential_companies_path(referential) click_link "Ajouter un transporteur" fill_in "Nom", :with => "Company 1" @@ -40,6 +43,7 @@ describe "Companies" do describe "edit and return to show" do it "edit company" do + pending visit referential_company_path(referential, subject) click_link "Modifier ce transporteur" fill_in "Nom", :with => "Company Modified" diff --git a/spec/requests/connection_links_spec.rb b/spec/requests/connection_links_spec.rb index 798316aac..76d8a942c 100644 --- a/spec/requests/connection_links_spec.rb +++ b/spec/requests/connection_links_spec.rb @@ -4,12 +4,13 @@ require 'spec_helper' describe "ConnectionLinks" do login_user - let!(:referential) { create(:referential).switch } - let!(:connection_links) { referential; Array.new(2) { create(:connection_link) } } + let(:referential) { create(:referential).switch } + let(:connection_links) { referential; Array.new(2) { create(:connection_link) } } subject { connection_links.first } describe "list" do it "display connection_links" do + pending visit referential_connection_links_path(referential) page.should have_content(connection_links.first.name) page.should have_content(connection_links.last.name) @@ -19,6 +20,7 @@ describe "ConnectionLinks" do describe "show" do it "display connection_link" do + pending visit referential_connection_links_path(referential) click_link "#{connection_links.first.name}" page.should have_content(connection_links.first.name) @@ -36,6 +38,7 @@ describe "ConnectionLinks" do describe "new" do it "creates connection_link and return to show" do + pending visit referential_connection_links_path(referential) click_link "Ajouter une correspondance" fill_in "Nom", :with => "ConnectionLink 1" @@ -47,6 +50,7 @@ describe "ConnectionLinks" do describe "edit and return to show" do it "edit connection_link" do + pending visit referential_connection_link_path(referential, subject) click_link "Modifier cette correspondance" fill_in "Nom", :with => "ConnectionLink Modified" diff --git a/spec/requests/journey_pattern_spec.rb b/spec/requests/journey_pattern_spec.rb index 7c62dd56b..ce36b3002 100644 --- a/spec/requests/journey_pattern_spec.rb +++ b/spec/requests/journey_pattern_spec.rb @@ -4,19 +4,21 @@ require 'spec_helper' describe "JourneyPatterns" do login_user - let!(:referential) { create(:referential).switch } - let!(:line) { referential; Factory(:line) } - let!(:route) { referential; Factory(:route, :line => line) } - let!(:journey_pattern) { referential; Factory(:journey_pattern, :route => route) } + let(:referential) { create(:referential).switch } + let(:line) { Factory(:line) } + let(:route) { Factory(:route, :line => line) } + let(:journey_pattern) { Factory(:journey_pattern, :route => route) } describe "from routes page to a journey_pattern page" do it "display route's journey_patterns" do + pending visit referential_line_route_path(referential,line,route) page.should have_content(journey_pattern.name) end end describe "from route's page to journey_pattern's page" do it "display journey_pattern properties" do + pending visit referential_line_route_path(referential,line,route) click_link "#{journey_pattern.name}" page.should have_content(journey_pattern.published_name) @@ -26,6 +28,7 @@ describe "JourneyPatterns" do end describe "from route's page, create a new journey_pattern" do it "return to route's page that display new journey_pattern" do + pending visit referential_line_route_path(referential,line,route) click_link "Ajouter une mission" fill_in "Nom", :with => "A to B" @@ -36,6 +39,7 @@ describe "JourneyPatterns" do end describe "from route's page, select a journey_pattern and edit it" do it "return to route's page with changed name" do + pending visit referential_line_route_path(referential,line,route) click_link "#{journey_pattern.name}" click_link "Modifier cette mission" @@ -46,6 +50,7 @@ describe "JourneyPatterns" do end describe "from route's page, select a journey_pattern and delete it" do it "return to route's page without journey_pattern name" do + pending visit referential_line_route_path(referential,line,route) click_link "#{journey_pattern.name}" click_link "Supprimer cette mission" diff --git a/spec/requests/lines_spec.rb b/spec/requests/lines_spec.rb index 59dc4eeed..32254bce1 100644 --- a/spec/requests/lines_spec.rb +++ b/spec/requests/lines_spec.rb @@ -4,14 +4,15 @@ require 'spec_helper' describe "Lines" do login_user - let!(:referential) { create(:referential).switch } - let!(:network) { Factory(:network) } - let!(:company) { Factory(:company) } - let!(:lines) { referential; Array.new(2) { Factory(:line, :network => network, :company => company) } } + let(:referential) { create(:referential).switch } + let(:network) { Factory(:network) } + let(:company) { Factory(:company) } + let(:lines) { referential; Array.new(2) { Factory(:line, :network => network, :company => company) } } subject { lines.first } describe "list" do it "display lines" do + pending visit referential_lines_path(referential) page.should have_content(lines.first.name) page.should have_content(lines.last.name) @@ -22,6 +23,7 @@ describe "Lines" do describe "show" do it "display line" do + pending subject.stub(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) }) visit referential_lines_path(referential) click_link "#{lines.first.name}" @@ -29,6 +31,7 @@ describe "Lines" do end it "display map" do + pending subject.stub(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) }) visit referential_lines_path(referential) click_link "#{lines.first.name}" @@ -39,6 +42,7 @@ describe "Lines" do describe "new" do it "creates line and return to show" do + pending subject.stub(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) }) visit referential_lines_path(referential) click_link "Ajouter une ligne" @@ -52,6 +56,7 @@ describe "Lines" do describe "edit and return to show" do it "edit line" do + pending subject.stub(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) }) visit referential_line_path(referential, subject) click_link "Modifier cette ligne" diff --git a/spec/requests/networks_spec.rb b/spec/requests/networks_spec.rb index cbc8a9638..1b15436ee 100644 --- a/spec/requests/networks_spec.rb +++ b/spec/requests/networks_spec.rb @@ -4,12 +4,14 @@ require 'spec_helper' describe "Networks" do login_user - let!(:referential) { create(:referential).switch } - let!(:networks) { referential; Array.new(2) { Factory(:network) } } + let(:referential) { create(:referential).switch } + let(:networks) { referential; Array.new(2) { Factory(:network) } } subject { networks.first } describe "list" do it "display networks" do + pending + visit referential_networks_path(referential) page.should have_content(networks.first.name) page.should have_content(networks.last.name) @@ -19,6 +21,8 @@ describe "Networks" do describe "show" do it "display network" do + pending + subject.stub(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) }) visit referential_networks_path(referential) click_link "#{networks.first.name}" @@ -26,6 +30,8 @@ describe "Networks" do end it "display map" do + pending + subject.stub(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) }) visit referential_networks_path(referential) click_link "#{networks.first.name}" @@ -36,6 +42,8 @@ describe "Networks" do describe "new" do it "creates network and return to show" do + pending + subject.stub(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) }) visit referential_networks_path(referential) click_link "Ajouter un réseau" @@ -49,6 +57,8 @@ describe "Networks" do describe "edit and return to show" do it "edit network" do + pending + subject.stub(:stop_areas).and_return(Array.new(2) { Factory(:stop_area) }) visit referential_network_path(referential, subject) click_link "Modifier ce réseau" diff --git a/spec/requests/referentials_spec.rb b/spec/requests/referentials_spec.rb index 51e68cd13..64a1a26dd 100644 --- a/spec/requests/referentials_spec.rb +++ b/spec/requests/referentials_spec.rb @@ -13,9 +13,11 @@ describe "Referentials" do context "when several referentials exist" do - let!(:referentials) { Array.new(2) { create(:referential) } } + let(:referentials) { Array.new(2) { create(:referential) } } it "should show n referentials" do + pending + visit referentials_path page.should have_content(referentials.first.name) page.should have_content(referentials.last.name) diff --git a/spec/requests/routes_spec.rb b/spec/requests/routes_spec.rb index e94d4cc53..baddfdf95 100644 --- a/spec/requests/routes_spec.rb +++ b/spec/requests/routes_spec.rb @@ -4,13 +4,14 @@ require 'spec_helper' describe "Routes" do login_user - let!(:referential) { create(:referential).switch } - let!(:line) { referential; Factory(:line) } - let!(:route) { referential; Factory(:route, :line => line) } - let!(:route2) { referential; Factory(:route, :line => line) } + let(:referential) { create(:referential).switch } + let(:line) { Factory(:line) } + let(:route) { Factory(:route, :line => line) } + let(:route2) { Factory(:route, :line => line) } describe "from lines page to a line page" do it "display line's routes" do + pending visit referential_lines_path(referential) click_link "#{line.name}" page.should have_content(route.name) @@ -19,6 +20,7 @@ describe "Routes" do end describe "from line's page to route's page" do it "display route properties" do + pending visit referential_line_path(referential,line) click_link "#{route.name}" page.should have_content(route.name) @@ -27,6 +29,7 @@ describe "Routes" do end describe "from line's page, create a new route" do it "return to line's page that display new route" do + pending visit referential_line_path(referential,line) click_link "Ajouter une séquence d'arrêts" fill_in "Nom", :with => "A to B" @@ -37,6 +40,7 @@ describe "Routes" do end describe "from line's page, select a route and edit it" do it "return to line's page with changed name" do + pending visit referential_line_path(referential,line) click_link "#{route.name}" click_link "Modifier cette séquence d'arrêts" @@ -47,6 +51,7 @@ describe "Routes" do end describe "from line's page, select a route and delete it" do it "return to line's page without route name" do + pending visit referential_line_path(referential,line) click_link "#{route.name}" #click_link "Supprimer cette séquence d'arrêts" diff --git a/spec/requests/stop_areas_spec.rb b/spec/requests/stop_areas_spec.rb index acc32bdc8..b81f70a6c 100644 --- a/spec/requests/stop_areas_spec.rb +++ b/spec/requests/stop_areas_spec.rb @@ -4,12 +4,13 @@ require 'spec_helper' describe "StopAreas" do login_user - let!(:referential) { create(:referential).switch } - let!(:stop_areas) { referential; Array.new(2) { Factory(:stop_area) } } + let(:referential) { create(:referential).switch } + let(:stop_areas) { referential; Array.new(2) { Factory(:stop_area) } } subject { stop_areas.first } describe "list" do it "display stop_areas" do + pending visit referential_stop_areas_path(referential) page.should have_content(stop_areas.first.name) page.should have_content(stop_areas.last.name) @@ -20,12 +21,14 @@ describe "StopAreas" do describe "show" do it "display stop_area" do + pending visit referential_stop_areas_path(referential) click_link "#{stop_areas.first.name}" page.should have_content(stop_areas.first.name) end it "display map" do + pending visit referential_stop_areas_path(referential) click_link "#{stop_areas.first.name}" page.should have_selector("#map", :class => 'stop_area') @@ -35,6 +38,7 @@ describe "StopAreas" do describe "new" do it "creates stop_area and return to show" do + pending visit referential_stop_areas_path(referential) click_link "Ajouter un arrêt" fill_in "Nom", :with => "StopArea 1" @@ -47,6 +51,7 @@ describe "StopAreas" do describe "edit and return to show" do it "edit stop_area" do + pending visit referential_stop_area_path(referential, subject) click_link "Modifier cet arrêt" fill_in "Nom", :with => "StopArea Modified" diff --git a/spec/requests/stop_points_spec.rb b/spec/requests/stop_points_spec.rb index 423e6fab3..e6e3303ab 100644 --- a/spec/requests/stop_points_spec.rb +++ b/spec/requests/stop_points_spec.rb @@ -4,10 +4,10 @@ require 'spec_helper' describe "StopPoints" do login_user - let!(:referential) { create(:referential).switch } - let!(:line) { referential; Factory(:line) } - let!(:route) { referential; Factory(:route, :line => line) } - let!(:route2) { referential; Factory(:route, :line => line) } + let(:referential) { create(:referential).switch } + let(:line) { referential; Factory(:line) } + let(:route) { referential; Factory(:route, :line => line) } + let(:route2) { referential; Factory(:route, :line => line) } describe "from route's page to a stop points page" do it "display route's stop points" do diff --git a/spec/requests/time_tables_spec.rb b/spec/requests/time_tables_spec.rb index 5dbf5220b..bd401dbbf 100644 --- a/spec/requests/time_tables_spec.rb +++ b/spec/requests/time_tables_spec.rb @@ -4,12 +4,13 @@ require 'spec_helper' describe "TimeTables" do login_user - let!(:referential) { create(:referential).switch } - let!(:time_tables) { referential; Array.new(2) { create(:time_table) } } + let(:referential) { create(:referential).switch } + let(:time_tables) { referential; Array.new(2) { create(:time_table) } } subject { time_tables.first } describe "list" do it "display time_tables" do + pending visit referential_time_tables_path(referential) page.should have_content(time_tables.first.comment) page.should have_content(time_tables.last.comment) @@ -19,6 +20,7 @@ describe "TimeTables" do describe "show" do it "display time_table" do + pending visit referential_time_tables_path(referential) click_link "#{time_tables.first.comment}" page.should have_content(time_tables.first.comment) @@ -28,6 +30,7 @@ describe "TimeTables" do describe "new" do it "creates time_table and return to show" do + pending visit referential_time_tables_path(referential) click_link "Ajouter un calendrier" fill_in "Description", :with => "TimeTable 1" @@ -39,6 +42,7 @@ describe "TimeTables" do describe "edit and return to show" do it "edit time_table" do + pending visit referential_time_table_path(referential, subject) click_link "Modifier ce calendrier" fill_in "Description", :with => "TimeTable Modified" |
