diff options
| author | Xinhui Xu | 2016-09-21 16:43:25 +0200 |
|---|---|---|
| committer | GitHub | 2016-09-21 16:43:25 +0200 |
| commit | 86924e2af5a1829e0c0a2a5daecbee0de12cab98 (patch) | |
| tree | 3d621254f171704610fc68ad93ce5ec729cc8cb0 | |
| parent | 66f789679ec1bb9a4f504287547e4f14f4584c98 (diff) | |
| parent | 9ccb414f3144eb7c17ab69d3cb5d94b11d915aa9 (diff) | |
| download | chouette-core-86924e2af5a1829e0c0a2a5daecbee0de12cab98.tar.bz2 | |
Merge pull request #1 from AF83/master
Merge master into Staging
| -rw-r--r-- | app/models/chouette/line.rb | 5 | ||||
| -rw-r--r-- | app/models/chouette/stop_area.rb | 22 | ||||
| -rw-r--r-- | app/models/concerns/stop_area_restrictions.rb | 1 | ||||
| -rw-r--r-- | app/views/companies/index.html.slim | 2 | ||||
| -rw-r--r-- | app/views/companies/index.js.slim | 2 | ||||
| -rw-r--r-- | app/views/errors/not_found.html.slim | 14 | ||||
| -rw-r--r-- | app/views/errors/server_error.html.slim | 14 | ||||
| -rw-r--r-- | app/views/group_of_lines/index.html.slim | 2 | ||||
| -rw-r--r-- | app/views/lines/_line.html.slim | 9 | ||||
| -rw-r--r-- | app/views/lines/index.html.slim | 7 | ||||
| -rw-r--r-- | app/views/lines/show.html.slim | 22 | ||||
| -rw-r--r-- | app/views/shared/_footer.html.slim | 4 | ||||
| -rw-r--r-- | app/views/stop_areas/_stop_area.html.slim | 5 | ||||
| -rw-r--r-- | app/views/stop_areas/show.html.slim | 11 | ||||
| -rw-r--r-- | config/locales/stop_areas.en.yml | 1 | ||||
| -rw-r--r-- | config/locales/stop_areas.fr.yml | 1 | ||||
| -rw-r--r-- | lib/stif/reflex_synchronization.rb | 10 | ||||
| -rw-r--r-- | spec/models/chouette/line_spec.rb | 5 | ||||
| -rw-r--r-- | spec/models/chouette/stop_area_spec.rb | 46 | ||||
| -rw-r--r-- | spec/models/stop_area_copy_spec.rb | 54 | ||||
| -rw-r--r-- | spec/tasks/reflex_rake_spec.rb | 2 |
21 files changed, 126 insertions, 113 deletions
diff --git a/app/models/chouette/line.rb b/app/models/chouette/line.rb index 4a4115cc2..14c9c73ba 100644 --- a/app/models/chouette/line.rb +++ b/app/models/chouette/line.rb @@ -21,9 +21,8 @@ class Chouette::Line < Chouette::ActiveRecord attr_reader :group_of_line_tokens attr_accessor :transport_mode - # FIXME #825 - #validates_presence_of :network - #validates_presence_of :company + validates_presence_of :network + validates_presence_of :company validates_format_of :registration_number, :with => %r{\A[\d\w_\-]+\Z}, :allow_nil => true, :allow_blank => true validates_format_of :stable_id, :with => %r{\A[\d\w_\-]+\Z}, :allow_nil => true, :allow_blank => true diff --git a/app/models/chouette/stop_area.rb b/app/models/chouette/stop_area.rb index 9a2358348..398f37996 100644 --- a/app/models/chouette/stop_area.rb +++ b/app/models/chouette/stop_area.rb @@ -7,8 +7,11 @@ class Chouette::StopArea < Chouette::ActiveRecord include Geokit::Mappable include ProjectionFields include StopAreaRestrictions - - include DefaultAttributesSupport + def self.model_name + ActiveModel::Name.new self, Chouette, self.name.demodulize + end + # Refs #1627 + # include DefaultAttributesSupport include StopAreaReferentialSupport has_many :stop_points, :dependent => :destroy @@ -47,9 +50,16 @@ class Chouette::StopArea < Chouette::ActiveRecord end after_update :clean_invalid_access_links - before_save :coordinates_to_lat_lng + # Refs #1627 + before_validation :prepare_auto_columns + def prepare_auto_columns + self.object_version = 1 + self.creation_time = Time.now + self.creator_id = 'chouette' + end + def combine_lat_lng if self.latitude.nil? || self.longitude.nil? "" @@ -155,8 +165,10 @@ class Chouette::StopArea < Chouette::ActiveRecord def position=(position) position = nil if String === position && position == "" position = Geokit::LatLng.normalize(position), 4326 if String === position - self.latitude = position.lat - self.longitude = position.lng + if position + self.latitude = position.lat + self.longitude = position.lng + end end def default_position diff --git a/app/models/concerns/stop_area_restrictions.rb b/app/models/concerns/stop_area_restrictions.rb index 38a57b55a..96f0507d6 100644 --- a/app/models/concerns/stop_area_restrictions.rb +++ b/app/models/concerns/stop_area_restrictions.rb @@ -23,7 +23,6 @@ module StopAreaRestrictions included do include ObjectidRestrictions - with_options if: :commercial_and_physical_hub_restricted? do |sa| # HUB-23 sa.validate :specific_objectid diff --git a/app/views/companies/index.html.slim b/app/views/companies/index.html.slim index 2fb042fa1..bf295dee7 100644 --- a/app/views/companies/index.html.slim +++ b/app/views/companies/index.html.slim @@ -1,6 +1,6 @@ = title_tag t('companies.index.title') -= search_form_for @q, :url => referential_companies_path(@line_referential), remote: true, :html => {:method => :get, class: 'form-inline', id: 'search', role: "form"} do |f| += search_form_for @q, :url => line_referential_companies_path(@line_referential), remote: true, :html => {:method => :get, class: 'form-inline', id: 'search', role: "form"} do |f| .panel.panel-default .panel-heading diff --git a/app/views/companies/index.js.slim b/app/views/companies/index.js.slim index cfb1c719c..2080ed28a 100644 --- a/app/views/companies/index.js.slim +++ b/app/views/companies/index.js.slim @@ -1 +1 @@ -| $('#companies').html("= escape_javascript(render('companies'))");
\ No newline at end of file +| $('#companies').html("#{escape_javascript(render('companies'))}");
\ No newline at end of file diff --git a/app/views/errors/not_found.html.slim b/app/views/errors/not_found.html.slim index 30107d2dc..913362251 100644 --- a/app/views/errors/not_found.html.slim +++ b/app/views/errors/not_found.html.slim @@ -1,22 +1,22 @@ .error - h2 = "Désolé, la page demandée n'existe pas" + h2 = "Désolé, la page demandée n'existe pas" a href="http://www.chouette.mobi/spip.php?rubrique38" target="_blank" - = "N'hésitez pas à nous décrire le problème" - = ", nous essaierons de le résoudre." + = "N'hésitez pas à nous décrire le problème" + = ", nous essaierons de le résoudre." br = "Merci d'avance" br - = "Vous pouvez néanmoins continuer à utiliser l'application CHOUETTE" + = "Vous pouvez néanmoins continuer à utiliser l'application CHOUETTE" + br + br br - br br - br br h2 = "The page you were looking for doesn't exist." - + = "You may have mistyped the address or the page may have moved." br diff --git a/app/views/errors/server_error.html.slim b/app/views/errors/server_error.html.slim index 3fe910196..b11176421 100644 --- a/app/views/errors/server_error.html.slim +++ b/app/views/errors/server_error.html.slim @@ -1,23 +1,23 @@ .error - h2 = "Désolé, une erreur est survenue" + h2 = "Désolé, une erreur est survenue" a href="http://www.chouette.mobi/spip.php?rubrique38" target="_blank" - = "N'hésitez pas à nous décrire le problème" - = ", nous essaierons de le résoudre." + = "N'hésitez pas à nous décrire le problème" + = ", nous essaierons de le résoudre." br = "Merci d'avance" br br - - = "Vous pouvez néanmoins continuer à utiliser l'application CHOUETTE" + + = "Vous pouvez néanmoins continuer à utiliser l'application CHOUETTE" br br br br br - + h2 = "We're sorry, but something went wrong." - + = "You may have mistyped the address or the page may have moved." br diff --git a/app/views/group_of_lines/index.html.slim b/app/views/group_of_lines/index.html.slim index 23d8523d9..8cd39407f 100644 --- a/app/views/group_of_lines/index.html.slim +++ b/app/views/group_of_lines/index.html.slim @@ -1,6 +1,6 @@ = title_tag t('group_of_lines.index.title') -= search_form_for @q, :url => referential_group_of_lines_path(@line_referential), remote: true, :html => {:method => :get, class: "form-inline", :id => "search", role: "form"} do |f| += search_form_for @q, :url => line_referential_group_of_lines_path(@line_referential), remote: true, :html => {:method => :get, class: "form-inline", :id => "search", role: "form"} do |f| .panel.panel-default .panel-heading .input-group.col-md-12 diff --git a/app/views/lines/_line.html.slim b/app/views/lines/_line.html.slim index eb7aecc1d..485937c19 100644 --- a/app/views/lines/_line.html.slim +++ b/app/views/lines/_line.html.slim @@ -3,7 +3,7 @@ ul.ce-LineBlock-header-list li = check_box_tag "ids[]", line.id, false, class: "multiple_selection", style: "display: none;" - + - if (line.number && line.number.length <= 3) span.label.label-default.line_number style="#{number_style(line)}" = line.number @@ -28,9 +28,8 @@ = line.human_attribute_name('network') = t('lines.index.unset') - else - / FIXME #825 = line.human_attribute_name('network') - / = link_to_if line.network, line.network.name, line_referential_network_path(line.line_referential, line.network), :title => "#{line.human_attribute_name('network')} #{line.network.name}" + = link_to_if line.network, line.network.name, line_referential_network_path(line.line_referential, line.network), :title => "#{line.human_attribute_name('network')} #{line.network.name}" p - if line.company.nil? @@ -38,12 +37,12 @@ = t('lines.index.unset') - else = line.human_attribute_name('company') - / = link_to_if( line.company, line.company.name, line_referential_company_path(line.line_referential, line.company), :title => "#{line.human_attribute_name('company')} #{line.company.name}" ) + = link_to_if( line.company, line.company.name, line_referential_company_path(line.line_referential, line.company), :title => "#{line.human_attribute_name('company')} #{line.company.name}" ) p - if line.group_of_lines.count == 0 br - / = t('lines.form.no_group_of_line') + = t('lines.form.no_group_of_line') - elsif line.group_of_lines.count == 1 = line.human_attribute_name('group_of_line') = link_to_if( line.group_of_lines.first, line.group_of_lines.first.name, line_referential_group_of_line_path(line.line_referential, line.group_of_lines.first), :title => "#{line.human_attribute_name('group_of_line')} #{line.group_of_lines.first.name}") diff --git a/app/views/lines/index.html.slim b/app/views/lines/index.html.slim index 5892dba36..a28d3d765 100644 --- a/app/views/lines/index.html.slim +++ b/app/views/lines/index.html.slim @@ -15,10 +15,9 @@ #advanced_search.panel-collapse.collapse .panel-body - / FIXME #825 - / = f.select(:network_id_eq, @line_referential.networks.collect {|n| [ n.name, n.id ] }.unshift([t('.no_networks'), -1]), {include_blank: t('.all_networks')}, { :class => 'form-control' }) - / = f.select(:company_id_eq, @line_referential.companies.collect {|c| [ c.name, c.id ] }.unshift([t('.no_companies'), -1]), { include_blank: t('.all_companies')}, { :class => 'form-control' }) - / = f.select(:group_of_lines_id_eq, @line_referential.group_of_lines.collect {|c| [ c.name, c.id ] }.unshift([t('.no_group_of_lines'), -1]), {include_blank: t('.all_group_of_lines')}, { :class => 'form-control' }) + = f.select(:network_id_eq, @line_referential.networks.collect {|n| [ n.name, n.id ] }.unshift([t('.no_networks'), -1]), {include_blank: t('.all_networks')}, { :class => 'form-control' }) + = f.select(:company_id_eq, @line_referential.companies.collect {|c| [ c.name, c.id ] }.unshift([t('.no_companies'), -1]), { include_blank: t('.all_companies')}, { :class => 'form-control' }) + = f.select(:group_of_lines_id_eq, @line_referential.group_of_lines.collect {|c| [ c.name, c.id ] }.unshift([t('.no_group_of_lines'), -1]), {include_blank: t('.all_group_of_lines')}, { :class => 'form-control' }) #lines = render 'lines' diff --git a/app/views/lines/show.html.slim b/app/views/lines/show.html.slim index b559df842..80a44a7f5 100644 --- a/app/views/lines/show.html.slim +++ b/app/views/lines/show.html.slim @@ -9,7 +9,7 @@ .summary - text_color = @line.text_color.blank? ? "black" : "##{@line.text_color}" - bg_color = @line.color.blank? ? "white" : "##{@line.color}" - + - if colors?(@line) p label = "#{t('lines.index.color')} : " @@ -22,17 +22,15 @@ - if @line.network.nil? = t('lines.index.unset') - else - / FIXME #825 - / = link_to @line.network.name, [@referential, @line.network] - + = link_to @line.network.name, [@line_referential, @line.network] + p label = "#{@line.human_attribute_name(:company)} : " - + - if @line.company.nil? = t('lines.index.unset') - else - / FIXME #825 - / = link_to @line.company.name, [@referential, @line.company] + = link_to @line.company.name, [@line_referential, @line.company] p label = "#{@line.human_attribute_name('number')} : " @@ -60,7 +58,7 @@ p label = "#{@line.human_attribute_name('mobility_restricted_suitability')} : " - + - if @line.mobility_restricted_suitability.nil? = @line.human_attribute_name("unspecified_mrs") - elsif @line.mobility_restricted_suitability? @@ -79,7 +77,7 @@ p label = "#{@line.human_attribute_name('flexible_service')} : " - + - if @line.flexible_service.nil? = @line.human_attribute_name("unspecified_fs") - elsif @line.flexible_service? @@ -93,10 +91,10 @@ = "#{@line.human_attribute_name('number_of_non_fs_vj')} : #{@line.vehicle_journeys.where('flexible_service = ?', false).count}" br = @line.human_attribute_name("number_of_null_fs_vj") - + - if @line.flexible_service.nil? = "(#{@line.human_attribute_name('default_fs_msg')})" - + = " : " = @line.vehicle_journeys.count - (@line.vehicle_journeys.where("flexible_service = ?", true).count + @line.vehicle_journeys.where("flexible_service = ?", false).count) @@ -135,7 +133,7 @@ h3.routes = t('.itineraries') = link_to t('lines.actions.edit'), edit_line_referential_line_path(@line_referential, @line), class: 'edit' li = link_to t('lines.actions.destroy'), line_referential_line_path(@line_referential, @line), method: :delete, :data => {:confirm => t('lines.actions.destroy_confirm')}, class: 'remove' - + - if !@line.hub_restricted? || (@line.hub_restricted? && @line.routes.size < 2) / FIXME #825 li diff --git a/app/views/shared/_footer.html.slim b/app/views/shared/_footer.html.slim index 1fcf144a4..aa18dbdd6 100644 --- a/app/views/shared/_footer.html.slim +++ b/app/views/shared/_footer.html.slim @@ -14,5 +14,5 @@ - else = link_to t("layouts.footer.contact.mail"), "#{ChouetteIhm::Application.config.company_contact}", target: "_blank" - li - = link_to t("layouts.footer.support.help"), help_path, target: "chouette_help"
\ No newline at end of file + / li + / = link_to t("layouts.footer.support.help"), help_path, target: "chouette_help"
\ No newline at end of file diff --git a/app/views/stop_areas/_stop_area.html.slim b/app/views/stop_areas/_stop_area.html.slim index 0265e554a..15f9e4452 100644 --- a/app/views/stop_areas/_stop_area.html.slim +++ b/app/views/stop_areas/_stop_area.html.slim @@ -16,6 +16,9 @@ .panel-body p + - if stop_area.deleted_at + span.warning = stop_area.human_attribute_name('deleted') + p - unless stop_area.area_type == 'ITL' || stop_area.geometry span.warning = t('.no_position') @@ -42,4 +45,4 @@ = t(".no_object") - else - stop_area.lines.each do |line| - span.label.label-default.line = line.number || truncate( line.name, length: 4 )
\ No newline at end of file + span.label.label-default.line = line.number || truncate( line.name, length: 4 ) diff --git a/app/views/stop_areas/show.html.slim b/app/views/stop_areas/show.html.slim index 249e29a57..06ca09dd5 100644 --- a/app/views/stop_areas/show.html.slim +++ b/app/views/stop_areas/show.html.slim @@ -4,6 +4,9 @@ = @map.to_html if show_map? .summary + - if @stop_area.deleted_at + p + label = @stop_area.human_attribute_name('deleted') p label = "#{@stop_area.human_attribute_name('comment')} : " = @stop_area.comment @@ -143,7 +146,7 @@ p.after_map - if @stop_area.parent == nil li / = link_to t('stop_areas.actions.clone_as_parent'), new_referential_stop_area_stop_area_copy_path(@referential, @stop_area, :hierarchy => "parent"), :class => "clone" - + - if manage_children li / = link_to t('stop_areas.actions.add_children'), add_children_referential_stop_area_path(@referential, @stop_area), :class => "children" @@ -159,7 +162,7 @@ p.after_map / = link_to t('access_points.actions.new'), new_referential_stop_area_access_point_path(@referential,@stop_area), :class => "add" li / = link_to t('stop_areas.actions.manage_access_links'), access_links_referential_stop_area_path(@referential,@stop_area), :class => "access_link" - + br - - = creation_tag(@stop_area)
\ No newline at end of file + + = creation_tag(@stop_area) diff --git a/config/locales/stop_areas.en.yml b/config/locales/stop_areas.en.yml index a556916bf..4197daaa2 100644 --- a/config/locales/stop_areas.en.yml +++ b/config/locales/stop_areas.en.yml @@ -81,6 +81,7 @@ en: name: "Name" registration_number: "Registration number" published_name: "Published name" + deleted: "Deleted" comment: "Comments" stop_area_type: "Area type" nearest_topic_name: "Nearest point of interest" diff --git a/config/locales/stop_areas.fr.yml b/config/locales/stop_areas.fr.yml index 73e565d59..b552a3483 100644 --- a/config/locales/stop_areas.fr.yml +++ b/config/locales/stop_areas.fr.yml @@ -81,6 +81,7 @@ fr: name: "Nom" registration_number: "Numéro d'enregistrement" published_name: "Nom public" + deleted: "Supprimé" comment: "Commentaire" stop_area_type: "Type d'arrêt" nearest_topic_name: "Point d'intérêt le plus proche" diff --git a/lib/stif/reflex_synchronization.rb b/lib/stif/reflex_synchronization.rb index eab86caf1..b68fd6fc5 100644 --- a/lib/stif/reflex_synchronization.rb +++ b/lib/stif/reflex_synchronization.rb @@ -5,9 +5,8 @@ module Stif StopAreaReferential.find_by(name: "Reflex") end - # Todo remove dummy objectid def find_by_object_id objectid - Chouette::StopArea.find_by(objectid: "dummy:StopArea:#{objectid.tr(':', '')}") + Chouette::StopArea.find_by(objectid: objectid) end def synchronize @@ -45,7 +44,7 @@ module Stif self.defaut_referential.stop_area_referential_sync.record_status :ok, I18n.t('synchronization.reflex.message.success', time: Time.now - tstart, imported: processed.uniq.size, deleted: deleted.size) rescue Exception => e Rails.logger.error "Reflex:sync - Error: #{e}, ended after #{Time.now - tstart} seconds" - LineReferential.first.line_referential_sync.record_status :ko, I18n.t('synchronization.reflex.message.failure', time: Time.now - tstart) + self.defaut_referential.stop_area_referential_sync.record_status :ko, I18n.t('synchronization.reflex.message.failure', time: Time.now - tstart) end end @@ -81,6 +80,7 @@ module Stif def create_or_update_access_point entry, stop_area access = Chouette::AccessPoint.find_or_create_by(objectid: "dummy:AccessPoint:#{entry.id.tr(':', '')}") + # Hack, on save object_version will be incremented by 1 entry.version = entry.version.to_i + 1 if access.persisted? access.stop_area = stop_area { @@ -95,9 +95,7 @@ module Stif end def create_or_update_stop_area entry - stop = Chouette::StopArea.find_or_create_by(objectid: "dummy:StopArea:#{entry.id.tr(':', '')}") - # Hack, on save object_version will be incremented by 1 - entry.version = entry.version.to_i + 1 if stop.persisted? + stop = Chouette::StopArea.find_or_create_by(objectid: entry.id) stop.deleted_at = nil stop.stop_area_referential = self.defaut_referential { diff --git a/spec/models/chouette/line_spec.rb b/spec/models/chouette/line_spec.rb index 4b22a911d..c38d0591b 100644 --- a/spec/models/chouette/line_spec.rb +++ b/spec/models/chouette/line_spec.rb @@ -4,9 +4,8 @@ describe Chouette::Line, :type => :model do subject { create(:line) } - # FIXME #825 - # it { is_expected.to validate_presence_of :network } - # it { is_expected.to validate_presence_of :company } + it { is_expected.to validate_presence_of :network } + it { is_expected.to validate_presence_of :company } it { is_expected.to validate_presence_of :name } diff --git a/spec/models/chouette/stop_area_spec.rb b/spec/models/chouette/stop_area_spec.rb index 738ee0f3e..53d4fcee4 100644 --- a/spec/models/chouette/stop_area_spec.rb +++ b/spec/models/chouette/stop_area_spec.rb @@ -7,10 +7,11 @@ describe Chouette::StopArea, :type => :model do let!(:stop_place) { create :stop_area, :area_type => "StopPlace" } let!(:itl) { create :stop_area, :area_type => "ITL" } - describe '#objectid' do - subject { super().objectid } - it { is_expected.to be_kind_of(Chouette::ObjectId) } - end + # Refs #1627 + # describe '#objectid' do + # subject { super().objectid } + # it { is_expected.to be_kind_of(Chouette::ObjectId) } + # end it { is_expected.to belong_to(:stop_area_referential) } it { is_expected.to validate_presence_of :name } @@ -422,24 +423,25 @@ describe Chouette::StopArea, :type => :model do end end - describe "#duplicate" do - it "should be a copy of" do - stop_place = create :stop_area, :area_type => "StopPlace" - subject = create :stop_area, :area_type => "CommercialStopPoint" ,:parent => stop_place, :coordinates => "45.123,120.456" - access_point1 = create :access_point, :stop_area => subject - access_point2 = create :access_point, :stop_area => subject - quay1 = create :stop_area, :parent => subject, :area_type => "Quay" - target=subject.duplicate - expect(target.id).to be_nil - expect(target.name).to eq(I18n.t("activerecord.copy", name: subject.name)) - expect(target.objectid).to eq(subject.objectid+"_1") - expect(target.area_type).to eq(subject.area_type) - expect(target.parent).to be_nil - expect(target.children.size).to eq(0) - expect(target.access_points.size).to eq(0) - expect(target.coordinates).to eq("45.123,120.456") - end - end + # Refs #1627 + # describe "#duplicate" do + # it "should be a copy of" do + # stop_place = create :stop_area, :area_type => "StopPlace" + # subject = create :stop_area, :area_type => "CommercialStopPoint" ,:parent => stop_place, :coordinates => "45.123,120.456" + # access_point1 = create :access_point, :stop_area => subject + # access_point2 = create :access_point, :stop_area => subject + # quay1 = create :stop_area, :parent => subject, :area_type => "Quay" + # target=subject.duplicate + # expect(target.id).to be_nil + # expect(target.name).to eq(I18n.t("activerecord.copy", name: subject.name)) + # expect(target.objectid).to eq(subject.objectid+"_1") + # expect(target.area_type).to eq(subject.area_type) + # expect(target.parent).to be_nil + # expect(target.children.size).to eq(0) + # expect(target.access_points.size).to eq(0) + # expect(target.coordinates).to eq("45.123,120.456") + # end + # end end diff --git a/spec/models/stop_area_copy_spec.rb b/spec/models/stop_area_copy_spec.rb index bf0031f68..a00271077 100644 --- a/spec/models/stop_area_copy_spec.rb +++ b/spec/models/stop_area_copy_spec.rb @@ -2,37 +2,37 @@ require 'spec_helper' describe StopAreaCopy, :type => :model do - + subject { StopAreaCopy.new(:source_id => 1, :hierarchy => "child", :area_type => "Quay") } - - describe ".save" do - it "should create a child for source" do - source = create(:stop_area, :area_type => "CommercialStopPoint", :name => "test1", - :registration_number => "123456", :city_name => "dummy", :zip_code => "12345") - source.save - subject.source_id = source.id - subject.hierarchy = "child" - subject.area_type = "Quay" - subject.save + describe ".save" do + # Fixme #1627 + # it "should create a child for source" do + # source = create(:stop_area, :area_type => "CommercialStopPoint", :name => "test1", + # :registration_number => "123456", :city_name => "dummy", :zip_code => "12345") + # source.save + # subject.source_id = source.id + # subject.hierarchy = "child" + # subject.area_type = "Quay" + # subject.save - source.reload - expect(source.children.length).to eq(1) - expect(source.children[0].name).to eq("test1") - end - it "should create a parent for source" do - source = create(:stop_area, :area_type => "CommercialStopPoint", :name => "test2", - :registration_number => "123456", :city_name => "dummy", :zip_code => "12345") - source.save - subject.source_id = source.id - subject.hierarchy = "parent" - subject.area_type = "StopPlace" - subject.save - source.reload - expect(source.parent).not_to be_nil - expect(source.parent.name).to eq('test2') - end + # source.reload + # expect(source.children.length).to eq(1) + # expect(source.children[0].name).to eq("test1") + # end + # it "should create a parent for source" do + # source = create(:stop_area, :area_type => "CommercialStopPoint", :name => "test2", + # :registration_number => "123456", :city_name => "dummy", :zip_code => "12345") + # source.save + # subject.source_id = source.id + # subject.hierarchy = "parent" + # subject.area_type = "StopPlace" + # subject.save + # source.reload + # expect(source.parent).not_to be_nil + # expect(source.parent.name).to eq('test2') + # end end end diff --git a/spec/tasks/reflex_rake_spec.rb b/spec/tasks/reflex_rake_spec.rb index 3a0ce0632..ff9a555ef 100644 --- a/spec/tasks/reflex_rake_spec.rb +++ b/spec/tasks/reflex_rake_spec.rb @@ -29,7 +29,7 @@ describe 'reflex:sync' do end it 'should map xml data to StopArea attribute' do - stop_area = Chouette::StopArea.find_by(name: 'First stopPlace') + stop_area = Chouette::StopArea.find_by(objectid: 'FR:77153:LDA:69325:STIF') expect(stop_area.city_name).to eq 'Dammartin-en-Goële' expect(stop_area.zip_code).to eq '77153' expect(stop_area.area_type).to eq 'StopPlace' |
