embedson 0.0.2 → 1.0.1
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 +2 -0
- data/.travis.yml +13 -0
- data/README.md +125 -23
- data/Rakefile +4 -0
- data/embedson.gemspec +4 -1
- data/lib/embedson.rb +4 -0
- data/lib/embedson/exceptions.rb +21 -0
- data/lib/embedson/model.rb +8 -73
- data/lib/embedson/model/embedded_builder.rb +100 -0
- data/lib/embedson/model/embeds_builder.rb +68 -0
- data/lib/embedson/model/method_builder.rb +81 -0
- data/lib/embedson/version.rb +1 -1
- data/spec/embedson/model_spec.rb +421 -60
- data/spec/spec_helper.rb +17 -47
- metadata +25 -5
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
if ENV['BUILDER'] == 'travis'
|
2
|
+
require "codeclimate-test-reporter"
|
3
|
+
CodeClimate::TestReporter.start
|
4
|
+
else
|
5
|
+
require 'simplecov'
|
6
|
+
SimpleCov.start do
|
7
|
+
add_filter '/spec/'
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'active_record'
|
1
12
|
require 'embedson'
|
2
13
|
require 'with_model'
|
3
14
|
require 'pry'
|
@@ -14,55 +25,14 @@ RSpec.configure do |config|
|
|
14
25
|
mocks.verify_partial_doubles = true
|
15
26
|
end
|
16
27
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
=begin
|
23
|
-
# These two settings work together to allow you to limit a spec run
|
24
|
-
# to individual examples or groups you care about by tagging them with
|
25
|
-
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
26
|
-
# get run.
|
27
|
-
config.filter_run :focus
|
28
|
-
config.run_all_when_everything_filtered = true
|
29
|
-
|
30
|
-
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
31
|
-
# For more details, see:
|
32
|
-
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
33
|
-
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
34
|
-
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
35
|
-
config.disable_monkey_patching!
|
28
|
+
connection = if ENV['BUILDER'] == 'travis'
|
29
|
+
"postgres://postgres@localhost/travis_ci_test"
|
30
|
+
else
|
31
|
+
"postgres://embedson:embedson@localhost/embedson"
|
32
|
+
end
|
36
33
|
|
37
|
-
|
38
|
-
# be too noisy due to issues in dependencies.
|
39
|
-
config.warnings = true
|
34
|
+
ActiveRecord::Base.establish_connection(connection)
|
40
35
|
|
41
|
-
# Many RSpec users commonly either run the entire suite or an individual
|
42
|
-
# file, and it's useful to allow more verbose output when running an
|
43
|
-
# individual spec file.
|
44
|
-
if config.files_to_run.one?
|
45
|
-
# Use the documentation formatter for detailed output,
|
46
|
-
# unless a formatter has already been configured
|
47
|
-
# (e.g. via a command-line flag).
|
48
|
-
config.default_formatter = 'doc'
|
49
|
-
end
|
50
|
-
|
51
|
-
# Print the 10 slowest examples and example groups at the
|
52
|
-
# end of the spec run, to help surface which specs are running
|
53
|
-
# particularly slow.
|
54
|
-
config.profile_examples = 10
|
55
|
-
|
56
|
-
# Run specs in random order to surface order dependencies. If you find an
|
57
|
-
# order dependency and want to debug it, you can fix the order by providing
|
58
|
-
# the seed, which is printed after each run.
|
59
|
-
# --seed 1234
|
60
36
|
config.order = :random
|
61
|
-
|
62
|
-
# Seed global randomization in this process using the `--seed` CLI option.
|
63
|
-
# Setting this allows you to use `--seed` to deterministically reproduce
|
64
|
-
# test failures related to randomization by passing the same `--seed` value
|
65
|
-
# as the one that triggered the failure.
|
66
37
|
Kernel.srand config.seed
|
67
|
-
=end
|
68
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embedson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sufleR
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-27 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'
|
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'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: codeclimate-test-reporter
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description: Save any class which respond to to_h in json column as embedded model.
|
112
126
|
email:
|
113
127
|
- szymon.fracczak@netguru.co
|
@@ -116,13 +130,18 @@ extensions: []
|
|
116
130
|
extra_rdoc_files: []
|
117
131
|
files:
|
118
132
|
- ".gitignore"
|
133
|
+
- ".travis.yml"
|
119
134
|
- Gemfile
|
120
135
|
- LICENSE.txt
|
121
136
|
- README.md
|
122
137
|
- Rakefile
|
123
138
|
- embedson.gemspec
|
124
139
|
- lib/embedson.rb
|
140
|
+
- lib/embedson/exceptions.rb
|
125
141
|
- lib/embedson/model.rb
|
142
|
+
- lib/embedson/model/embedded_builder.rb
|
143
|
+
- lib/embedson/model/embeds_builder.rb
|
144
|
+
- lib/embedson/model/method_builder.rb
|
126
145
|
- lib/embedson/version.rb
|
127
146
|
- spec/embedson/model_spec.rb
|
128
147
|
- spec/spec_helper.rb
|
@@ -138,7 +157,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
138
157
|
requirements:
|
139
158
|
- - ">="
|
140
159
|
- !ruby/object:Gem::Version
|
141
|
-
version:
|
160
|
+
version: 1.9.3
|
142
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
162
|
requirements:
|
144
163
|
- - ">="
|
@@ -153,3 +172,4 @@ summary: Embedded model for AR with postgresql
|
|
153
172
|
test_files:
|
154
173
|
- spec/embedson/model_spec.rb
|
155
174
|
- spec/spec_helper.rb
|
175
|
+
has_rdoc:
|