diff options
| -rw-r--r-- | Gemfile | 18 | ||||
| -rw-r--r-- | app/models/chouette/stop_point.rb | 6 | ||||
| -rw-r--r-- | config/initializers/postgresql_adapter_patch.rb | 68 | ||||
| -rw-r--r-- | config/initializers/squeel.rb | 6 | ||||
| -rw-r--r-- | spec/spec_helper.rb | 17 | 
5 files changed, 66 insertions, 49 deletions
| @@ -2,7 +2,7 @@  source 'http://rubygems.org'  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 4.1.10' +gem 'rails', '~> 4.2.7.1'  # Use SCSS for stylesheets  gem 'sass-rails', '~> 4.0.3' @@ -56,7 +56,7 @@ platforms :ruby do    gem 'sqlite3'  end -gem 'activerecord-postgis-adapter' +gem 'activerecord-postgis-adapter', "~> 3.0.0"  gem 'polylines'  # Codifligne API @@ -82,7 +82,7 @@ gem 'georuby', '2.3.0' # Fix version for georuby-ext because api has changed  gem 'mimemagic'  # User interface -gem 'language_engine', '0.0.6' +gem 'language_engine', github: 'af83/language_engine'  gem 'calendar_helper', '0.2.5'  gem 'cocoon'  gem 'slim-rails', '~> 3.1' @@ -105,7 +105,7 @@ gem 'google-analytics-rails'  # Model  gem 'will_paginate'  gem 'ransack' -gem 'squeel' +gem "squeel", :git => "git://github.com/activerecord-hackery/squeel.git"  gem 'active_attr'  gem 'draper' @@ -113,7 +113,7 @@ gem 'draper'  gem 'enumerize', '~> 0.10.0'  gem 'foreigner', '~> 1.7.4'  gem 'deep_cloneable', '~> 2.0.0' -gem 'acts-as-taggable-on', '>= 3' +gem 'acts-as-taggable-on', '~> 4.0.0'  gem 'acts_as_list', '~> 0.6.0'  gem 'acts_as_tree', '~> 2.1.0', require: 'acts_as_tree' @@ -137,11 +137,11 @@ group :development do    gem 'capistrano-ext'    gem 'capistrano-npm', require: false    gem 'guard' -  gem 'guard-rspec' +  gem 'guard-rspec', "~> 4.5.0"    gem 'rails-erd'    # MetaRequest is incompatible with rgeo-activerecord    # gem 'meta_request' -  gem 'quiet_assets', '~> 1.0' +  gem 'quiet_assets'    gem 'license_finder'    gem 'bundler-audit' @@ -166,7 +166,7 @@ end  group :test, :development do    gem 'awesome_print'    gem 'pry-rails' -  gem 'rspec-rails', '~> 3.1.0' +  gem 'rspec-rails', '~> 3.5.0'    gem 'fakeweb'    gem 'webmock'    gem 'capybara', '~> 2.4.0' @@ -177,7 +177,7 @@ group :test, :development do    gem 'rb-inotify', require: RUBY_PLATFORM.include?('linux') && 'rb-inotify'    gem 'rb-fsevent', require: RUBY_PLATFORM.include?('darwin') && 'rb-fsevent'    gem 'transpec' -  gem 'shoulda-matchers' +  gem 'shoulda-matchers', '~> 3.1'    gem "teaspoon-jasmine"    gem "phantomjs"  end diff --git a/app/models/chouette/stop_point.rb b/app/models/chouette/stop_point.rb index b77189fc1..8a3262dd0 100644 --- a/app/models/chouette/stop_point.rb +++ b/app/models/chouette/stop_point.rb @@ -2,7 +2,7 @@ module Chouette    class StopPoint < TridentActiveRecord      include ForBoardingEnumerations      include ForAlightingEnumerations -     +      # FIXME http://jira.codehaus.org/browse/JRUBY-6358      self.primary_key = "id" @@ -16,7 +16,7 @@ module Chouette      validates_presence_of :stop_area      validate :stop_area_id_validation -    scope :default_order, order("position") +    scope :default_order, -> { order("position") }      before_destroy :remove_dependent_journey_pattern_stop_points      def remove_dependent_journey_pattern_stop_points @@ -25,7 +25,7 @@ module Chouette            jp.stop_point_ids = jp.stop_point_ids - [id]          end        end -    end   +    end      def stop_area_id_validation        if stop_area_id.nil? diff --git a/config/initializers/postgresql_adapter_patch.rb b/config/initializers/postgresql_adapter_patch.rb index 2e4d73f85..3c6530bef 100644 --- a/config/initializers/postgresql_adapter_patch.rb +++ b/config/initializers/postgresql_adapter_patch.rb @@ -14,41 +14,41 @@  # Add missing double-quote to write array of daterange in SQL query  # See #1782 -class ActiveRecord::ConnectionAdapters::PostgreSQLColumn +# class ActiveRecord::ConnectionAdapters::PostgreSQLColumn -  def self.array_to_string(value, column, adapter) -    casted_values = value.map do |val| -      if String === val -        if val == "NULL" -          "\"#{val}\"" -        else -          quote_and_escape(adapter.type_cast(val, column, true)) -        end -      elsif Range === val -        casted_value = adapter.type_cast(val, column, true) -        "\"#{casted_value}\"" -      else -        adapter.type_cast(val, column, true) -      end -    end -    "{#{casted_values.join(',')}}" -  end +#   def self.array_to_string(value, column, adapter) +#     casted_values = value.map do |val| +#       if String === val +#         if val == "NULL" +#           "\"#{val}\"" +#         else +#           quote_and_escape(adapter.type_cast(val, column, true)) +#         end +#       elsif Range === val +#         casted_value = adapter.type_cast(val, column, true) +#         "\"#{casted_value}\"" +#       else +#         adapter.type_cast(val, column, true) +#       end +#     end +#     "{#{casted_values.join(',')}}" +#   end -end +# end -module ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID -  class DateRange < Range -    # Unnormalize daterange -    # [2016-11-19,2016-12-26) -> 2016-11-19..2016-12-25 -    def type_cast(value) -      result = super value +# module ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID +#   class DateRange < Range +#     # Unnormalize daterange +#     # [2016-11-19,2016-12-26) -> 2016-11-19..2016-12-25 +#     def type_cast(value) +#       result = super value -      if result.respond_to?(:exclude_end?) && result.exclude_end? -        ::Range.new(result.begin, result.end - 1, false) -      else -        result -      end -    end -  end -  register_type 'daterange', DateRange.new(:date) -end +#       if result.respond_to?(:exclude_end?) && result.exclude_end? +#         ::Range.new(result.begin, result.end - 1, false) +#       else +#         result +#       end +#     end +#   end +#   register_type 'daterange', DateRange.new(:date) +# end diff --git a/config/initializers/squeel.rb b/config/initializers/squeel.rb index 821e72952..9fb8b24b2 100644 --- a/config/initializers/squeel.rb +++ b/config/initializers/squeel.rb @@ -1,8 +1,8 @@ -Squeel.configure do |config| +# Squeel.configure do |config|    # To load hash extensions (to allow for AND (&), OR (|), and NOT (-) against    # hashes of conditions):    # -  config.load_core_extensions :hash +  # config.load_core_extensions :hash    # To load symbol extensions (for a subset of the old MetaWhere functionality,    # via Arel predicate methods on Symbols: :name.matches, etc): @@ -21,4 +21,4 @@ Squeel.configure do |config|    # "less_than_any" and "less_than_all" as well:    #    # config.alias_predicate :less_than, :lt -end +# end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index dd062bc84..f32d8a0fc 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -87,3 +87,20 @@ RSpec.configure do |config|    config.infer_spec_type_from_file_location!  end + +Shoulda::Matchers.configure do |config| +  config.integrate do |with| +    # Choose a test framework: +    with.test_framework :rspec +    # with.test_framework :minitest +    # with.test_framework :minitest_4 +    # with.test_framework :test_unit + +    # Choose one or more libraries: +    # with.library :active_record +    # with.library :active_model +    # with.library :action_controller +    # Or, choose the following (which implies all of the above): +    with.library :rails +  end +end | 
