Hello community, here is the log from the commit of package rubygem-activerecord-deprecated_finders for openSUSE:Factory checked in at 2015-04-10 09:53:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-activerecord-deprecated_finders (Old) and /work/SRC/openSUSE:Factory/.rubygem-activerecord-deprecated_finders.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "rubygem-activerecord-deprecated_finders" Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-activerecord-deprecated_finders/rubygem-activerecord-deprecated_finders.changes 2014-10-14 07:11:27.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.rubygem-activerecord-deprecated_finders.new/rubygem-activerecord-deprecated_finders.changes 2015-04-10 09:53:03.000000000 +0200 @@ -1,0 +2,5 @@ +Wed Apr 8 09:25:59 UTC 2015 - coolo@suse.com + +- updated to version 1.0.4 + +------------------------------------------------------------------- Old: ---- activerecord-deprecated_finders-1.0.3.gem New: ---- activerecord-deprecated_finders-1.0.4.gem gem2rpm.yml ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-activerecord-deprecated_finders.spec ++++++ --- /var/tmp/diff_new_pack.zgE0uY/_old 2015-04-10 09:53:03.000000000 +0200 +++ /var/tmp/diff_new_pack.zgE0uY/_new 2015-04-10 09:53:03.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package rubygem-activerecord-deprecated_finders # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,16 +16,25 @@ # +# +# This file was generated with a gem2rpm.yml and not just plain gem2rpm. +# All sections marked as MANUAL, license headers, summaries and descriptions +# can be maintained in that file. Please consult this file before editing any +# of those fields +# + Name: rubygem-activerecord-deprecated_finders -Version: 1.0.3 +Version: 1.0.4 Release: 0 %define mod_name activerecord-deprecated_finders %define mod_full_name %{mod_name}-%{version} - BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: ruby-macros >= 1 +BuildRequires: %{rubygem gem2rpm} +BuildRequires: %{ruby} +BuildRequires: ruby-macros >= 5 Url: https://github.com/rails/activerecord-deprecated_finders Source: http://rubygems.org/gems/%{mod_full_name}.gem +Source1: gem2rpm.yml Summary: This gem contains deprecated finder APIs extracted from Active License: MIT Group: Development/Languages/Ruby @@ -39,7 +48,6 @@ %install %gem_install \ - --symlink-binaries \ --doc-files="LICENSE README.md" \ -f ++++++ activerecord-deprecated_finders-1.0.3.gem -> activerecord-deprecated_finders-1.0.4.gem ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.gitignore new/.gitignore --- old/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/.gitignore 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -*.gem -*.rbc -.bundle -.config -.yardoc -*.lock -InstalledFiles -_yardoc -coverage -doc/ -lib/bundler/man -pkg -rdoc -spec/reports -test/tmp -test/version_tmp -tmp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.travis.yml new/.travis.yml --- old/.travis.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/.travis.yml 1970-01-01 01:00:00.000000000 +0100 @@ -1,16 +0,0 @@ -language: ruby -rvm: - - 1.9.3 - - 2.0.0 -gemfile: - - gemfiles/Gemfile-edge - - Gemfile -notifications: - email: false - campfire: - on_success: change - on_failure: always - rooms: - - secure: "DwWWfmRXWSYoelIo3W6H99FrLM2V9ugFoAu+xBo42n2pNV44lU+8T9O+zWkV\nwD3Lz+7URB/5IRPcEel/KYaRYNJl71YUBgtlcvjM7Xl/7YGLYFAcPT2RXfKA\nctvckk/5NehmSawnLhhvMz2gKtIx/fIwCVqxUnRqqYE0eEQaONA=" -before_install: - - gem install bundler diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Gemfile new/Gemfile --- old/Gemfile 1970-01-01 01:00:00.000000000 +0100 +++ new/Gemfile 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -source 'https://rubygems.org' - -gemspec - -gem 'rails', '>= 4.0.0.beta', '< 5' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/README.md new/README.md --- old/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/README.md 2015-04-01 05:25:47.000000000 +0200 @@ -1,15 +1,59 @@ # Active Record Deprecated Finders -This gem will be used to extract and deprecate old-style finder option -hashes in Active Record: +This gem is a dependency of Rails 4.0 to provide deprecated finder +functionality. + +It will be removed as a dependency in Rails 4.1, but users can manually include +it in their Gemfile and it will continue to be maintained until Rails 5. + +```ruby +gem 'activerecord-deprecated_finders', require: 'active_record/deprecated_finders' +``` -``` ruby +This gem is used to extract and deprecate old-style finder option hashes in +Active Record: + +```ruby Post.find(:all, conditions: { published_on: 2.weeks.ago }, limit: 5) ``` -It will be a dependency of Rails 4.0 to provide the deprecated -functionality. +as well as the following dynamic finders: + +* `find_all_by_...` +* `find_last_by_...` +* `scoped_by_...` +* `find_or_initialize_by_...` +* `find_or_create_by_...` + +Note that `find(primary_key)`, `find_by...`, and `find_by...!` are not +deprecated. + +To avoid reliance on this gem, you'll need to migrate your finder usage. + +To migrate dynamic finders to Rails 4.1+: + +* `find_all_by_...` should become `where(...)`. +* `find_last_by_...` should become `where(...).last`. +* `scoped_by_...` should become `where(...)`. +* `find_or_initialize_by_...` should become `find_or_initialize_by(...)`. +* `find_or_create_by_...` should become `find_or_create_by(...)`. + +To migrate old-style finder option hashes and for additional information, +please refer to: + +* [ActiveRecord::FinderMethods][findermethods], + [ActiveRecord::Relation][relation], and + [ActiveRecord::QueryMethods][querymethods] docs. +* Rails Guide: Upgrading Ruby on Rails ([stable][stableguide] / + [edge][edgeguide]). -It will be removed as a dependency in Rails 4.1, but users can manually -include it in their Gemfile and it will continue to be maintained until -Rails 5. +[findermethods]: +http://api.rubyonrails.org/classes/ActiveRecord/FinderMethods.html +[relation]: +http://api.rubyonrails.org/classes/ActiveRecord/Relation.html +[querymethods]: +http://api.rubyonrails.org/classes/ActiveRecord/QueryMethods.html +[stableguide]: +http://guides.rubyonrails.org/upgrading_ruby_on_rails.html +[edgeguide]: +http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Rakefile new/Rakefile --- old/Rakefile 1970-01-01 01:00:00.000000000 +0100 +++ new/Rakefile 1970-01-01 01:00:00.000000000 +0100 @@ -1,28 +0,0 @@ -#!/usr/bin/env rake -require "bundler/gem_tasks" -require 'rake/testtask' - -Rake::TestTask.new do |t| - t.libs = ["test"] - t.pattern = "test/**/*_test.rb" - t.ruby_opts = ['-w'] -end - -task :default => :test - -specname = "activerecord-deprecated_finders.gemspec" -deps = `git ls-files`.split("\n") - [specname] - -task :gemspec => specname - -file specname => deps do - files = `git ls-files`.split("\n") - Dir["gemfiles/*"] - test_files = `git ls-files -- {test,spec,features}/*`.split("\n") - executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } - - require 'erb' - - File.open specname, 'w:utf-8' do |f| - f.write ERB.new(File.read("#{specname}.erb")).result(binding) - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/activerecord-deprecated_finders.gemspec new/activerecord-deprecated_finders.gemspec --- old/activerecord-deprecated_finders.gemspec 1970-01-01 01:00:00.000000000 +0100 +++ new/activerecord-deprecated_finders.gemspec 1970-01-01 01:00:00.000000000 +0100 @@ -1,21 +0,0 @@ -# -*- encoding: utf-8 -*- -require File.expand_path('../lib/active_record/deprecated_finders/version', __FILE__) - -Gem::Specification.new do |gem| - gem.authors = ["Jon Leighton"] - gem.email = ["j@jonathanleighton.com"] - gem.description = %q{Deprecated finder APIs extracted from Active Record.} - gem.summary = %q{This gem contains deprecated finder APIs extracted from Active Record.} - gem.homepage = "https://github.com/rails/activerecord-deprecated_finders" - - gem.files = [".gitignore",".travis.yml","Gemfile","LICENSE","README.md","Rakefile","activerecord-deprecated_finders.gemspec","activerecord-deprecated_finders.gemspec.erb","lib/active_record/deprecated_finders.rb","lib/active_record/deprecated_finders/association_builder.rb","lib/active_record/deprecated_finders/base.rb","lib/active_record/deprecated_finders/collection_proxy.rb","lib/active_record/deprecated_finders/dynamic_matchers.rb","lib/active_record/deprecated_finders/relation.rb","lib/active_record/deprecated_finders/version.rb","test/associations_test.rb","test/calculate_test.rb","test/default_scope_test.rb","test/dynamic_methods_test.rb","test/find_in_batches_test.rb","test/finder_options_test.rb","test/finder_test.rb","test/helper.rb","test/scope_test.rb","test/scoped_test.rb","test/update_all_test.rb","test/with_scope_test.rb"] - gem.test_files = ["test/associations_test.rb","test/calculate_test.rb","test/default_scope_test.rb","test/dynamic_methods_test.rb","test/find_in_batches_test.rb","test/finder_options_test.rb","test/finder_test.rb","test/helper.rb","test/scope_test.rb","test/scoped_test.rb","test/update_all_test.rb","test/with_scope_test.rb"] - gem.executables = [] - gem.name = "activerecord-deprecated_finders" - gem.require_paths = ["lib"] - gem.version = ActiveRecord::DeprecatedFinders::VERSION - - gem.add_development_dependency 'minitest', '>= 3' - gem.add_development_dependency 'activerecord', '>= 4.0.0.beta', '< 5' - gem.add_development_dependency 'sqlite3', '~> 1.3' -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/activerecord-deprecated_finders.gemspec.erb new/activerecord-deprecated_finders.gemspec.erb --- old/activerecord-deprecated_finders.gemspec.erb 1970-01-01 01:00:00.000000000 +0100 +++ new/activerecord-deprecated_finders.gemspec.erb 1970-01-01 01:00:00.000000000 +0100 @@ -1,21 +0,0 @@ -# -*- encoding: utf-8 -*- -require File.expand_path('../lib/active_record/deprecated_finders/version', __FILE__) - -Gem::Specification.new do |gem| - gem.authors = ["Jon Leighton"] - gem.email = ["j@jonathanleighton.com"] - gem.description = %q{Deprecated finder APIs extracted from Active Record.} - gem.summary = %q{This gem contains deprecated finder APIs extracted from Active Record.} - gem.homepage = "https://github.com/rails/activerecord-deprecated_finders" - - gem.files = [<%= files.map(&:inspect).join ',' %>] - gem.test_files = [<%= test_files.map(&:inspect).join ',' %>] - gem.executables = [<%= executables.map(&:inspect).join ',' %>] - gem.name = "activerecord-deprecated_finders" - gem.require_paths = ["lib"] - gem.version = ActiveRecord::DeprecatedFinders::VERSION - - gem.add_development_dependency 'minitest', '>= 3' - gem.add_development_dependency 'activerecord', '>= 4.0.0.beta', '< 5' - gem.add_development_dependency 'sqlite3', '~> 1.3' -end Files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_record/deprecated_finders/base.rb new/lib/active_record/deprecated_finders/base.rb --- old/lib/active_record/deprecated_finders/base.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/active_record/deprecated_finders/base.rb 2015-04-01 05:25:47.000000000 +0200 @@ -43,7 +43,7 @@ end if result.is_a?(Hash) - @klass.unscoped.apply_finder_options(result, true) + @klass.all.apply_finder_options(result, true) else result end @@ -92,7 +92,10 @@ scope.assert_valid_keys([ :find, :create ]) relation = construct_finder_arel(scope[:find] || {}) - relation.default_scoped = true unless action == :overwrite + + if relation.respond_to?(:default_scoped=) + relation.default_scoped = true unless action == :overwrite + end if previous_scope && previous_scope.create_with_value && scope[:create] scope_for_create = if action == :merge diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_record/deprecated_finders/collection_proxy.rb new/lib/active_record/deprecated_finders/collection_proxy.rb --- old/lib/active_record/deprecated_finders/collection_proxy.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/active_record/deprecated_finders/collection_proxy.rb 2015-04-01 05:25:47.000000000 +0200 @@ -29,8 +29,12 @@ # Ensure this get included first include ActiveRecord::Delegation::ClassSpecificRelation - # Now override the method_missing definition - include InterceptDynamicInstantiators + unless ActiveRecord::VERSION::MAJOR == 4 && + ActiveRecord::VERSION::MINOR == 2 && + ActiveRecord::VERSION::TINY > 1 + # Now override the method_missing definition + include InterceptDynamicInstantiators + end end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_record/deprecated_finders/relation.rb new/lib/active_record/deprecated_finders/relation.rb --- old/lib/active_record/deprecated_finders/relation.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/active_record/deprecated_finders/relation.rb 2015-04-01 05:25:47.000000000 +0200 @@ -79,7 +79,7 @@ ) apply_finder_options(options.except(:distinct), true) - .calculate(operation, column_name, :distinct => options[:distinct]) + .calculate(operation, column_name, options.slice(:distinct)) else super end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/active_record/deprecated_finders/version.rb new/lib/active_record/deprecated_finders/version.rb --- old/lib/active_record/deprecated_finders/version.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/active_record/deprecated_finders/version.rb 2015-04-01 05:25:47.000000000 +0200 @@ -1,5 +1,5 @@ module ActiveRecord module DeprecatedFinders - VERSION = "1.0.3" + VERSION = "1.0.4" end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 1970-01-01 01:00:00.000000000 +0100 +++ new/metadata 2015-04-01 05:25:47.000000000 +0200 @@ -1,61 +1,61 @@ --- !ruby/object:Gem::Specification name: activerecord-deprecated_finders version: !ruby/object:Gem::Version - version: 1.0.3 + version: 1.0.4 platform: ruby authors: - Jon Leighton autorequire: bindir: bin cert_chain: [] -date: 2013-06-11 00:00:00.000000000 Z +date: 2015-04-01 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: minitest requirement: !ruby/object:Gem::Requirement requirements: - - - '>=' + - - ">=" - !ruby/object:Gem::Version version: '3' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - - '>=' + - - ">=" - !ruby/object:Gem::Version version: '3' - !ruby/object:Gem::Dependency name: activerecord requirement: !ruby/object:Gem::Requirement requirements: - - - '>=' + - - ">=" - !ruby/object:Gem::Version version: 4.0.0.beta - - - < + - - "<" - !ruby/object:Gem::Version version: '5' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - - '>=' + - - ">=" - !ruby/object:Gem::Version version: 4.0.0.beta - - - < + - - "<" - !ruby/object:Gem::Version version: '5' - !ruby/object:Gem::Dependency name: sqlite3 requirement: !ruby/object:Gem::Requirement requirements: - - - ~> + - - "~>" - !ruby/object:Gem::Version version: '1.3' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - - ~> + - - "~>" - !ruby/object:Gem::Version version: '1.3' description: Deprecated finder APIs extracted from Active Record. @@ -65,14 +65,8 @@ extensions: [] extra_rdoc_files: [] files: -- .gitignore -- .travis.yml -- Gemfile - LICENSE - README.md -- Rakefile -- activerecord-deprecated_finders.gemspec -- activerecord-deprecated_finders.gemspec.erb - lib/active_record/deprecated_finders.rb - lib/active_record/deprecated_finders/association_builder.rb - lib/active_record/deprecated_finders/base.rb @@ -80,20 +74,9 @@ - lib/active_record/deprecated_finders/dynamic_matchers.rb - lib/active_record/deprecated_finders/relation.rb - lib/active_record/deprecated_finders/version.rb -- test/associations_test.rb -- test/calculate_test.rb -- test/default_scope_test.rb -- test/dynamic_methods_test.rb -- test/find_in_batches_test.rb -- test/finder_options_test.rb -- test/finder_test.rb -- test/helper.rb -- test/scope_test.rb -- test/scoped_test.rb -- test/update_all_test.rb -- test/with_scope_test.rb homepage: https://github.com/rails/activerecord-deprecated_finders -licenses: [] +licenses: +- MIT metadata: {} post_install_message: rdoc_options: [] @@ -101,30 +84,18 @@ - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - - '>=' + - - ">=" - !ruby/object:Gem::Version version: '0' required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - - '>=' + - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] rubyforge_project: -rubygems_version: 2.0.2 +rubygems_version: 2.4.5 signing_key: specification_version: 4 summary: This gem contains deprecated finder APIs extracted from Active Record. -test_files: -- test/associations_test.rb -- test/calculate_test.rb -- test/default_scope_test.rb -- test/dynamic_methods_test.rb -- test/find_in_batches_test.rb -- test/finder_options_test.rb -- test/finder_test.rb -- test/helper.rb -- test/scope_test.rb -- test/scoped_test.rb -- test/update_all_test.rb -- test/with_scope_test.rb +test_files: [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/associations_test.rb new/test/associations_test.rb --- old/test/associations_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/associations_test.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,91 +0,0 @@ -require 'helper' - -describe 'associations' do - before do - @klass = Class.new(ActiveRecord::Base) - def @klass.name; 'Post'; end - @klass.table_name = 'posts' - Appointment.delete_all - end - - it 'should respect find_by_anything method defined on the base class' do - physician = Physician.create! - - ActiveSupport::Deprecation.silence do - assert_equal [], physician.patients.find_by_custom_name - end - end - - it 'find_or_create_by on has_many through should work' do - physician = Physician.create! - ActiveSupport::Deprecation.silence do - physician.patients.find_or_create_by_name('Tim') - end - assert_equal 1, Appointment.count - end - - it 'find_or_create_by with bang on has_many through should work' do - physician = Physician.create! - ActiveSupport::Deprecation.silence do - physician.patients.find_or_create_by_name!('Tim') - end - assert_equal 1, Appointment.count - end - - it 'find_or_create_by on has_many should work' do - physician = Physician.create! - ActiveSupport::Deprecation.silence do - appointment = physician.appointments.find_or_create_by_status(status: 'active', week_day: 'sunday') - assert_equal appointment, physician.appointments.find_or_create_by_status(status: 'active', week_day: 'sunday') - end - end - - it 'translates hash scope options into scopes' do - assert_deprecated do - @klass.has_many :comments, readonly: 'a', order: 'b', limit: 'c', group: 'd', having: 'e', - offset: 'f', select: 'g', uniq: 'h', include: 'i', conditions: 'j' - end - - scope = @klass.new.comments - - scope.readonly_value.must_equal 'a' - scope.order_values.must_equal ['b'] - scope.limit_value.must_equal 'c' - scope.group_values.must_equal ['d'] - scope.having_values.must_equal ['e'] - scope.offset_value.must_equal 'f' - scope.select_values.must_equal ['g'] - scope.uniq_value.must_equal 'h' - scope.includes_values.must_equal ['i'] - scope.where_values.must_include 'j' - end - - it 'supports proc where values' do - ActiveSupport::Deprecation.silence do - @klass.has_many :comments, conditions: proc { 'omg' } - end - @klass.new.comments.where_values.must_include 'omg' - @klass.joins(:comments).to_sql.must_include 'omg' - end - - it 'supports proc where values which access the owner' do - ActiveSupport::Deprecation.silence do - @klass.has_many :comments, conditions: proc { title } - end - @klass.new(title: 'omg').comments.where_values.must_include 'omg' - end - - it "allows a declaration with a scope with no options" do - ActiveSupport::Deprecation.silence do - @klass.has_many :comments, -> { limit 5 } - end - scope = @klass.new.comments - scope.limit_value.must_equal 5 - end - - it "raises an ArgumentError when declaration uses both scope and deprecated options" do - assert_raises(ArgumentError) do - @klass.has_many :comments, -> { limit 5 }, :order=>'b' - end - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/calculate_test.rb new/test/calculate_test.rb --- old/test/calculate_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/calculate_test.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +0,0 @@ -require 'helper' - -describe 'calculate' do - after do - Post.destroy_all - end - - it 'supports finder options' do - Post.create id: 1 - Post.create id: 2, title: 'foo' - Post.create id: 3, title: 'foo' - - assert_deprecated { Post.calculate(:sum, :id, conditions: { title: 'foo' }) }.must_equal 5 - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/default_scope_test.rb new/test/default_scope_test.rb --- old/test/default_scope_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/default_scope_test.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,35 +0,0 @@ -require 'helper' - -describe 'default scope' do - before do - Post.create(id: 1, title: 'foo lol') - Post.create(id: 2, title: 'foo omg') - Post.create(id: 3) - - @klass = Class.new(Post) - @klass.table_name = 'posts' - end - - after do - Post.delete_all - end - - it 'works with a finder hash' do - assert_deprecated { @klass.default_scope conditions: { id: 1 } } - @klass.all.map(&:id).must_equal [1] - end - - it 'works with a finder hash and a scope' do - @klass.default_scope { @klass.where("title like '%foo%'") } - ActiveSupport::Deprecation.silence do - @klass.default_scope conditions: "title like '%omg%'" - end - - @klass.all.map(&:id).must_equal [2] - end - - it 'works with a block that returns a hash' do - @klass.default_scope { { conditions: { id: 1 } } } - assert_deprecated { @klass.all.to_a }.map(&:id).must_equal [1] - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/dynamic_methods_test.rb new/test/dynamic_methods_test.rb --- old/test/dynamic_methods_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/dynamic_methods_test.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,133 +0,0 @@ -require 'helper' - -describe 'dynamic_methods' do - before do - @posts = [ - Post.create(title: 'foo', category: '1'), - Post.create(title: 'bar', category: '1'), - Post.create(title: 'bar', category: '2') - ] - end - - after do - Post.delete_all - Comment.delete_all - end - - it 'supports find_all_by' do - assert_deprecated do - Post.find_all_by_title('bar').must_equal [@posts[1], @posts[2]] - Post.find_all_by_title_and_category('bar', '2').must_equal [@posts[2]] - end - end - - it 'supports find_all_by with finder options' do - assert_deprecated do - Post.find_all_by_title('bar', conditions: { category: '1' }).must_equal [@posts[1]] - end - end - - it 'supports find_last_by' do - assert_deprecated do - Post.find_last_by_title('foo').must_equal @posts[0] - Post.find_last_by_title('bar').must_equal @posts[2] - end - end - - it 'supports find_last_by with finder options' do - assert_deprecated do - Post.find_last_by_title('bar', conditions: { category: '1' }).must_equal @posts[1] - end - end - - it 'supports scoped_by' do - scope = assert_deprecated { Post.scoped_by_title('bar') } - scope.is_a?(ActiveRecord::Relation).must_equal true - scope.to_a.must_equal [@posts[1], @posts[2]] - end - - it 'supports find_or_initialize_by' do - assert_deprecated { Post.find_or_initialize_by_title_and_category('bar', '1').must_equal @posts[1] } - - post = assert_deprecated { Post.find_or_initialize_by_title_and_category('bar', '3') } - post.new_record?.must_equal true - post.title.must_equal 'bar' - post.category.must_equal '3' - end - - it 'supports find_or_create_by' do - assert_deprecated { Post.find_or_create_by_title_and_category('bar', '1').must_equal @posts[1] } - - post = assert_deprecated { Post.find_or_create_by_title_and_category('bar', '3') } - post.new_record?.must_equal false - post.title.must_equal 'bar' - post.category.must_equal '3' - end - - it 'supports find_or_create_by!' do - assert_deprecated { Post.find_or_create_by_title_and_category!('bar', '1').must_equal @posts[1] } - - post = assert_deprecated { Post.find_or_create_by_title_and_category!('bar', '3') } - post.new_record?.must_equal false - post.title.must_equal 'bar' - post.category.must_equal '3' - - klass = Class.new(ActiveRecord::Base) - def klass.name; 'Post'; end - klass.table_name = 'posts' - klass.validates_presence_of :category - - lambda { - ActiveSupport::Deprecation.silence { klass.find_or_create_by_title!('z') } - }.must_raise ActiveRecord::RecordInvalid - end - - it 'supports find_by with finder options' do - assert_deprecated do - Post.find_by_title('bar', conditions: { category: '2' }).must_equal @posts[2] - end - end - - it 'supports find_by! with finder options' do - assert_deprecated do - Post.find_by_title!('bar', conditions: { category: '2' }).must_equal @posts[2] - end - - lambda { - assert_deprecated { Post.find_by_title!('bar', conditions: { category: '3' }) } - }.must_raise ActiveRecord::RecordNotFound - end - - it 'supports find_by with a block' do - assert_deprecated do - Post.find_by_title('foo') { |r| [r, 'block'] }.must_equal [@posts[0], 'block'] - Post.find_by_title('baz') { |r| [r, 'block'] }.must_equal nil - end - end - - it 'supports find_by! with a block' do - assert_deprecated do - Post.find_by_title!('foo') { |r| [r, 'block'] }.must_equal [@posts[0], 'block'] - end - end - - it 'adds to an association when find_or_initialize_by is called' do - post = @posts.first - comment = ActiveSupport::Deprecation.silence { post.comments.find_or_initialize_by_title('omg') } - post.comments.must_equal [comment] - end - - it 'adds to an association when find_or_create_by is called' do - post = @posts.first - post.comments.load_target - - comment = ActiveSupport::Deprecation.silence { post.comments.find_or_create_by_title('omg') } - post.comments.must_equal [comment] - post.reload.comments.must_equal [comment] - end - - it "doesn't mess with method_missing for non-find_or_{initialize|create}_by methods" do - post = @posts.first - post.comments.lol.must_equal 'lol' - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/find_in_batches_test.rb new/test/find_in_batches_test.rb --- old/test/find_in_batches_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/find_in_batches_test.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,18 +0,0 @@ -require 'helper' - -describe 'find_in_batches' do - after do - Post.destroy_all - end - - it 'accepts finder options' do - foo = Post.create title: 'foo' - Post.create title: 'bar' - - assert_deprecated do - Post.find_in_batches(conditions: "title = 'foo'") do |records| - records.must_equal [foo] - end - end - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/finder_options_test.rb new/test/finder_options_test.rb --- old/test/finder_options_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/finder_options_test.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,80 +0,0 @@ -require 'helper' - -describe 'apply_finder_options' do - before do - @deprecation_behavior = ActiveSupport::Deprecation.behavior - ActiveSupport::Deprecation.behavior = :silence - end - - after do - ActiveSupport::Deprecation.behavior = @deprecation_behavior - end - - it 'is deprecated' do - assert_deprecated { Post.scoped.apply_finder_options(:conditions => 'foo') } - end - - it 'supports :conditions' do - scope = Post.scoped.apply_finder_options(:conditions => 'foo') - scope.where_values.must_equal ['foo'] - end - - it 'supports :include' do - scope = Post.scoped.apply_finder_options(:include => :foo) - scope.includes_values.must_equal [:foo] - end - - it 'supports :joins' do - scope = Post.scoped.apply_finder_options(:joins => :foo) - scope.joins_values.must_equal [:foo] - end - - it 'supports :limit' do - scope = Post.scoped.apply_finder_options(:limit => 5) - scope.limit_value.must_equal 5 - end - - it 'supports :offset' do - scope = Post.scoped.apply_finder_options(:offset => 5) - scope.offset_value.must_equal 5 - end - - it "does not support :references (as it's new in 4.0)" do - lambda { Post.scoped.apply_finder_options(references: :foo) }.must_raise ArgumentError - end - - it 'supports :order' do - scope = Post.scoped.apply_finder_options(:order => 'foo') - scope.order_values.must_equal ['foo'] - end - - it 'supports :select' do - scope = Post.scoped.apply_finder_options(:select => :foo) - scope.select_values.must_equal [:foo] - end - - it 'supports :readonly' do - scope = Post.scoped.apply_finder_options(:readonly => :foo) - scope.readonly_value.must_equal :foo - end - - it 'supports :group' do - scope = Post.scoped.apply_finder_options(:group => :foo) - scope.group_values.must_equal [:foo] - end - - it 'supports :having' do - scope = Post.scoped.apply_finder_options(:having => :foo) - scope.having_values.must_equal [:foo] - end - - it 'supports :from' do - scope = Post.scoped.apply_finder_options(:from => :foo) - scope.from_value.must_equal [:foo, nil] - end - - it 'supports :lock' do - scope = Post.scoped.apply_finder_options(:lock => true) - scope.lock_value.must_equal true - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/finder_test.rb new/test/finder_test.rb --- old/test/finder_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/finder_test.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,69 +0,0 @@ -require 'helper' - -describe 'finders' do - before do - @posts = 3.times.map { |i| Post.create id: i + 1 } - end - - after do - Post.delete_all - end - - it 'supports find(:all) with no options' do - assert_deprecated { Post.find(:all) }.must_equal @posts - end - - it 'supports find(:all) with options' do - assert_deprecated { Post.find(:all, conditions: 'id >= 2') }.must_equal [@posts[1], @posts[2]] - end - - it 'supports all with options' do - assert_deprecated { Post.all(conditions: 'id >= 2') }.must_equal [@posts[1], @posts[2]] - end - - it 'returns an array from all when there are options' do - posts = ActiveSupport::Deprecation.silence { Post.all(conditions: 'id >= 2') } - posts.class.must_equal Array - end - - it 'returns a relation from all when there are no options' do - posts = Post.all - posts.is_a?(ActiveRecord::Relation).must_equal true - end - - it 'deprecates #all on a relation' do - relation = Post.where('id >= 2') - assert_deprecated { relation.all }.must_equal [@posts[1], @posts[2]] - end - - it 'supports find(:first) with no options' do - assert_deprecated { Post.order(:id).find(:first) }.must_equal @posts.first - end - - it 'supports find(:first) with options' do - assert_deprecated { Post.order(:id).find(:first, conditions: 'id >= 2') }.must_equal @posts[1] - end - - it 'supports first with options' do - assert_deprecated { Post.order(:id).first(conditions: 'id >= 2') }.must_equal @posts[1] - end - - it 'supports find(:last) with no options' do - assert_deprecated { Post.order(:id).find(:last) }.must_equal @posts.last - end - - it 'supports find(:last) with options' do - assert_deprecated { Post.order(:id).find(:last, conditions: 'id <= 2') }.must_equal @posts[1] - end - - it 'supports last with options' do - assert_deprecated { Post.order(:id).last(conditions: 'id <= 2') }.must_equal @posts[1] - end - - it 'support find(1) etc with options' do - assert_deprecated do - Post.find(1, conditions: '1=1').must_equal Post.find(1) - lambda { Post.find(1, conditions: '0=1') }.must_raise(ActiveRecord::RecordNotFound) - end - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/helper.rb new/test/helper.rb --- old/test/helper.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/helper.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,68 +0,0 @@ -require 'bundler/setup' -require 'minitest/spec' -require 'minitest/autorun' -require 'active_record' -require 'active_record/deprecated_finders' - -ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') - -ActiveRecord::Schema.verbose = false -ActiveRecord::Schema.define do - create_table :posts do |t| - t.string :title - t.string :category - end - - create_table :comments do |t| - t.string :title - t.references :post - end - - create_table :appointments do |t| - t.integer :physician_id - t.integer :patient_id - t.string :week_day - t.string :status - end - - create_table :physicians do |t| - t.string :name - end - - create_table :patients do |t| - t.string :name - end -end - -class Post < ActiveRecord::Base - has_many :comments -end - -class Comment < ActiveRecord::Base - def self.lol - "lol" - end -end - -class Appointment < ActiveRecord::Base - belongs_to :physician - belongs_to :patient -end - -class Patient < ActiveRecord::Base - def self.find_by_custom_name - [] - end -end - -class Physician < ActiveRecord::Base - has_many :appointments - has_many :patients, through: :appointments -end - -require 'active_support/testing/deprecation' -ActiveSupport::Deprecation.debug = true - -class MiniTest::Spec - include ActiveSupport::Testing::Deprecation -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/scope_test.rb new/test/scope_test.rb --- old/test/scope_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/scope_test.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,17 +0,0 @@ -require 'helper' - -describe 'scope' do - before do - @klass = Class.new(ActiveRecord::Base) - end - - it 'supports a finder hash' do - assert_deprecated { @klass.scope :foo, conditions: :foo } - @klass.foo.where_values.must_equal [:foo] - end - - it 'supports a finder hash inside a callable' do - @klass.scope :foo, ->(v) { { conditions: v } } - assert_deprecated { @klass.foo(:bar) }.where_values.must_equal [:bar] - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/scoped_test.rb new/test/scoped_test.rb --- old/test/scoped_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/scoped_test.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +0,0 @@ -require 'helper' - -describe 'scoped' do - it 'accepts a deprecated conditions option' do - assert_deprecated { Post.scoped(conditions: :foo) }.where_values.must_equal [:foo] - end - - it 'accepts a deprecated include option' do - assert_deprecated { Post.scoped(include: :foo) }.includes_values.must_equal [:foo] - end - - it 'is deprecated' do - assert_deprecated { Post.scoped } - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/update_all_test.rb new/test/update_all_test.rb --- old/test/update_all_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/update_all_test.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,24 +0,0 @@ -require 'helper' - -describe 'update_all' do - after do - Post.destroy_all - end - - it 'supports conditions' do - foo = Post.create title: 'foo' - bar = Post.create title: 'bar' - - assert_deprecated { Post.update_all({ title: 'omg' }, title: 'foo') } - - foo.reload.title.must_equal 'omg' - bar.reload.title.must_equal 'bar' - end - - it 'supports limit and order' do - posts = 3.times.map { Post.create } - assert_deprecated { Post.update_all({ title: 'omg' }, nil, limit: 2, order: :id) } - - posts.each(&:reload).map(&:title).must_equal ['omg', 'omg', nil] - end -end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/test/with_scope_test.rb new/test/with_scope_test.rb --- old/test/with_scope_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/test/with_scope_test.rb 1970-01-01 01:00:00.000000000 +0100 @@ -1,36 +0,0 @@ -require 'helper' - -describe 'with_scope' do - before do - Post.create(id: 1, title: 'foo') - Post.create(id: 2, title: 'bar') - end - - after do - Post.delete_all - end - - it 'applies a scoping' do - assert_deprecated do - Post.with_scope(find: { conditions: { title: 'foo' } }) do - assert_equal [1], Post.all.map(&:id) - end - end - end - - it 'applies an exclusive scoping' do - ActiveSupport::Deprecation.silence do - Post.with_scope(find: { conditions: { title: 'foo' } }) do - Post.send(:with_exclusive_scope, find: { conditions: { title: 'bar' } }) do - assert_equal [2], Post.all.map(&:id) - end - end - end - end - - it 'gives a deprecation for #with_exclusive_scope' do - assert_deprecated do - Post.send(:with_exclusive_scope) {} - end - end -end ++++++ gem2rpm.yml ++++++ # --- # ## used by gem2rpm # :summary: this is a custom summary # ## used by gem2rpm # :description: |- # this is a custom description # # it can be multiline # ## used by gem2rpm # :license: MIT or Ruby # ## used by gem2rpm and gem_packages # :version_suffix: -x_y # ## used by gem2rpm and gem_packages # :disable_docs: true # ## used by gem2rpm # :disable_automatic_rdoc_dep: true # ## used by gem2rpm # :preamble: |- # BuildRequires: foobar # Requires: foobar # ## used by gem2rpm # :patches: # foo.patch: -p1 # bar.patch: # ## used by gem2rpm :sources: # - foo.desktop # - bar.desktop # :gem_install_args: '....' # ## used by gem2rpm # :pre_install: |- # %if 0%{?use_system_libev} # export USE_VENDORED_LIBEV="no" # %endif # ## used by gem2rpm # :post_install: |- # # delete custom files here or do other fancy stuff # install -D -m 0644 %{S:1} %{buildroot}%{_bindir}/gem2rpm-opensuse # ## used by gem2rpm # :testsuite_command: |- # (pushd %{buildroot}%{gem_base}/gems/%{mod_full_name} && rake test) # ## used by gem2rpm # :filelist: |- # /usr/bin/gem2rpm-opensuse # ## used by gem2rpm # :scripts: # :post: |- # /bin/echo foo # ## used by gem_packages # :main: # :preamble: |- # Requires: util-linux # Recommends: pwgen # :filelist: |- # /usr/bin/gem2rpm-opensuse # ## used by gem_packages # :custom: # apache: # :preamble: |- # Requires: ..... # :filelist: |- # /etc/apache2/conf.d/passenger.conf # :summary: Custom summary is optional # :description: |- # Custom description is optional # # bar # :post: |- # /bin/echo foo #