closure_tree 5.2.0 → 6.0.0.alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +4 -19
- data/Appraisals +1 -9
- data/CHANGELOG.md +3 -0
- data/Gemfile +0 -1
- data/MIT-LICENSE +1 -1
- data/README.md +7 -29
- data/Rakefile +0 -9
- data/closure_tree.gemspec +3 -5
- data/gemfiles/activerecord_4.2.gemfile +0 -1
- data/gemfiles/activerecord_edge.gemfile +0 -1
- data/lib/closure_tree/digraphs.rb +2 -2
- data/lib/closure_tree/has_closure_tree.rb +1 -1
- data/lib/closure_tree/model.rb +1 -4
- data/lib/closure_tree/version.rb +1 -1
- data/spec/db/models.rb +1 -11
- data/spec/db/schema.rb +4 -7
- data/spec/label_spec.rb +6 -6
- data/spec/spec_helper.rb +5 -2
- data/spec/support/database.rb +2 -1
- data/spec/tag_examples.rb +11 -11
- metadata +12 -45
- data/gemfiles/activerecord_3.2.gemfile +0 -21
- data/gemfiles/activerecord_4.0.gemfile +0 -20
- data/spec/support/deprecated/attr_accessible.rb +0 -5
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: d7fc5558a4e6b00aab12761e615cd4fe3925ce3c
         | 
| 4 | 
            +
              data.tar.gz: baf418817e89ee4dbc66717627e4871eaed2134c
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ec01be25fc3f9c11c539c6892603839d33f77f4e4429653d3e3ba68c4548a0921f26311c9fe7cade4cf0c9bbee13ab00546b8e8b677d8e1b567379c8f3fb1458
         | 
| 7 | 
            +
              data.tar.gz: 2f9021c6d64f1d3d0436bcc6439113bdb12fe7d768ead39d6523498f0e03a2a6e5abf04cbfec607af82f8f512d552559d995b50f350ccc7095cee0207a476929
         | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/.travis.yml
    CHANGED
    
    | @@ -2,17 +2,10 @@ cache: bundler | |
| 2 2 | 
             
            sudo: false
         | 
| 3 3 | 
             
            language: ruby
         | 
| 4 4 | 
             
            rvm:
         | 
| 5 | 
            -
              -  | 
| 6 | 
            -
              -  | 
| 7 | 
            -
              - rbx-2
         | 
| 8 | 
            -
              - jruby-19mode
         | 
| 9 | 
            -
            #  - ruby-head
         | 
| 10 | 
            -
            #  - rbx-head
         | 
| 11 | 
            -
            #  - jruby-head
         | 
| 5 | 
            +
              - 2.2
         | 
| 6 | 
            +
              - jruby-head
         | 
| 12 7 |  | 
| 13 8 | 
             
            gemfile:
         | 
| 14 | 
            -
              - gemfiles/activerecord_3.2.gemfile
         | 
| 15 | 
            -
              - gemfiles/activerecord_4.0.gemfile
         | 
| 16 9 | 
             
              - gemfiles/activerecord_4.1.gemfile
         | 
| 17 10 | 
             
              - gemfiles/activerecord_4.2.gemfile
         | 
| 18 11 | 
             
              - gemfiles/activerecord_edge.gemfile
         | 
| @@ -22,24 +15,16 @@ env: | |
| 22 15 | 
             
              - DB=mysql
         | 
| 23 16 | 
             
              - DB=postgresql
         | 
| 24 17 |  | 
| 25 | 
            -
            addons:
         | 
| 26 | 
            -
              postgresql: "9.3"
         | 
| 18 | 
            +
            #addons:
         | 
| 19 | 
            +
            #  postgresql: "9.3"
         | 
| 27 20 |  | 
| 28 21 | 
             
            script: WITH_ADVISORY_LOCK_PREFIX=$TRAVIS_JOB_ID bundle exec rake --trace spec:all
         | 
| 29 22 |  | 
| 30 23 | 
             
            matrix:
         | 
| 31 24 | 
             
              allow_failures:
         | 
| 32 25 | 
             
                - gemfile: gemfiles/activerecord_edge.gemfile
         | 
| 33 | 
            -
                - rvm: rbx-2
         | 
| 34 | 
            -
                - rvm: jruby-19mode
         | 
| 35 | 
            -
                - rvm: ruby-head
         | 
| 36 | 
            -
                - rvm: rbx-head
         | 
| 37 26 | 
             
                - rvm: jruby-head
         | 
| 38 27 |  | 
| 39 28 | 
             
              exclude:
         | 
| 40 | 
            -
                - rvm: ruby-head
         | 
| 41 | 
            -
                  gemfile: gemfiles/activerecord_3.2.gemfile
         | 
| 42 | 
            -
                - rvm: ruby-head
         | 
| 43 | 
            -
                  gemfile: gemfiles/activerecord_4.0.gemfile
         | 
