sortability 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e811a6edc06dbfee9c4432f0b81eec7a36aec4cf07e40e5604f397f84a62007f
4
- data.tar.gz: 172646fbe4de26f3def8354d671378a9fc5d6faea2b95757d0973c06c6e9de43
3
+ metadata.gz: 468cc73b34b9eeca08746606ce03659756b65e9743a2f94a84b3e91476684c3b
4
+ data.tar.gz: c351cb7e7185e39e2a40003d8e38a168bd09c7e7c85d24c15c54f164bacc82ed
5
5
  SHA512:
6
- metadata.gz: 6844492fe3c495616404aa9cf5edcda32fd8082d6c3a515f706e2b64710a9e8cc459c5845647d26ab8b9f65599af332bc56c085f0cae670072fddd8293cdfadb
7
- data.tar.gz: 118dd54f18ad0de05bab919d8f65dddeb0de04861fdb1b3be819ca57fce7b4b00a71531e407f3c37299ca19a293154d497c752293c7ba8093144be1a4f98f67e
6
+ metadata.gz: 7aad0bc50eb8804585962e1f713bbc3afdaad93c2f044a1dffb85a9d146f4ae082d57e94de16ae9a24a2d814174c80ba9eab360892b9103b2dbdf819f30bbe14
7
+ data.tar.gz: e4549124e9f4027510e7e034daa867c0362f1dcc9093bd40d25e474715746f371de7ffde0613b7b0c9e043c3ecc5c5641298596ab2fe3777bc51d06007b6a450
data/Rakefile CHANGED
@@ -1,18 +1,22 @@
1
+ #!/usr/bin/env rake
2
+ # http://viget.com/extend/rails-engine-testing-with-rspec-capybara-and-factorygirl
1
3
  begin
2
4
  require 'bundler/setup'
3
5
  rescue LoadError
4
6
  puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
7
  end
6
8
 
9
+ APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
10
+ load 'rails/tasks/engine.rake'
11
+
7
12
  Bundler::GemHelper.install_tasks
8
13
 
9
- require 'rake/testtask'
14
+ Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each { |file| load file }
10
15
 
11
- Rake::TestTask.new(:spec) do |t|
12
- t.libs << 'lib'
13
- t.libs << 'spec'
14
- t.pattern = 'spec/**/*_spec.rb'
15
- t.verbose = false
16
- end
16
+ require 'rspec/core'
17
+ require 'rspec/core/rake_task'
18
+
19
+ desc 'Run all specs in spec directory (excluding plugin specs)'
20
+ RSpec::Core::RakeTask.new(spec: 'app:db:test:prepare')
17
21
 
18
22
  task default: :spec
@@ -8,7 +8,7 @@ module Sortability
8
8
  module ClassMethods
9
9
  # Defines methods that are used to sort records
10
10
  # Use via sortable_belongs_to or sortable_class
11
- def sortable_methods(options = {})
11
+ def sortable_methods(**options)
12
12
  on = options[:on] || :sort_position
13
13
  container = options[:container]
14
14
  inverse_of = options[:inverse_of]
@@ -159,11 +159,11 @@ module Sortability
159
159
  end
160
160
 
161
161
  options[:container] = container
162
- sortable_methods(options)
162
+ sortable_methods(**options)
163
163
  end
164
164
 
165
165
  # Defines a sortable class without a container
166
- def sortable_class(options = {})
166
+ def sortable_class(**options)
167
167
  on = options[:on] || :sort_position
168
168
  scope = options[:scope]
169
169
 
@@ -176,7 +176,7 @@ module Sortability
176
176
  uniqueness: (scope.nil? ? true : { scope: scope })
177
177
  end
178
178
 
179
- sortable_methods(options)
179
+ sortable_methods(**options)
180
180
  end
181
181
 
182
182
  protected
@@ -3,11 +3,11 @@ module Sortability
3
3
  module ConnectionAdapters
4
4
  module TableDefinition
5
5
  # Adds a non-null sortable column on table creation (no index)
6
- def sortable(options = {})
6
+ def sortable(**options)
7
7
  options[:null] = false if options[:null].nil?
8
8
  on = options.delete(:on) || :sort_position
9
9
 
10
- integer on, options
10
+ integer on, **options
11
11
  end
12
12
  end
13
13
  end
@@ -2,21 +2,21 @@ module Sortability
2
2
  module ActiveRecord
3
3
  module Migration
4
4
  # Adds a non-null sortable column to an existing table (no index)
5
- def add_sortable_column(table, options = {})
5
+ def add_sortable_column(table, **options)
6
6
  options[:null] = false if options[:null].nil?
7
7
  on = options.delete(:on) || :sort_position
8
8
 
9
- add_column table, on, :integer, options
9
+ add_column table, on, :integer, **options
10
10
  end
11
11
 
12
12
  # Adds a unique index covering the sort scope cols in an existing table
13
- def add_sortable_index(table, options = {})
13
+ def add_sortable_index(table, **options)
14
14
  options[:unique] = true if options[:unique].nil?
15
15
  scope = options.delete(:scope)
16
16
  on = options.delete(:on) || :sort_position
17
17
  columns = ([scope] << on).flatten.compact
18
18
 
19
- add_index table, columns, options
19
+ add_index table, columns, **options
20
20
  end
21
21
  end
22
22
  end
@@ -1,3 +1,3 @@
1
1
  module Sortability
2
- VERSION = "1.1.0"
2
+ VERSION = '1.1.1'
3
3
  end
@@ -3,12 +3,12 @@ require File.expand_path('../boot', __FILE__)
3
3
  require 'rails/all'
4
4
 
5
5
  Bundler.require(*Rails.groups)
6
- require "sortability"
6
+ require 'sortability'
7
7
 
8
8
  module Dummy
9
9
  class Application < Rails::Application
10
10
  # Initialize configuration defaults for originally generated Rails version.
11
- config.load_defaults 5.2
11
+ config.load_defaults 6.1
12
12
 
13
13
  # Settings in config/environments/* take precedence over those specified here.
14
14
  # Application configuration should go into files in config/initializers
Binary file