sunstone 5.1.0.1 → 5.1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arel/visitors/sunstone.rb +5 -1
- data/lib/sunstone/version.rb +1 -1
- data/test/active_record/query/order_test.rb +27 -0
- data/test/test_helper.rb +4 -4
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f44d08dc6bb1c700f32c5271ccab0db4fe069bc4
|
4
|
+
data.tar.gz: a442c4792155830be5fd507b479469e89adaddb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2221ec8ec6cb8a6b14d0d4d08b8639b611e0fefafcec97aa6ea6d0721933f124e930a8a77382de76ce9d57d31f17aa8ce9beca7175dfd5d64630fef86e030494
|
7
|
+
data.tar.gz: 0d588df4234c01d1a1272fc3620c592308fda785a56a0c2ac4939301be68678547eee8907e7f780f461e390cdafad84291fdbb9d16dfe429cebb750bb2ada623
|
@@ -461,6 +461,10 @@ module Arel
|
|
461
461
|
def visit_Arel_Nodes_Descending o, collector
|
462
462
|
{ visit(o.expr, collector) => :desc }
|
463
463
|
end
|
464
|
+
|
465
|
+
def visit_Arel_Nodes_RandomOrdering o, collector
|
466
|
+
:random
|
467
|
+
end
|
464
468
|
#
|
465
469
|
# def visit_Arel_Nodes_Group o, collector
|
466
470
|
# visit o.expr, collector
|
@@ -1036,4 +1040,4 @@ module Arel
|
|
1036
1040
|
end
|
1037
1041
|
end
|
1038
1042
|
end
|
1039
|
-
end
|
1043
|
+
end
|
data/lib/sunstone/version.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ActiveRecord::OrderTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
schema do
|
6
|
+
create_table "ships", limit: 100 do |t|
|
7
|
+
t.string "name", limit: 255
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class Ship < ActiveRecord::Base
|
12
|
+
end
|
13
|
+
|
14
|
+
test '::order(COLUMN)' do
|
15
|
+
webmock(:get, "/ships", { limit: 1, order: [{id: :asc}] }).to_return({
|
16
|
+
body: [{id: 42}].to_json
|
17
|
+
})
|
18
|
+
|
19
|
+
assert_equal 42, Ship.order(:id).first.id
|
20
|
+
end
|
21
|
+
|
22
|
+
# TODO: Uses Arel::Nodes::RandomOrdering from:
|
23
|
+
# https://github.com/malomalo/activerecord-sort
|
24
|
+
# which should probably go into arel-extensions?
|
25
|
+
test '::order(:random)'
|
26
|
+
|
27
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -27,16 +27,16 @@ $debugging = false
|
|
27
27
|
class ActiveSupport::TestCase
|
28
28
|
include WebMock::API
|
29
29
|
|
30
|
-
#
|
30
|
+
# File 'lib/active_support/testing/declarative.rb'
|
31
31
|
def self.test(name, &block)
|
32
|
-
test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym
|
33
|
-
defined =
|
32
|
+
test_name = "test_#{name.gsub(/\s+/, '_')}".to_sym
|
33
|
+
defined = method_defined? test_name
|
34
34
|
raise "#{test_name} is already defined in #{self}" if defined
|
35
35
|
if block_given?
|
36
36
|
define_method(test_name, &block)
|
37
37
|
else
|
38
38
|
define_method(test_name) do
|
39
|
-
|
39
|
+
skip "No implementation provided for #{name}"
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sunstone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.1.0.
|
4
|
+
version: 5.1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Bracy
|
@@ -295,6 +295,7 @@ files:
|
|
295
295
|
- test/active_record/query/count_test.rb
|
296
296
|
- test/active_record/query/distinct_test.rb
|
297
297
|
- test/active_record/query/find_test.rb
|
298
|
+
- test/active_record/query/order_test.rb
|
298
299
|
- test/active_record/query/where_test.rb
|
299
300
|
- test/active_record/query_test.rb
|
300
301
|
- test/schema_mock.rb
|
@@ -337,6 +338,7 @@ test_files:
|
|
337
338
|
- test/active_record/query/count_test.rb
|
338
339
|
- test/active_record/query/distinct_test.rb
|
339
340
|
- test/active_record/query/find_test.rb
|
341
|
+
- test/active_record/query/order_test.rb
|
340
342
|
- test/active_record/query/where_test.rb
|
341
343
|
- test/active_record/query_test.rb
|
342
344
|
- test/schema_mock.rb
|