| 44 29 | 
             
                - rvm: ruby-head
         | 
| 45 30 | 
             
                  gemfile: gemfiles/activerecord_4.1.gemfile
         | 
    
        data/Appraisals
    CHANGED
    
    | @@ -1,14 +1,6 @@ | |
| 1 | 
            -
            appraise 'activerecord-3.2' do
         | 
| 2 | 
            -
              gem 'activerecord', '~> 3.2.0'
         | 
| 3 | 
            -
              gem 'strong_parameters'
         | 
| 4 | 
            -
            end
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            appraise 'activerecord-4.0' do
         | 
| 7 | 
            -
              gem 'activerecord', '~> 4.0.0'
         | 
| 8 | 
            -
            end
         | 
| 9 | 
            -
             | 
| 10 1 | 
             
            appraise 'activerecord-4.1' do
         | 
| 11 2 | 
             
              gem 'activerecord', '~> 4.1.0'
         | 
| 3 | 
            +
              gem 'foreigner', :git => 'https://github.com/matthuhiggins/foreigner.git'
         | 
| 12 4 | 
             
            end
         | 
| 13 5 |  | 
| 14 6 | 
             
            appraise 'activerecord-4.2' do
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/Gemfile
    CHANGED
    
    
    
        data/MIT-LICENSE
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -26,8 +26,8 @@ closure_tree has some great features: | |
| 26 26 | 
             
              * 2 SQL INSERTs on node creation
         | 
| 27 27 | 
             
              * 3 SQL INSERT/UPDATEs on node reparenting
         | 
