plucky 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.bundle/config +4 -0
- data/.gitignore +3 -1
- data/.travis.yml +2 -2
- data/Gemfile +13 -3
- data/Guardfile +13 -0
- data/README.md +1 -1
- data/Rakefile +3 -17
- data/examples/query.rb +1 -1
- data/lib/plucky.rb +13 -0
- data/lib/plucky/criteria_hash.rb +85 -56
- data/lib/plucky/normalizers/criteria_hash_key.rb +17 -0
- data/lib/plucky/normalizers/criteria_hash_value.rb +83 -0
- data/lib/plucky/normalizers/fields_value.rb +26 -0
- data/lib/plucky/normalizers/integer.rb +19 -0
- data/lib/plucky/normalizers/options_hash_key.rb +23 -0
- data/lib/plucky/normalizers/options_hash_value.rb +85 -0
- data/lib/plucky/normalizers/sort_value.rb +55 -0
- data/lib/plucky/options_hash.rb +56 -85
- data/lib/plucky/pagination/decorator.rb +3 -2
- data/lib/plucky/pagination/paginator.rb +15 -6
- data/lib/plucky/query.rb +93 -51
- data/lib/plucky/version.rb +1 -1
- data/script/criteria_hash.rb +21 -0
- data/{test → spec}/helper.rb +12 -8
- data/spec/plucky/criteria_hash_spec.rb +166 -0
- data/spec/plucky/normalizers/criteria_hash_key_spec.rb +37 -0
- data/spec/plucky/normalizers/criteria_hash_value_spec.rb +193 -0
- data/spec/plucky/normalizers/fields_value_spec.rb +45 -0
- data/spec/plucky/normalizers/integer_spec.rb +24 -0
- data/spec/plucky/normalizers/options_hash_key_spec.rb +23 -0
- data/spec/plucky/normalizers/options_hash_value_spec.rb +99 -0
- data/spec/plucky/normalizers/sort_value_spec.rb +94 -0
- data/spec/plucky/options_hash_spec.rb +64 -0
- data/{test/plucky/pagination/test_decorator.rb → spec/plucky/pagination/decorator_spec.rb} +8 -10
- data/spec/plucky/pagination/paginator_spec.rb +118 -0
- data/spec/plucky/query_spec.rb +839 -0
- data/spec/plucky_spec.rb +68 -0
- data/{test/test_symbol_operator.rb → spec/symbol_operator_spec.rb} +14 -16
- data/spec/symbol_spec.rb +9 -0
- metadata +58 -23
- data/test/plucky/pagination/test_paginator.rb +0 -120
- data/test/plucky/test_criteria_hash.rb +0 -359
- data/test/plucky/test_options_hash.rb +0 -302
- data/test/plucky/test_query.rb +0 -843
- data/test/test_plucky.rb +0 -48
- data/test/test_symbol.rb +0 -11
data/test/test_plucky.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class PluckyTest < Test::Unit::TestCase
|
4
|
-
context "Plucky" do
|
5
|
-
context ".to_object_id" do
|
6
|
-
setup do
|
7
|
-
@id = BSON::ObjectId.new
|
8
|
-
end
|
9
|
-
|
10
|
-
should "convert nil to nil" do
|
11
|
-
Plucky.to_object_id(nil).should be_nil
|
12
|
-
end
|
13
|
-
|
14
|
-
should "convert blank to nil" do
|
15
|
-
Plucky.to_object_id('').should be_nil
|
16
|
-
end
|
17
|
-
|
18
|
-
should "leave object id alone" do
|
19
|
-
Plucky.to_object_id(@id).should equal(@id)
|
20
|
-
end
|
21
|
-
|
22
|
-
should "convert string to object id" do
|
23
|
-
Plucky.to_object_id(@id.to_s).should == @id
|
24
|
-
end
|
25
|
-
|
26
|
-
should "not convert string that is not legal object id" do
|
27
|
-
Plucky.to_object_id('foo').should == 'foo'
|
28
|
-
Plucky.to_object_id(1).should == 1
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context "::Methods" do
|
33
|
-
should "return array of methods" do
|
34
|
-
Plucky::Methods.should == [
|
35
|
-
:where, :filter,
|
36
|
-
:sort, :order, :reverse,
|
37
|
-
:paginate, :per_page, :limit, :skip, :offset,
|
38
|
-
:fields, :ignore, :only,
|
39
|
-
:each, :find_each, :find_one, :find,
|
40
|
-
:count, :size, :distinct,
|
41
|
-
:last, :first, :all, :to_a,
|
42
|
-
:exists?, :exist?, :empty?,
|
43
|
-
:remove,
|
44
|
-
].sort_by(&:to_s)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
data/test/test_symbol.rb
DELETED