post_json 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +194 -0
- data/Rakefile +21 -0
- data/lib/core_ext/abstract_adapter_extend.rb +16 -0
- data/lib/core_ext/active_record_relation_extend.rb +16 -0
- data/lib/core_ext/hash_extend.rb +36 -0
- data/lib/generators/post_json/install/install_generator.rb +32 -0
- data/lib/generators/post_json/install/templates/create_post_json_documents.rb +13 -0
- data/lib/generators/post_json/install/templates/create_post_json_dynamic_indexes.rb +9 -0
- data/lib/generators/post_json/install/templates/create_post_json_model_settings.rb +18 -0
- data/lib/generators/post_json/install/templates/create_procedures.rb +120 -0
- data/lib/generators/post_json/install/templates/enable_extensions.rb +28 -0
- data/lib/generators/post_json/install/templates/initializer.rb +9 -0
- data/lib/post_json.rb +56 -0
- data/lib/post_json/base.rb +278 -0
- data/lib/post_json/concerns/argument_methods.rb +33 -0
- data/lib/post_json/concerns/dynamic_index_methods.rb +34 -0
- data/lib/post_json/concerns/finder_methods.rb +343 -0
- data/lib/post_json/concerns/query_methods.rb +157 -0
- data/lib/post_json/concerns/settings_methods.rb +106 -0
- data/lib/post_json/dynamic_index.rb +99 -0
- data/lib/post_json/model_settings.rb +17 -0
- data/lib/post_json/query_translator.rb +48 -0
- data/lib/post_json/version.rb +3 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/assets/stylesheets/scaffold.css +56 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +30 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +26 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/post_json.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +56 -0
- data/spec/dummy/db/migrate/20131015022029_enable_extensions.rb +28 -0
- data/spec/dummy/db/migrate/20131015022030_create_procedures.rb +120 -0
- data/spec/dummy/db/migrate/20131015022031_create_post_json_model_settings.rb +18 -0
- data/spec/dummy/db/migrate/20131015022032_create_post_json_collections.rb +16 -0
- data/spec/dummy/db/migrate/20131015022033_create_post_json_documents.rb +13 -0
- data/spec/dummy/db/migrate/20131015022034_create_post_json_dynamic_indexes.rb +9 -0
- data/spec/dummy/db/structure.sql +311 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/models/base_spec.rb +393 -0
- data/spec/models/collection_spec.rb +27 -0
- data/spec/models/queries_spec.rb +164 -0
- data/spec/modules/argument_methods_spec.rb +17 -0
- data/spec/modules/query_methods_spec.rb +69 -0
- data/spec/spec_helper.rb +54 -0
- metadata +184 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Collection", :ignore do
|
4
|
+
let(:collection) { PostJson::Collection }
|
5
|
+
subject { collection }
|
6
|
+
|
7
|
+
context "initialize" do
|
8
|
+
before do
|
9
|
+
subject.initialize([{name: "Customers", use_timestamps: false}, {name: "Orders/", use_version_number: false}])
|
10
|
+
end
|
11
|
+
|
12
|
+
it { subject.where(name: "customers").first.use_timestamps.should be_false }
|
13
|
+
it { subject.where(name: "orders").first.use_version_number.should be_false }
|
14
|
+
end
|
15
|
+
|
16
|
+
# context "empty database" do
|
17
|
+
|
18
|
+
# it { should respond_to(:create).with(2).arguments }
|
19
|
+
# it { should respond_to(:all_names).with(0).arguments }
|
20
|
+
# it { should respond_to(:[]).with(1).argument }
|
21
|
+
# it { should respond_to(:initialize).with(1).argument }
|
22
|
+
# it { should respond_to(:destroy_all!).with(0).arguments }
|
23
|
+
# it { should respond_to(:fake_it).with(1).argument }
|
24
|
+
# end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
@@ -0,0 +1,164 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Query" do
|
4
|
+
let(:named_collection) { PostJson::Collection["devs"] }
|
5
|
+
|
6
|
+
context "empty named collection" do
|
7
|
+
subject { named_collection }
|
8
|
+
|
9
|
+
its(:any?) { should be_false }
|
10
|
+
its(:blank?) { should be_false }
|
11
|
+
it { subject.all.blank? == true }
|
12
|
+
its(:count) { should == 0 }
|
13
|
+
it { subject.delete("not_exists").should == 0 }
|
14
|
+
it { subject.delete_all.should == 0 }
|
15
|
+
it { expect { subject.destroy("not_exists") }.to raise_error(ActiveRecord::RecordNotFound) }
|
16
|
+
it { subject.destroy_all.should == [] }
|
17
|
+
it { subject.all.empty?.should be_true }
|
18
|
+
its(:exists?) { should be_false }
|
19
|
+
it { expect { subject.find("not_exists") }.to raise_error(ActiveRecord::RecordNotFound) }
|
20
|
+
it { subject.find_by(id: "not_exists").should be_nil }
|
21
|
+
it { expect { subject.find_by!(id: "not_exists") }.to raise_error(ActiveRecord::RecordNotFound) }
|
22
|
+
its(:first) { should be_nil }
|
23
|
+
it { expect { subject.first! }.to raise_error(ActiveRecord::RecordNotFound) }
|
24
|
+
it { subject.first_or_create.id.should match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/) }
|
25
|
+
it { subject.first_or_create(name: "Jacob").name.should == "Jacob" }
|
26
|
+
it { subject.where(age: 33).first_or_create.id.should match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/) }
|
27
|
+
it { subject.where(age: 33).first_or_create(name: "Jacob").to_h.slice(:age, :name).should == {"age" => 33, "name" => "Jacob"} }
|
28
|
+
its(:ids) { should == [] }
|
29
|
+
its(:last) { should be_nil }
|
30
|
+
it { expect { subject.last! }.to raise_error(ActiveRecord::RecordNotFound) }
|
31
|
+
its(:many?) { should be_false }
|
32
|
+
its(:select) { should == [] }
|
33
|
+
it { subject.all.size == 0 }
|
34
|
+
its(:take) { should be_nil }
|
35
|
+
it { expect { subject.take! }.to raise_error(ActiveRecord::RecordNotFound) }
|
36
|
+
it { subject.all.to_a == [] }
|
37
|
+
its(:pluck) { should == [] }
|
38
|
+
it { subject.all.where_values_hash == {} }
|
39
|
+
end
|
40
|
+
|
41
|
+
context "named collection with 1 document" do
|
42
|
+
subject { named_collection }
|
43
|
+
let(:doc_id) { "devs/123" }
|
44
|
+
before do
|
45
|
+
subject.create age: 33, name: "Jacob", id: doc_id
|
46
|
+
end
|
47
|
+
|
48
|
+
its(:any?) { should be_true }
|
49
|
+
its(:blank?) { should be_false }
|
50
|
+
its(:count) { should == 1 }
|
51
|
+
it { subject.delete(doc_id).should == 1 }
|
52
|
+
it { subject.delete_all.should == 1 }
|
53
|
+
it { subject.destroy(doc_id).id.should == doc_id }
|
54
|
+
it { expect { subject.destroy("not_exists") }.to raise_error(ActiveRecord::RecordNotFound) }
|
55
|
+
it { subject.destroy_all.length == 0 }
|
56
|
+
it { subject.destroy_all[0].id.should == doc_id }
|
57
|
+
it { subject.all.empty?.should be_false }
|
58
|
+
its(:exists?) { should be_true }
|
59
|
+
it { subject.find(doc_id).id.should == doc_id }
|
60
|
+
it { expect { subject.find("not_exists") }.to raise_error(ActiveRecord::RecordNotFound) }
|
61
|
+
it { subject.find_by(id: doc_id).id.should == doc_id }
|
62
|
+
it { subject.find_by(id: "not_exists").should be_nil }
|
63
|
+
it { subject.find_by!(id: doc_id).id.should == doc_id }
|
64
|
+
it { expect { subject.find_by!(id: "not_exists") }.to raise_error(ActiveRecord::RecordNotFound) }
|
65
|
+
it { subject.first.id.should == doc_id }
|
66
|
+
it { subject.first!.id.should == doc_id }
|
67
|
+
it { subject.first_or_create.id.should == doc_id }
|
68
|
+
it { subject.first_or_create(name: "Martin").name.should == "Jacob" }
|
69
|
+
it { subject.where(age: 33).first_or_create.id.should == doc_id }
|
70
|
+
it { subject.where(age: 33).first_or_create(name: "Martin").to_h.slice(:age, :name).should == {"age" => 33, "name" => "Jacob"} }
|
71
|
+
its(:ids) { should == [doc_id] }
|
72
|
+
it { subject.last.id.should == doc_id }
|
73
|
+
its(:many?) { should be_false }
|
74
|
+
its(:select) { should == [] }
|
75
|
+
it { subject.all.size == 0 }
|
76
|
+
it { subject.take.id.should == doc_id }
|
77
|
+
it { subject.take!.id.should == doc_id }
|
78
|
+
it { subject.all.to_a[0].id.should == doc_id }
|
79
|
+
its(:pluck) { should == [] }
|
80
|
+
it { subject.all.where_values_hash == {} }
|
81
|
+
end
|
82
|
+
|
83
|
+
context "named collection with 3 documents" do
|
84
|
+
subject { named_collection }
|
85
|
+
|
86
|
+
before do
|
87
|
+
subject.create age: 33, name: "Jacob", details: {favorite: "green", height: 185}
|
88
|
+
subject.create age: 33, name: "Jonathan", details: {favorite: "yellow", height: 186}
|
89
|
+
subject.create age: 29, name: "Martin", details: {favorite: "blue", height: 187}
|
90
|
+
end
|
91
|
+
|
92
|
+
its(:count) { should == 3 }
|
93
|
+
its(:exists?) { should == "1" }
|
94
|
+
it { subject.all.empty?.should be_false }
|
95
|
+
it { subject.limit(1).except(:limit).count.should == 3 }
|
96
|
+
it { subject.offset(1).limit(1).except(:limit).count.should == 2 }
|
97
|
+
it { subject.offset(1).limit(1).except(:offset).count.should == 1 }
|
98
|
+
it { subject.offset(1).limit(1).except(:limit, :offset).count.should == 3 }
|
99
|
+
it { expect { subject.page(-1, 2).count.should == 0 }.to raise_error(ActiveRecord::StatementInvalid) }
|
100
|
+
it { subject.page(1, 2).count.should == 2 }
|
101
|
+
it { subject.page(2, 2).count.should == 1 }
|
102
|
+
it { subject.page(3, 2).count.should == 0 }
|
103
|
+
it { subject.where("function(body) { return body['age'] == 33; }").count.should == 2 }
|
104
|
+
it { subject.where("function(body, age) { return body['age'] == age; }", 29).count.should == 1 }
|
105
|
+
it { subject.where("function(body, age) { return body['age'] == age; }", [29]).count.should == 1 }
|
106
|
+
it { subject.where("function(body, age) { return body['age'] == age; }", "29").count.should == 1 }
|
107
|
+
it { subject.where("function(body, age) { return body['age'] == age; }", ["29"]).count.should == 1 }
|
108
|
+
it { subject.where("function(body) { return body['age'] == 33; }").where("function(body) { return body['name'] == 'Jacob'; }").count.should == 1 }
|
109
|
+
it { subject.where('function(body) { return body["age"] == "33"; }').count.should == 2 }
|
110
|
+
it { subject.where('function(body) { return body["name"] == "Jacob"; }').first.age.should == 33 }
|
111
|
+
it { subject.order('age asc').first.name.should == "Martin" }
|
112
|
+
it { subject.order('age desc').first.name.should == "Jacob" }
|
113
|
+
it { subject.order('name asc').first.name.should == "Jacob" }
|
114
|
+
it { subject.order('name desc').first.name.should == "Martin" }
|
115
|
+
it { subject.order('name desc, age desc').select("name").should == [{"name"=>"Jonathan"}, {"name"=>"Jacob"}, {"name"=>"Martin"}] }
|
116
|
+
it { subject.order('details.favorite desc').select("details.height").should == [{"details"=>{"height"=>186}}, {"details"=>{"height"=>185}}, {"details"=>{"height"=>187}}] }
|
117
|
+
it { subject.order('name desc, details.favorite desc').select("details.height, name").should == [{"details"=>{"height"=>186}, "name"=>"Jonathan"}, {"details"=>{"height"=>185}, "name"=>"Jacob"}, {"details"=>{"height"=>187}, "name"=>"Martin"}] }
|
118
|
+
it { expect { subject.order('name').page(-1, 2).select("name").should == [] }.to raise_error(ActiveRecord::StatementInvalid) }
|
119
|
+
it { subject.order('name').page(1, 2).select("name").should == [{"name"=>"Jacob"}, {"name"=>"Jonathan"}] }
|
120
|
+
it { subject.order('name').page(2, 2).select("name").should == [{"name"=>"Martin"}] }
|
121
|
+
it { subject.order('name').page(3, 2).select("name").should == [] }
|
122
|
+
it { subject.order('name').select({"person.name" => "name", "person.height" => "details.height"}).should == [{"person"=>{"name"=>"Jacob", "height"=>185}}, {"person"=>{"name"=>"Jonathan", "height"=>186}}, {"person"=>{"name"=>"Martin", "height"=>187}}] }
|
123
|
+
it { subject.order('name').select({person: {first_name: :name, height: "details.height"}}).should == [{"person"=>{"first_name"=>"Jacob", "height"=>185}}, {"person"=>{"first_name"=>"Jonathan", "height"=>186}}, {"person"=>{"first_name"=>"Martin", "height"=>187}}] }
|
124
|
+
it { subject.order(:name, :age).pluck("name, details.height").should == [["Martin", 187], ["Jacob", 185], ["Jonathan", 186]] }
|
125
|
+
it { subject.order(:age).pluck(:age).should == [29, 33, 33] }
|
126
|
+
it { subject.pluck.should == [] }
|
127
|
+
it { subject.select.should == [] }
|
128
|
+
it { subject.order(:name, :age).pluck(:age, :name).should == [[29, "Martin"], [33, "Jacob"], [33, "Jonathan"]] }
|
129
|
+
it { subject.find(subject.first.id).should == subject.first }
|
130
|
+
it { subject.find_by(age: 29).name.should == "Martin" }
|
131
|
+
it { subject.find_by(name: "Martin").age.should == 29 }
|
132
|
+
it { subject.find_by(age: 29, name: "Martin").age.should == 29 }
|
133
|
+
it { subject.where(age: 29).pluck(:name).should == ["Martin"] }
|
134
|
+
it { subject.where(age: "29", name: "Martin").pluck(:name).should == ["Martin"] }
|
135
|
+
it { subject.where(details: {height: 187, favorite: "blue"}).pluck(:name).should == ["Martin"] }
|
136
|
+
it { subject.order(:age).reverse.limit(1).pluck(:age).should == [33] }
|
137
|
+
it { subject.order(:name, :age).reverse.limit(1).pluck(:name).should == ["Jonathan"] }
|
138
|
+
it { subject.order(:age).last.age.should == 33 }
|
139
|
+
it { subject.order("age desc").last.age.should == 29 }
|
140
|
+
it { subject.order(:name).reverse.first.name.should == "Martin" }
|
141
|
+
it { subject.order("name desc").reverse.first.name.should == "Jacob" }
|
142
|
+
it { subject.order(:name, :age).last.name.should == "Jonathan" }
|
143
|
+
it { subject.order(:name, "age desc").last.name.should == "Martin" }
|
144
|
+
it { subject.where(details: {height: 185..186}).order('name').pluck('name').should == ["Jacob", "Jonathan"] }
|
145
|
+
it { subject.where(details: {favorite: "blue".."green"}).order('name').pluck('name').should == ["Jacob", "Martin"] }
|
146
|
+
|
147
|
+
|
148
|
+
context "and delete 1 document" do
|
149
|
+
before do
|
150
|
+
id = subject.first.id
|
151
|
+
subject.delete(id)
|
152
|
+
end
|
153
|
+
its(:count) { should == 2 }
|
154
|
+
end
|
155
|
+
|
156
|
+
context "and delete 2 documents" do
|
157
|
+
before do
|
158
|
+
ids = subject.limit(2).pluck("id")
|
159
|
+
subject.delete(ids)
|
160
|
+
end
|
161
|
+
its(:count) { should == 1 }
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Argument Methods" do
|
4
|
+
subject do
|
5
|
+
klass = Class.new do
|
6
|
+
include PostJson::ArgumentMethods
|
7
|
+
end
|
8
|
+
klass.new
|
9
|
+
end
|
10
|
+
|
11
|
+
it { subject.join_arguments(" a , b ").should == "a,b"}
|
12
|
+
it { subject.join_arguments([" a , b "]).should == "a,b"}
|
13
|
+
it { subject.join_arguments(" a a , b b ").should == "a a,b b"}
|
14
|
+
it { subject.join_arguments([" a a , b b "]).should == "a a,b b"}
|
15
|
+
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Query Methods" do
|
4
|
+
subject do
|
5
|
+
klass = Class.new do
|
6
|
+
include PostJson::QueryMethods
|
7
|
+
end
|
8
|
+
klass.new
|
9
|
+
end
|
10
|
+
|
11
|
+
its(:query_tree) { should == {} }
|
12
|
+
its(:query_clone) { should_not equal(subject) }
|
13
|
+
|
14
|
+
context "tree with context" do
|
15
|
+
before do
|
16
|
+
subject.query_tree[:original] = "tree"
|
17
|
+
end
|
18
|
+
|
19
|
+
its(:query_tree) { should == {original: "tree"} }
|
20
|
+
end
|
21
|
+
|
22
|
+
context "cloned tree" do
|
23
|
+
before do
|
24
|
+
subject.query_clone.query_tree[:original] = "tree"
|
25
|
+
end
|
26
|
+
|
27
|
+
its(:query_tree) { should == {} }
|
28
|
+
it { subject.query_clone.class.should equal(subject.class)}
|
29
|
+
end
|
30
|
+
|
31
|
+
context "directly added query" do
|
32
|
+
before do
|
33
|
+
subject.add_query("directly", "works")
|
34
|
+
end
|
35
|
+
|
36
|
+
its(:query_tree) { should == {"directly" => ["works"]}}
|
37
|
+
end
|
38
|
+
|
39
|
+
context "except and only" do
|
40
|
+
before do
|
41
|
+
subject.offset!(1).limit!(1)
|
42
|
+
end
|
43
|
+
|
44
|
+
it { subject.except(:offset).query_tree.should == {limit: [1]}}
|
45
|
+
it { subject.except(:limit).query_tree.should == {offset: [1]}}
|
46
|
+
it { subject.only(:offset).query_tree.should == {offset: [1]}}
|
47
|
+
it { subject.only(:limit).query_tree.should == {limit: [1]}}
|
48
|
+
end
|
49
|
+
|
50
|
+
it { subject.limit(1).query_tree.should == {limit: [1]}}
|
51
|
+
it { subject.limit(1).limit(3).query_tree.should == {limit: [3]}}
|
52
|
+
it { subject.offset(1).query_tree.should == {offset: [1]}}
|
53
|
+
it { subject.offset(1).offset(3).query_tree.should == {offset: [3]}}
|
54
|
+
it { subject.page(3, 25).query_tree.should == {limit: [25], offset: [50]}}
|
55
|
+
it { subject.page(3, 25).page(2, 20).query_tree.should == {limit: [20], offset: [20]}}
|
56
|
+
it { subject.order(:id).query_tree.should == {order: ["id ASC"]}}
|
57
|
+
it { subject.order("id desc").query_tree.should == {order: ["id DESC"]}}
|
58
|
+
it { subject.order(:id, :name).query_tree.should == {order: ["id ASC", "name ASC"]}}
|
59
|
+
it { subject.order([:id, :name]).query_tree.should == {order: ["id ASC", "name ASC"]}}
|
60
|
+
it { subject.order("id DESC", :name).query_tree.should == {order: ["id DESC", "name ASC"]}}
|
61
|
+
it { subject.order(:id).reorder(:name).query_tree.should == {order: ["name ASC"]}}
|
62
|
+
it { subject.order("id DESC", :name).reverse_order.query_tree.should == {order: ["id ASC", "name DESC"]}}
|
63
|
+
it { subject.where("function(doc) { return true; }").query_tree.should == {where_function: [{:function=>"function(doc) { return true; }", :arguments=>[]}]} }
|
64
|
+
it { subject.where("name = ?", "Jacob").query_tree.should == {where_forward: [["name = ?", "Jacob"]]} }
|
65
|
+
it { subject.where({name: "Jacob"}).query_tree.should == {where_equal: [{:attribute=>"name", :argument=>"Jacob"}]} }
|
66
|
+
it { subject.where({person: {name: "Jacob"}}).query_tree.should == {where_equal: [{:attribute=>"person.name", :argument=>"Jacob"}]} }
|
67
|
+
it { {p:{n:1,o:{c:2}}}.flatten_hash.should == {"p.n"=>1, "p.o.c"=>2} }
|
68
|
+
end
|
69
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
#http://stackoverflow.com/questions/8507798/rails-3-1-plugin-gem-dummy-test-app-rspec
|
2
|
+
|
3
|
+
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
4
|
+
ENV["RAILS_ENV"] ||= 'test'
|
5
|
+
require File.expand_path("../dummy/config/environment", __FILE__)
|
6
|
+
require 'rspec/rails'
|
7
|
+
require 'rspec/autorun'
|
8
|
+
|
9
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
10
|
+
# in spec/support/ and its subdirectories.
|
11
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
12
|
+
|
13
|
+
# Checks for pending migrations before tests are run.
|
14
|
+
# If you are not using ActiveRecord, you can remove this line.
|
15
|
+
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
|
16
|
+
|
17
|
+
RSpec.configure do |config|
|
18
|
+
# ## Mock Framework
|
19
|
+
#
|
20
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
21
|
+
#
|
22
|
+
# config.mock_with :mocha
|
23
|
+
# config.mock_with :flexmock
|
24
|
+
# config.mock_with :rr
|
25
|
+
|
26
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
27
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
28
|
+
|
29
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
30
|
+
# examples within a transaction, remove the following line or assign false
|
31
|
+
# instead of true.
|
32
|
+
config.use_transactional_fixtures = true
|
33
|
+
|
34
|
+
# If true, the base class of anonymous controllers will be inferred
|
35
|
+
# automatically. This will be the default behavior in future versions of
|
36
|
+
# rspec-rails.
|
37
|
+
config.infer_base_class_for_anonymous_controllers = false
|
38
|
+
|
39
|
+
# Run specs in random order to surface order dependencies. If you find an
|
40
|
+
# order dependency and want to debug it, you can fix the order by providing
|
41
|
+
# the seed, which is printed after each run.
|
42
|
+
# --seed 1234
|
43
|
+
|
44
|
+
#config.order = "random"
|
45
|
+
|
46
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
47
|
+
config.filter_run focus: true
|
48
|
+
config.filter_run_excluding :ignore => true
|
49
|
+
config.run_all_when_everything_filtered = true
|
50
|
+
|
51
|
+
config.fail_fast = true
|
52
|
+
end
|
53
|
+
|
54
|
+
#ActiveRecord::Base.logger = Logger.new(STDOUT)
|
metadata
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: post_json
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jacob Madsen and Martin Thoegersen
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: uuidtools
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.1.4
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.1.4
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: hashie
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.0.5
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.0.5
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pg
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-rails
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.0'
|
83
|
+
description: Great Document Database by combining features of Ruby, ActiveRecord and
|
84
|
+
PostgreSQL with PLV8
|
85
|
+
email:
|
86
|
+
- hello@webnuts.com
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- lib/core_ext/hash_extend.rb
|
92
|
+
- lib/core_ext/active_record_relation_extend.rb
|
93
|
+
- lib/core_ext/abstract_adapter_extend.rb
|
94
|
+
- lib/post_json.rb
|
95
|
+
- lib/generators/post_json/install/templates/create_procedures.rb
|
96
|
+
- lib/generators/post_json/install/templates/create_post_json_documents.rb
|
97
|
+
- lib/generators/post_json/install/templates/initializer.rb
|
98
|
+
- lib/generators/post_json/install/templates/create_post_json_model_settings.rb
|
99
|
+
- lib/generators/post_json/install/templates/create_post_json_dynamic_indexes.rb
|
100
|
+
- lib/generators/post_json/install/templates/enable_extensions.rb
|
101
|
+
- lib/generators/post_json/install/install_generator.rb
|
102
|
+
- lib/post_json/model_settings.rb
|
103
|
+
- lib/post_json/concerns/settings_methods.rb
|
104
|
+
- lib/post_json/concerns/query_methods.rb
|
105
|
+
- lib/post_json/concerns/argument_methods.rb
|
106
|
+
- lib/post_json/concerns/finder_methods.rb
|
107
|
+
- lib/post_json/concerns/dynamic_index_methods.rb
|
108
|
+
- lib/post_json/version.rb
|
109
|
+
- lib/post_json/dynamic_index.rb
|
110
|
+
- lib/post_json/query_translator.rb
|
111
|
+
- lib/post_json/base.rb
|
112
|
+
- spec/models/base_spec.rb
|
113
|
+
- spec/models/queries_spec.rb
|
114
|
+
- spec/models/collection_spec.rb
|
115
|
+
- spec/spec_helper.rb
|
116
|
+
- spec/dummy/app/helpers/application_helper.rb
|
117
|
+
- spec/dummy/app/assets/javascripts/application.js
|
118
|
+
- spec/dummy/app/assets/stylesheets/scaffold.css
|
119
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
120
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
121
|
+
- spec/dummy/app/controllers/application_controller.rb
|
122
|
+
- spec/dummy/bin/rails
|
123
|
+
- spec/dummy/bin/bundle
|
124
|
+
- spec/dummy/bin/rake
|
125
|
+
- spec/dummy/config.ru
|
126
|
+
- spec/dummy/Rakefile
|
127
|
+
- spec/dummy/config/environment.rb
|
128
|
+
- spec/dummy/config/environments/development.rb
|
129
|
+
- spec/dummy/config/environments/test.rb
|
130
|
+
- spec/dummy/config/environments/production.rb
|
131
|
+
- spec/dummy/config/application.rb
|
132
|
+
- spec/dummy/config/initializers/inflections.rb
|
133
|
+
- spec/dummy/config/initializers/mime_types.rb
|
134
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
135
|
+
- spec/dummy/config/initializers/filter_parameter_logging.rb
|
136
|
+
- spec/dummy/config/initializers/post_json.rb
|
137
|
+
- spec/dummy/config/initializers/session_store.rb
|
138
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
139
|
+
- spec/dummy/config/initializers/secret_token.rb
|
140
|
+
- spec/dummy/config/routes.rb
|
141
|
+
- spec/dummy/config/locales/en.yml
|
142
|
+
- spec/dummy/config/database.yml
|
143
|
+
- spec/dummy/config/boot.rb
|
144
|
+
- spec/dummy/public/favicon.ico
|
145
|
+
- spec/dummy/public/404.html
|
146
|
+
- spec/dummy/public/500.html
|
147
|
+
- spec/dummy/public/422.html
|
148
|
+
- spec/dummy/db/structure.sql
|
149
|
+
- spec/dummy/db/migrate/20131015022029_enable_extensions.rb
|
150
|
+
- spec/dummy/db/migrate/20131015022031_create_post_json_model_settings.rb
|
151
|
+
- spec/dummy/db/migrate/20131015022030_create_procedures.rb
|
152
|
+
- spec/dummy/db/migrate/20131015022034_create_post_json_dynamic_indexes.rb
|
153
|
+
- spec/dummy/db/migrate/20131015022032_create_post_json_collections.rb
|
154
|
+
- spec/dummy/db/migrate/20131015022033_create_post_json_documents.rb
|
155
|
+
- spec/modules/query_methods_spec.rb
|
156
|
+
- spec/modules/argument_methods_spec.rb
|
157
|
+
- MIT-LICENSE
|
158
|
+
- Rakefile
|
159
|
+
- README.md
|
160
|
+
homepage: https://github.com/webnuts/post_json
|
161
|
+
licenses:
|
162
|
+
- MIT
|
163
|
+
metadata: {}
|
164
|
+
post_install_message:
|
165
|
+
rdoc_options: []
|
166
|
+
require_paths:
|
167
|
+
- lib
|
168
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - '>='
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
|
+
requirements:
|
175
|
+
- - '>='
|
176
|
+
- !ruby/object:Gem::Version
|
177
|
+
version: '0'
|
178
|
+
requirements: []
|
179
|
+
rubyforge_project:
|
180
|
+
rubygems_version: 2.1.9
|
181
|
+
signing_key:
|
182
|
+
specification_version: 4
|
183
|
+
summary: Great Document Database
|
184
|
+
test_files: []
|