| 28 28 | 
             
            * __Support for [concurrency](#concurrency)__ (using [with_advisory_lock](https://github.com/mceachen/with_advisory_lock))
         | 
| 29 | 
            -
            * __Support for  | 
| 30 | 
            -
            * __Support for Ruby  | 
| 29 | 
            +
            * __Support for ActiveRecord 4.1, 4.2 and 5.0.alpha__
         | 
| 30 | 
            +
            * __Support for Ruby 2.2 and JRuby 9000__
         | 
| 31 31 | 
             
            * Support for reparenting children (and all their descendants)
         | 
| 32 32 | 
             
            * Support for [single-table inheritance (STI)](#sti) within the hierarchy
         | 
| 33 33 | 
             
            * ```find_or_create_by_path``` for [building out heterogeneous hierarchies quickly and conveniently](#find_or_create_by_path)
         | 
| @@ -55,7 +55,7 @@ for a description of different tree storage algorithms. | |
| 55 55 |  | 
| 56 56 | 
             
            ## Installation
         | 
| 57 57 |  | 
| 58 | 
            -
            Note that closure_tree only supports  | 
| 58 | 
            +
            Note that closure_tree only supports ActiveRecord 4.1 and later, and has test coverage for MySQL, PostgreSQL, and SQLite.
         | 
| 59 59 |  | 
| 60 60 | 
             
            1.  Add `gem 'closure_tree'` to your Gemfile 
         | 
| 61 61 |  | 
| @@ -82,7 +82,7 @@ Note that closure_tree only supports Rails 3.2 and later, and has test coverage | |
| 82 82 | 
             
                to the [warning section](#warning)!
         | 
| 83 83 |  | 
| 84 84 | 
             
            4.  Add a migration to add a `parent_id` column to the hierarchical model.
         | 
| 85 | 
            -
                You may want to also [add a column for deterministic ordering of children](# | 
| 85 | 
            +
                You may want to also [add a column for deterministic ordering of children](#deterministic-ordering), but that's optional.
         | 
| 86 86 |  | 
| 87 87 | 
             
                ```ruby
         | 
| 88 88 | 
             
                class AddParentIdToTag < ActiveRecord::Migration
         | 
| @@ -339,27 +339,6 @@ class WhereTag < Tag ; end | |
| 339 339 | 
             
            class WhatTag < Tag ; end
         | 
| 340 340 | 
             
            ```
         | 
| 341 341 |  | 
| 342 | 
            -
            Please note that Rails (<= 3.2) doesn't handle polymorphic associations correctly if
         | 
| 343 | 
            -
            you use the ```:type``` attribute, so **this doesn't work**:
         | 
| 344 | 
            -
             | 
| 345 | 
            -
            ```ruby
         | 
| 346 | 
            -
            # BAD: ActiveRecord ignores the :type attribute:
         | 
| 347 | 
            -
            root.children.create(name: "child", type: "WhenTag")
         | 
| 348 | 
            -
            ```
         | 
| 349 | 
            -
             | 
| 350 | 
            -
            Instead, use either ```.add_child``` or ```children <<```:
         | 
| 351 | 
            -
             | 
| 352 | 
            -
            ```ruby
         | 
| 353 | 
            -
            # GOOD!
         | 
| 354 | 
            -
            a = Tag.create!(name: "a")
         | 
| 355 | 
            -
            b = WhenTag.new(name: "b")
         | 
| 356 | 
            -
            a.children << b
         | 
| 357 | 
            -
            c = WhatTag.new(name: "c")
         | 
| 358 | 
            -
            b.add_child(c)
         | 
| 359 | 
            -
            ```
         | 
| 360 | 
            -
             | 
| 361 | 
            -
            See [issue 43](https://github.com/mceachen/closure_tree/issues/43) for more information.
         | 
| 362 | 
            -
             | 
| 363 342 | 
             
            ## Deterministic ordering
         | 
| 364 343 |  | 
| 365 344 | 
             
            By default, children will be ordered by your database engine, which may not be what you want.
         | 
| @@ -559,10 +538,9 @@ end | |
| 559 538 |  | 
| 560 539 | 
             
            Closure tree is [tested under every valid combination](http://travis-ci.org/#!/mceachen/closure_tree) of
         | 
| 561 540 |  | 
| 562 | 
            -
            * Ruby  | 
| 563 | 
            -
            *  | 
| 564 | 
            -
            *  | 
| 565 | 
            -
            * The latest Rails 3.2, 4.0, 4.1 and master branches
         | 
| 541 | 
            +
            * Ruby 2.2 (and sometimes head)
         | 
| 542 | 
            +
            * jRuby 9000 (and sometimes head)
         | 
| 543 | 
            +
            * The latest ActiveRecord 4.1, 4.2, and master branch
         | 
| 566 544 | 
             
            * Concurrency tests for MySQL and PostgreSQL. SQLite is tested in a single-threaded environment.
         | 
| 567 545 |  | 
| 568 546 | 
             
            Assuming you're using [rbenv](https://github.com/sstephenson/rbenv), you can use ```tests.sh``` to
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -6,11 +6,6 @@ end | |
| 6 6 |  | 
| 7 7 | 
             
            Bundler::GemHelper.install_tasks
         | 
| 8 8 |  | 
| 9 | 
            -
            require 'yard'
         | 
| 10 | 
            -
            YARD::Rake::YardocTask.new do |t|
         | 
| 11 | 
            -
              t.files = ['lib/**/*.rb', 'README.md']
         | 
| 12 | 
            -
            end
         | 
| 13 | 
            -
             | 
| 14 9 | 
             
            require "rspec/core/rake_task"
         | 
| 15 10 | 
             
            RSpec::Core::RakeTask.new(:spec) do |task|
         | 
| 16 11 | 
             
              task.pattern = 'spec/*_spec.rb'
         | 
| @@ -27,10 +22,6 @@ namespace :spec do | |
| 27 22 | 
             
                  env = "DB_PREFIX=#{prefix} DB_SUFFIX=#{suffix}"
         | 
| 28 23 | 
             
                  fail unless system("#{rake} spec #{env}")
         | 
| 29 24 | 
             
                end
         | 
| 30 | 
            -
                require 'active_record/version'
         | 
| 31 | 
            -
                if ActiveRecord::VERSION::MAJOR == 3
         | 
| 32 | 
            -
                  fail unless system("#{rake} spec ATTR_ACCESSIBLE=1")
         | 
| 33 | 
            -
                end
         | 
| 34 25 | 
             
              end
         | 
| 35 26 |  | 
| 36 27 | 
             
              desc 'Run generator specs'
         | 
    
        data/closure_tree.gemspec
    CHANGED
    
    | @@ -14,15 +14,13 @@ Gem::Specification.new do |gem| | |
| 14 14 |  | 
| 15 15 | 
             
              gem.files       = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
         | 
| 16 16 | 
             
              gem.test_files  = gem.files.grep(%r{^spec/})
         | 
| 17 | 
            -
              gem.required_ruby_version = '>= 1. | 
| 17 | 
            +
              gem.required_ruby_version = '>= 2.1.0'
         | 
| 18 18 |  | 
| 19 | 
            -
              gem.add_runtime_dependency 'activerecord', '>=  | 
| 19 | 
            +
              gem.add_runtime_dependency 'activerecord', '>= 4.1.0'
         | 
| 20 20 | 
             
              gem.add_runtime_dependency 'with_advisory_lock', '>= 3.0.0'
         | 
| 21 21 |  | 
| 22 | 
            -
              gem.add_development_dependency 'yard'
         | 
| 23 22 | 
             
              gem.add_development_dependency 'rspec-instafail'
         | 
| 24 | 
            -
              gem.add_development_dependency 'rspec-rails', ' | 
| 25 | 
            -
              gem.add_development_dependency 'uuidtools'
         | 
| 23 | 
            +
              gem.add_development_dependency 'rspec-rails', '~> 3.2.3'
         | 
| 26 24 | 
             
              gem.add_development_dependency 'database_cleaner'
         | 
| 27 25 | 
             
              gem.add_development_dependency 'appraisal'
         | 
| 28 26 | 
             
              gem.add_development_dependency 'timecop'
         | 
| @@ -19,9 +19,9 @@ module ClosureTree | |
| 19 19 | 
             
                    output << "digraph G {\n"
         | 
| 20 20 | 
             
                    tree_scope.each do |ea|
         | 
| 21 21 | 
             
                      if id_to_instance.key? ea._ct_parent_id
         | 
| 22 | 
            -
                        output << "  #{ea._ct_parent_id} -> #{ea._ct_id}\n"
         | 
| 22 | 
            +
                        output << "  \"#{ea._ct_parent_id}\" -> \"#{ea._ct_id}\"\n"
         | 
| 23 23 | 
             
                      end
         | 
| 24 | 
            -
                      output << "  #{ea._ct_id} [label=\"#{ea.to_digraph_label}\"]\n"
         | 
| 24 | 
            +
                      output << "  \"#{ea._ct_id}\" [label=\"#{ea.to_digraph_label}\"]\n"
         | 
| 25 25 | 
             
                    end
         | 
| 26 26 | 
             
                    output << "}\n"
         | 
| 27 27 | 
             
                    output.string
         | 
| @@ -31,7 +31,7 @@ module ClosureTree | |
| 31 31 | 
             
                  include ClosureTree::NumericDeterministicOrdering if _ct.order_is_numeric?
         | 
| 32 32 | 
             
                rescue StandardError => e
         | 
| 33 33 | 
             
                  # Support Heroku's database-less assets:precompile pre-deploy step:
         | 
| 34 | 
            -
                  raise e unless ENV['DATABASE_URL'].to_s.include?('//user:pass@127.0.0.1/') | 
| 34 | 
            +
                  raise e unless ENV['DATABASE_URL'].to_s.include?('//user:pass@127.0.0.1/')
         | 
| 35 35 | 
             
                end
         | 
| 36 36 |  | 
| 37 37 | 
             
                alias_method :acts_as_tree, :has_closure_tree
         | 
    
        data/lib/closure_tree/model.rb
    CHANGED
    
    | @@ -11,9 +11,6 @@ module ClosureTree | |
| 11 11 | 
             
                             inverse_of: :children,
         | 
| 12 12 | 
             
                             touch: _ct.options[:touch]
         | 
| 13 13 |  | 
| 14 | 
            -
                  # TODO, remove when activerecord 3.2 support is dropped
         | 
| 15 | 
            -
                  attr_accessible :parent if _ct.use_attr_accessible?
         | 
| 16 | 
            -
             | 
| 17 14 | 
             
                  order_by_generations = "#{_ct.quoted_hierarchy_table_name}.generations asc"
         | 
| 18 15 |  | 
| 19 16 | 
             
                  has_many :children, *_ct.has_many_with_order_option(
         | 
| @@ -97,7 +94,7 @@ module ClosureTree | |
| 97 94 | 
             
                # to the +name_column+.
         | 
| 98 95 | 
             
                # (so child.ancestry_path == +%w{grandparent parent child}+
         | 
| 99 96 | 
             
                def ancestry_path(to_s_column = _ct.name_column)
         | 
| 100 | 
            -
                  self_and_ancestors. | 
| 97 | 
            +
                  self_and_ancestors.map { |n| n.send to_s_column.to_sym }.reverse
         | 
| 101 98 | 
             
                end
         | 
| 102 99 |  | 
| 103 100 | 
             
                def child_ids
         | 
    
        data/lib/closure_tree/version.rb
    CHANGED
    
    
    
        data/spec/db/models.rb
    CHANGED
    
    | @@ -1,9 +1,6 @@ | |
| 1 | 
            -
            require 'uuidtools'
         | 
| 2 | 
            -
             | 
| 3 1 | 
             
            class Tag < ActiveRecord::Base
         | 
| 4 2 | 
             
              has_closure_tree :dependent => :destroy, :order => :name
         | 
| 5 3 | 
             
              before_destroy :add_destroyed_tag
         | 
| 6 | 
            -
              attr_accessible :name, :title if _ct.use_attr_accessible?
         | 
| 7 4 |  | 
| 8 5 | 
             
              def to_s
         | 
| 9 6 | 
             
                name
         | 
| @@ -20,10 +17,9 @@ class UUIDTag < ActiveRecord::Base | |
| 20 17 | 
             
              before_create :set_uuid
         | 
| 21 18 | 
             
              has_closure_tree dependent: :destroy, order: 'name', parent_column_name: 'parent_uuid'
         | 
| 22 19 | 
             
              before_destroy :add_destroyed_tag
         | 
| 23 | 
            -
              attr_accessible :name, :title if _ct.use_attr_accessible?
         | 
| 24 20 |  | 
| 25 21 | 
             
              def set_uuid
         | 
| 26 | 
            -
                self.uuid =  | 
| 22 | 
            +
                self.uuid = SecureRandom.uuid
         | 
| 27 23 | 
             
              end
         | 
| 28 24 |  | 
| 29 25 | 
             
              def to_s
         | 
| @@ -37,7 +33,6 @@ class UUIDTag < ActiveRecord::Base | |
| 37 33 | 
             
            end
         | 
| 38 34 |  | 
| 39 35 | 
             
            class DestroyedTag < ActiveRecord::Base
         | 
| 40 | 
            -
              attr_accessible :name if Tag._ct.use_attr_accessible?
         | 
| 41 36 | 
             
            end
         | 
| 42 37 |  | 
| 43 38 | 
             
            class User < ActiveRecord::Base
         | 
| @@ -52,8 +47,6 @@ class User < ActiveRecord::Base | |
| 52 47 | 
             
                Contract.where(:user_id => descendant_ids)
         | 
| 53 48 | 
             
              end
         | 
| 54 49 |  | 
| 55 | 
            -
              attr_accessible :email, :referrer if _ct.use_attr_accessible?
         | 
| 56 | 
            -
             | 
| 57 50 | 
             
              def to_s
         | 
| 58 51 | 
             
                email
         | 
| 59 52 | 
             
              end
         | 
| @@ -69,8 +62,6 @@ class Label < ActiveRecord::Base | |
| 69 62 | 
             
                :parent_column_name => "mother_id",
         | 
| 70 63 | 
             
                :dependent => :destroy
         | 
| 71 64 |  | 
| 72 | 
            -
              attr_accessible :name if _ct.use_attr_accessible?
         | 
| 73 | 
            -
             | 
| 74 65 | 
             
              def to_s
         | 
| 75 66 | 
             
                "#{self.class}: #{name}"
         | 
| 76 67 | 
             
              end
         | 
| @@ -95,7 +86,6 @@ module Namespace | |
| 95 86 | 
             
              end
         | 
| 96 87 | 
             
              class Type < ActiveRecord::Base
         | 
| 97 88 | 
             
                has_closure_tree dependent: :destroy
         | 
| 98 | 
            -
                attr_accessible :name if _ct.use_attr_accessible?
         | 
| 99 89 | 
             
              end
         | 
| 100 90 | 
             
            end
         | 
| 101 91 |  | 
    
        data/spec/db/schema.rb
    CHANGED
    
    | @@ -7,8 +7,7 @@ ActiveRecord::Schema.define(:version => 0) do | |
| 7 7 | 
             
                t.string "title"
         | 
| 8 8 | 
             
                t.integer "parent_id"
         | 
| 9 9 | 
             
                t.integer "sort_order"
         | 
| 10 | 
            -
                t. | 
| 11 | 
            -
                t.datetime "updated_at"
         | 
| 10 | 
            +
                t.timestamps null: false
         | 
| 12 11 | 
             
              end
         | 
| 13 12 |  | 
| 14 13 | 
             
              add_foreign_key(:tags, :tags, :column => 'parent_id')
         | 
| @@ -28,8 +27,7 @@ ActiveRecord::Schema.define(:version => 0) do | |
| 28 27 | 
             
                t.string "title"
         | 
| 29 28 | 
             
                t.string "parent_uuid"
         | 
| 30 29 | 
             
                t.integer "sort_order"
         | 
| 31 | 
            -
                t. | 
| 32 | 
            -
                t.datetime "updated_at"
         | 
| 30 | 
            +
                t.timestamps null: false
         | 
| 33 31 | 
             
              end
         | 
| 34 32 |  | 
| 35 33 | 
             
              create_table "uuid_tag_hierarchies", :id => false do |t|
         | 
| @@ -48,8 +46,7 @@ ActiveRecord::Schema.define(:version => 0) do | |
| 48 46 | 
             
              create_table "users" do |t|
         | 
| 49 47 | 
             
                t.string "email"
         | 
| 50 48 | 
             
                t.integer "referrer_id"
         | 
| 51 | 
            -
                t. | 
| 52 | 
            -
                t.datetime "updated_at"
         | 
| 49 | 
            +
                t.timestamps null: false
         | 
| 53 50 | 
             
              end
         | 
| 54 51 |  | 
| 55 52 | 
             
              add_foreign_key(:users, :users, :column => 'referrer_id')
         | 
| @@ -129,7 +126,7 @@ ActiveRecord::Schema.define(:version => 0) do | |
| 129 126 | 
             
              create_table 'menu_items' do |t|
         | 
| 130 127 | 
             
                t.string 'name'
         | 
| 131 128 | 
             
                t.integer 'parent_id'
         | 
| 132 | 
            -
                t.timestamps
         | 
| 129 | 
            +
                t.timestamps null: false
         | 
| 133 130 | 
             
              end
         | 
| 134 131 |  | 
| 135 132 | 
             
              add_foreign_key(:menu_items, :menu_items, :column => 'parent_id')
         | 
    
        data/spec/label_spec.rb
    CHANGED
    
    | @@ -56,9 +56,9 @@ describe Label do | |
| 56 56 | 
             
                  b = a.add_child Label.new(name: 'b')
         | 
| 57 57 | 
             
                  c = b.add_child Label.new(name: 'c')
         | 
| 58 58 | 
             
                  a.destroy
         | 
| 59 | 
            -
                  expect(Label.exists?(a)).to be_falsey
         | 
| 60 | 
            -
                  expect(Label.exists?(b)).to be_falsey
         | 
| 61 | 
            -
                  expect(Label.exists?(c)).to be_falsey
         | 
| 59 | 
            +
                  expect(Label.exists?(a.id)).to be_falsey
         | 
| 60 | 
            +
                  expect(Label.exists?(b.id)).to be_falsey
         | 
| 61 | 
            +
                  expect(Label.exists?(c.id)).to be_falsey
         | 
| 62 62 | 
             
                end
         | 
| 63 63 |  | 
| 64 64 | 
             
                it "properly destroys descendents created with <<" do
         | 
| @@ -68,9 +68,9 @@ describe Label do | |
| 68 68 | 
             
                  c = Label.new(name: 'c')
         | 
| 69 69 | 
             
                  b.children << c
         | 
| 70 70 | 
             
                  a.destroy
         | 
| 71 | 
            -
                  expect(Label.exists?(a)).to be_falsey
         | 
| 72 | 
            -
                  expect(Label.exists?(b)).to be_falsey
         | 
| 73 | 
            -
                  expect(Label.exists?(c)).to be_falsey
         | 
| 71 | 
            +
                  expect(Label.exists?(a.id)).to be_falsey
         | 
| 72 | 
            +
                  expect(Label.exists?(b.id)).to be_falsey
         | 
| 73 | 
            +
                  expect(Label.exists?(c.id)).to be_falsey
         | 
| 74 74 | 
             
                end
         | 
| 75 75 | 
             
              end
         | 
| 76 76 |  | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | @@ -4,15 +4,18 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) | |
| 4 4 | 
             
            require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
         | 
| 5 5 | 
             
            require 'rspec'
         | 
| 6 6 | 
             
            require 'active_record'
         | 
| 7 | 
            -
            require 'foreigner'
         | 
| 8 7 | 
             
            require 'database_cleaner'
         | 
| 9 8 | 
             
            require 'closure_tree'
         | 
| 10 9 | 
             
            require 'closure_tree/test/matcher'
         | 
| 11 10 | 
             
            require 'tmpdir'
         | 
| 12 11 | 
             
            require 'timecop'
         | 
| 13 12 | 
             
            require 'forwardable'
         | 
| 14 | 
            -
            require 'securerandom'
         | 
| 15 13 | 
             
            require 'parallel'
         | 
| 14 | 
            +
            begin
         | 
| 15 | 
            +
              require 'foreigner'
         | 
| 16 | 
            +
            rescue LoadError
         | 
| 17 | 
            +
              #Foreigner is not needed in ActiveRecord 4.2+
         | 
| 18 | 
            +
            end
         | 
| 16 19 |  | 
| 17 20 | 
             
            Thread.abort_on_exception = true
         | 
| 18 21 |  | 
    
        data/spec/support/database.rb
    CHANGED
    
    | @@ -35,7 +35,8 @@ begin | |
| 35 35 | 
             
            end unless ENV['NONUKES']
         | 
| 36 36 |  | 
| 37 37 | 
             
            ActiveRecord::Base.establish_connection(config)
         | 
| 38 | 
            -
             | 
| 38 | 
            +
            # Drop this when support for ActiveRecord 4.1 is removed
         | 
| 39 | 
            +
            Foreigner.load if defined?(Foreigner)
         | 
| 39 40 |  | 
| 40 41 | 
             
            require "#{database_folder}/schema"
         | 
| 41 42 | 
             
            require "#{database_folder}/models"
         | 
    
        data/spec/tag_examples.rb
    CHANGED
    
    | @@ -610,17 +610,17 @@ shared_examples_for Tag do | |
| 610 610 | 
             
                    dot = tag_class.roots.first.to_dot_digraph
         | 
| 611 611 | 
             
                    expect(dot).to eq <<-DOT
         | 
| 612 612 | 
             
            digraph G {
         | 
| 613 | 
            -
              #{a} [label="a"]
         | 
| 614 | 
            -
              #{a} -> #{b1}
         | 
| 615 | 
            -
              #{b1} [label="b1"]
         | 
| 616 | 
            -
              #{a} -> #{b2}
         | 
| 617 | 
            -
              #{b2} [label="b2"]
         | 
| 618 | 
            -
              #{b1} -> #{c1}
         | 
| 619 | 
            -
              #{c1} [label="c1"]
         | 
| 620 | 
            -
              #{b2} -> #{c2}
         | 
| 621 | 
            -
              #{c2} [label="c2"]
         | 
| 622 | 
            -
              #{b2} -> #{c3}
         | 
| 623 | 
            -
              #{c3} [label="c3"]
         | 
| 613 | 
            +
              "#{a}" [label="a"]
         | 
| 614 | 
            +
              "#{a}" -> "#{b1}"
         | 
| 615 | 
            +
              "#{b1}" [label="b1"]
         | 
| 616 | 
            +
              "#{a}" -> "#{b2}"
         | 
| 617 | 
            +
              "#{b2}" [label="b2"]
         | 
| 618 | 
            +
              "#{b1}" -> "#{c1}"
         | 
| 619 | 
            +
              "#{c1}" [label="c1"]
         | 
| 620 | 
            +
              "#{b2}" -> "#{c2}"
         | 
| 621 | 
            +
              "#{c2}" [label="c2"]
         | 
| 622 | 
            +
              "#{b2}" -> "#{c3}"
         | 
| 623 | 
            +
              "#{c3}" [label="c3"]
         | 
| 624 624 | 
             
            }
         | 
| 625 625 | 
             
                    DOT
         | 
| 626 626 | 
             
                  end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: closure_tree
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 6.0.0.alpha
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Matthew McEachen
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2015-09-05 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activerecord
         | 
| @@ -16,14 +16,14 @@ dependencies: | |
| 16 16 | 
             
                requirements:
         | 
| 17 17 | 
             
                - - ">="
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version:  | 
| 19 | 
            +
                    version: 4.1.0
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 24 | 
             
                - - ">="
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version:  | 
| 26 | 
            +
                    version: 4.1.0
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: with_advisory_lock
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -38,20 +38,6 @@ dependencies: | |
| 38 38 | 
             
                - - ">="
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 40 | 
             
                    version: 3.0.0
         | 
| 41 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 42 | 
            -
              name: yard
         | 
| 43 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 44 | 
            -
                requirements:
         | 
| 45 | 
            -
                - - ">="
         | 
| 46 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 47 | 
            -
                    version: '0'
         | 
| 48 | 
            -
              type: :development
         | 
| 49 | 
            -
              prerelease: false
         | 
| 50 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 51 | 
            -
                requirements:
         | 
| 52 | 
            -
                - - ">="
         | 
| 53 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 54 | 
            -
                    version: '0'
         | 
| 55 41 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 56 42 | 
             
              name: rspec-instafail
         | 
| 57 43 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -70,30 +56,16 @@ dependencies: | |
| 70 56 | 
             
              name: rspec-rails
         | 
| 71 57 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 72 58 | 
             
                requirements:
         | 
| 73 | 
            -
                - - " | 
| 74 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 75 | 
            -
                    version: '3.1'
         | 
| 76 | 
            -
              type: :development
         | 
| 77 | 
            -
              prerelease: false
         | 
| 78 | 
            -
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 79 | 
            -
                requirements:
         | 
| 80 | 
            -
                - - ">="
         | 
| 81 | 
            -
                  - !ruby/object:Gem::Version
         | 
| 82 | 
            -
                    version: '3.1'
         | 
| 83 | 
            -
            - !ruby/object:Gem::Dependency
         | 
| 84 | 
            -
              name: uuidtools
         | 
| 85 | 
            -
              requirement: !ruby/object:Gem::Requirement
         | 
| 86 | 
            -
                requirements:
         | 
| 87 | 
            -
                - - ">="
         | 
| 59 | 
            +
                - - "~>"
         | 
| 88 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 89 | 
            -
                    version:  | 
| 61 | 
            +
                    version: 3.2.3
         | 
| 90 62 | 
             
              type: :development
         | 
| 91 63 | 
             
              prerelease: false
         | 
| 92 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 93 65 | 
             
                requirements:
         | 
| 94 | 
            -
                - - " | 
| 66 | 
            +
                - - "~>"
         | 
| 95 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 96 | 
            -
                    version:  | 
| 68 | 
            +
                    version: 3.2.3
         | 
| 97 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 98 70 | 
             
              name: database_cleaner
         | 
| 99 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -182,8 +154,6 @@ files: | |
| 182 154 | 
             
            - README.md
         | 
| 183 155 | 
             
            - Rakefile
         | 
| 184 156 | 
             
            - closure_tree.gemspec
         | 
| 185 | 
            -
            - gemfiles/activerecord_3.2.gemfile
         | 
| 186 | 
            -
            - gemfiles/activerecord_4.0.gemfile
         | 
| 187 157 | 
             
            - gemfiles/activerecord_4.1.gemfile
         | 
| 188 158 | 
             
            - gemfiles/activerecord_4.2.gemfile
         | 
| 189 159 | 
             
            - gemfiles/activerecord_edge.gemfile
         | 
| @@ -225,7 +195,6 @@ files: | |
| 225 195 | 
             
            - spec/spec_helper.rb
         | 
| 226 196 | 
             
            - spec/support/database.rb
         | 
| 227 197 | 
             
            - spec/support/database_cleaner.rb
         | 
| 228 | 
            -
            - spec/support/deprecated/attr_accessible.rb
         | 
| 229 198 | 
             
            - spec/support/hash_monkey_patch.rb
         | 
| 230 199 | 
             
            - spec/support/sqlite3_with_advisory_lock.rb
         | 
| 231 200 | 
             
            - spec/support_spec.rb
         | 
| @@ -246,15 +215,15 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 246 215 | 
             
              requirements:
         | 
| 247 216 | 
             
              - - ">="
         | 
| 248 217 | 
             
                - !ruby/object:Gem::Version
         | 
| 249 | 
            -
                  version: 1. | 
| 218 | 
            +
                  version: 2.1.0
         | 
| 250 219 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 251 220 | 
             
              requirements:
         | 
| 252 | 
            -
              - - " | 
| 221 | 
            +
              - - ">"
         | 
| 253 222 | 
             
                - !ruby/object:Gem::Version
         | 
| 254 | 
            -
                  version:  | 
| 223 | 
            +
                  version: 1.3.1
         | 
| 255 224 | 
             
            requirements: []
         | 
| 256 225 | 
             
            rubyforge_project: 
         | 
| 257 | 
            -
            rubygems_version: 2. | 
| 226 | 
            +
            rubygems_version: 2.4.5.1
         | 
| 258 227 | 
             
            signing_key: 
         | 
| 259 228 | 
             
            specification_version: 4
         | 
| 260 229 | 
             
            summary: Easily and efficiently make your ActiveRecord model support hierarchies
         | 
| @@ -276,7 +245,6 @@ test_files: | |
| 276 245 | 
             
            - spec/spec_helper.rb
         | 
| 277 246 | 
             
            - spec/support/database.rb
         | 
| 278 247 | 
             
            - spec/support/database_cleaner.rb
         | 
| 279 | 
            -
            - spec/support/deprecated/attr_accessible.rb
         | 
| 280 248 | 
             
            - spec/support/hash_monkey_patch.rb
         | 
| 281 249 | 
             
            - spec/support/sqlite3_with_advisory_lock.rb
         | 
| 282 250 | 
             
            - spec/support_spec.rb
         | 
| @@ -284,4 +252,3 @@ test_files: | |
| 284 252 | 
             
            - spec/tag_spec.rb
         | 
| 285 253 | 
             
            - spec/user_spec.rb
         | 
| 286 254 | 
             
            - spec/uuid_tag_spec.rb
         | 
| 287 | 
            -
            has_rdoc: 
         | 
| @@ -1,21 +0,0 @@ | |
| 1 | 
            -
            # This file was generated by Appraisal
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            source "https://rubygems.org"
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            gem "foreigner", :git => "https://github.com/matthuhiggins/foreigner.git"
         | 
| 6 | 
            -
            gem "activerecord", "~> 3.2.0"
         | 
| 7 | 
            -
            gem "strong_parameters"
         | 
| 8 | 
            -
             | 
| 9 | 
            -
            platforms :ruby, :rbx do
         | 
| 10 | 
            -
              gem "mysql2"
         | 
| 11 | 
            -
              gem "pg"
         | 
| 12 | 
            -
              gem "sqlite3"
         | 
| 13 | 
            -
            end
         | 
| 14 | 
            -
             | 
| 15 | 
            -
            platforms :jruby do
         | 
| 16 | 
            -
              gem "activerecord-jdbcmysql-adapter"
         | 
| 17 | 
            -
              gem "activerecord-jdbcpostgresql-adapter"
         | 
| 18 | 
            -
              gem "activerecord-jdbcsqlite3-adapter"
         | 
| 19 | 
            -
            end
         | 
| 20 | 
            -
             | 
| 21 | 
            -
            gemspec :path => "../"
         | 
| @@ -1,20 +0,0 @@ | |
| 1 | 
            -
            # This file was generated by Appraisal
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            source "https://rubygems.org"
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            gem "foreigner", :git => "https://github.com/matthuhiggins/foreigner.git"
         | 
| 6 | 
            -
            gem "activerecord", "~> 4.0.0"
         | 
| 7 | 
            -
             | 
| 8 | 
            -
            platforms :ruby, :rbx do
         | 
| 9 | 
            -
              gem "mysql2"
         | 
| 10 | 
            -
              gem "pg"
         | 
| 11 | 
            -
              gem "sqlite3"
         | 
| 12 | 
            -
            end
         | 
| 13 | 
            -
             | 
| 14 | 
            -
            platforms :jruby do
         | 
| 15 | 
            -
              gem "activerecord-jdbcmysql-adapter"
         | 
| 16 | 
            -
              gem "activerecord-jdbcpostgresql-adapter"
         | 
| 17 | 
            -
              gem "activerecord-jdbcsqlite3-adapter"
         | 
| 18 | 
            -
            end
         | 
| 19 | 
            -
             | 
| 20 | 
            -
            gemspec :path => "../"
         |