mongoid-observers 0.1.1 → 0.2.0
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/.ruby-version +1 -1
- data/.travis.yml +3 -2
- data/Gemfile +10 -10
- data/Guardfile +77 -0
- data/Rakefile +19 -1
- data/gemfiles/mongoid_4.gemfile +13 -0
- data/gemfiles/mongoid_4.gemfile.lock +189 -0
- data/gemfiles/mongoid_5.gemfile +13 -0
- data/gemfiles/mongoid_5.gemfile.lock +185 -0
- data/lib/mongoid/observers/version.rb +1 -1
- data/mongoid-observers.gemspec +4 -1
- data/spec/config/{mongoid.yml → mongoid_4.yml} +0 -0
- data/spec/config/mongoid_5.yml +6 -0
- data/spec/mongoid/observer_spec.rb +22 -22
- data/spec/spec_helper.rb +8 -3
- metadata +42 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 801712519460cf564e76d57cd78f16b40e20dfbd
|
4
|
+
data.tar.gz: 8e04719dd40a66ed726c2d1ff6c13d14d1eb667f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef5f52dc72a77d1099d1b29c4de4f9c93679dbb5b1c9020d4fe9d5aaf18b301b83b17c111f9dabe0d987e4c090c139f131906c71450dfe9247cb0d861d7dba0d
|
7
|
+
data.tar.gz: 00fbe11cc15e6351bcde3b51c376b07efe447a967cc79ee11ff5556c59473cab830e6229f78b135e89d4bbb8ac1070e03fe2036413e96cebb69f2088cd6861b2
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.3.0
|
data/.travis.yml
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
services: mongodb
|
2
2
|
language: ruby
|
3
|
+
before_install: gem install bundler -v='1.11.2'
|
3
4
|
script: "bundle exec rake spec"
|
4
5
|
rvm:
|
5
6
|
- 1.9.3
|
6
7
|
- 2.0.0
|
7
|
-
- 2.1.
|
8
|
-
- 2.
|
8
|
+
- 2.1.5
|
9
|
+
- 2.3.0
|
9
10
|
env:
|
10
11
|
- CODECLIMATE_REPO_TOKEN=f506e465f1ed0571aeaa5e1cb9c14214c9f7567a92d1af70903f3d0bc8015ed6
|
11
12
|
notifications:
|
data/Gemfile
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem
|
4
|
-
gem
|
5
|
-
gem
|
6
|
-
gem
|
7
|
-
gem
|
8
|
-
gem
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem
|
3
|
+
gem 'mongoid', '~> 5.1.2'
|
4
|
+
gem 'rake', '~> 10.4.2'
|
5
|
+
gem 'rspec', '~> 3.1.0'
|
6
|
+
gem 'guard-rspec', '~> 4.6.4'
|
7
|
+
gem 'pry', '~> 0.9.12.6'
|
8
|
+
gem 'simplecov', '~> 0.10.0'
|
9
|
+
gem 'coveralls', '~> 0.8.2', require: false
|
10
|
+
gem 'codeclimate-test-reporter'
|
11
|
+
gem 'railties'
|
12
12
|
|
13
13
|
# Specify your gem's dependencies in mongoid-observers.gemspec
|
14
14
|
gemspec
|
data/Guardfile
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec feature)
|
6
|
+
|
7
|
+
## Uncomment to clear the screen before every task
|
8
|
+
# clearing :on
|
9
|
+
|
10
|
+
## Guard internally checks for changes in the Guardfile and exits.
|
11
|
+
## If you want Guard to automatically start up again, run guard in a
|
12
|
+
## shell loop, e.g.:
|
13
|
+
##
|
14
|
+
## $ while bundle exec guard; do echo "Restarting Guard..."; done
|
15
|
+
##
|
16
|
+
## Note: if you are using the `directories` clause above and you are not
|
17
|
+
## watching the project directory ('.'), the you will want to move the Guardfile
|
18
|
+
## to a watched dir and symlink it back, e.g.
|
19
|
+
#
|
20
|
+
# $ mkdir config
|
21
|
+
# $ mv Guardfile config/
|
22
|
+
# $ ln -s config/Guardfile .
|
23
|
+
#
|
24
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
25
|
+
|
26
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
27
|
+
# rspec may be run, below are examples of the most common uses.
|
28
|
+
# * bundler: 'bundle exec rspec'
|
29
|
+
# * bundler binstubs: 'bin/rspec'
|
30
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
31
|
+
# installed the spring binstubs per the docs)
|
32
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
33
|
+
# * 'just' rspec: 'rspec'
|
34
|
+
|
35
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
36
|
+
require "guard/rspec/dsl"
|
37
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
38
|
+
|
39
|
+
# Feel free to open issues for suggestions and improvements
|
40
|
+
|
41
|
+
# RSpec files
|
42
|
+
rspec = dsl.rspec
|
43
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
44
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
45
|
+
watch(rspec.spec_files)
|
46
|
+
|
47
|
+
# Ruby files
|
48
|
+
ruby = dsl.ruby
|
49
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
50
|
+
|
51
|
+
# Rails files
|
52
|
+
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
53
|
+
dsl.watch_spec_files_for(rails.app_files)
|
54
|
+
dsl.watch_spec_files_for(rails.views)
|
55
|
+
|
56
|
+
watch(rails.controllers) do |m|
|
57
|
+
[
|
58
|
+
rspec.spec.("routing/#{m[1]}_routing"),
|
59
|
+
rspec.spec.("controllers/#{m[1]}_controller"),
|
60
|
+
rspec.spec.("acceptance/#{m[1]}")
|
61
|
+
]
|
62
|
+
end
|
63
|
+
|
64
|
+
# Rails config changes
|
65
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
66
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
67
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
68
|
+
|
69
|
+
# Capybara features specs
|
70
|
+
watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
|
71
|
+
|
72
|
+
# Turnip features and steps
|
73
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
74
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
75
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
76
|
+
end
|
77
|
+
end
|
data/Rakefile
CHANGED
@@ -7,4 +7,22 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
7
7
|
spec.pattern = FileList["spec/**/*_spec.rb"]
|
8
8
|
end
|
9
9
|
|
10
|
-
task :default => "spec"
|
10
|
+
task :default => "spec:all"
|
11
|
+
|
12
|
+
namespace :spec do
|
13
|
+
%w(mongoid_4 mongoid_5).each do |gemfile|
|
14
|
+
desc "Run Tests against #{gemfile}"
|
15
|
+
task gemfile do
|
16
|
+
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle --quiet"
|
17
|
+
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle exec rake spec"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "Run Tests against rails versions"
|
22
|
+
task :all do
|
23
|
+
%w(mongoid_4 mongoid_5).each do |gemfile|
|
24
|
+
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle --quiet"
|
25
|
+
sh "BUNDLE_GEMFILE='gemfiles/#{gemfile}.gemfile' bundle exec rake spec"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'mongoid', '~> 4.0.2'
|
4
|
+
gem 'rake', '~> 10.4.2'
|
5
|
+
gem 'rspec', '~> 3.1.0'
|
6
|
+
gem 'guard-rspec', '~> 4.6.4'
|
7
|
+
gem 'pry', '~> 0.9.12.6'
|
8
|
+
gem 'simplecov', '~> 0.10.0'
|
9
|
+
gem 'coveralls', '~> 0.8.2', require: false
|
10
|
+
gem 'codeclimate-test-reporter'
|
11
|
+
gem 'railties'
|
12
|
+
|
13
|
+
gemspec :path => '../'
|
@@ -0,0 +1,189 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../
|
3
|
+
specs:
|
4
|
+
mongoid-observers (0.1.1)
|
5
|
+
mongoid (>= 4.0.0)
|
6
|
+
rails-observers (~> 0.1.2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionpack (4.2.6)
|
12
|
+
actionview (= 4.2.6)
|
13
|
+
activesupport (= 4.2.6)
|
14
|
+
rack (~> 1.6)
|
15
|
+
rack-test (~> 0.6.2)
|
16
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
17
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
18
|
+
actionview (4.2.6)
|
19
|
+
activesupport (= 4.2.6)
|
20
|
+
builder (~> 3.1)
|
21
|
+
erubis (~> 2.7.0)
|
22
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
23
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
24
|
+
activemodel (4.2.6)
|
25
|
+
activesupport (= 4.2.6)
|
26
|
+
builder (~> 3.1)
|
27
|
+
activesupport (4.2.6)
|
28
|
+
i18n (~> 0.7)
|
29
|
+
json (~> 1.7, >= 1.7.7)
|
30
|
+
minitest (~> 5.1)
|
31
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
32
|
+
tzinfo (~> 1.1)
|
33
|
+
ammeter (1.1.3)
|
34
|
+
activesupport (>= 3.0)
|
35
|
+
railties (>= 3.0)
|
36
|
+
rspec-rails (>= 2.2)
|
37
|
+
bson (3.2.6)
|
38
|
+
builder (3.2.2)
|
39
|
+
codeclimate-test-reporter (0.5.0)
|
40
|
+
simplecov (>= 0.7.1, < 1.0.0)
|
41
|
+
coderay (1.1.1)
|
42
|
+
connection_pool (2.2.0)
|
43
|
+
coveralls (0.8.9)
|
44
|
+
json (~> 1.8)
|
45
|
+
rest-client (>= 1.6.8, < 2)
|
46
|
+
simplecov (~> 0.10.0)
|
47
|
+
term-ansicolor (~> 1.3)
|
48
|
+
thor (~> 0.19.1)
|
49
|
+
tins (~> 1.6.0)
|
50
|
+
diff-lcs (1.2.5)
|
51
|
+
docile (1.1.5)
|
52
|
+
domain_name (0.5.20160310)
|
53
|
+
unf (>= 0.0.5, < 1.0.0)
|
54
|
+
erubis (2.7.0)
|
55
|
+
ffi (1.9.10)
|
56
|
+
formatador (0.2.5)
|
57
|
+
guard (2.13.0)
|
58
|
+
formatador (>= 0.2.4)
|
59
|
+
listen (>= 2.7, <= 4.0)
|
60
|
+
lumberjack (~> 1.0)
|
61
|
+
nenv (~> 0.1)
|
62
|
+
notiffany (~> 0.0)
|
63
|
+
pry (>= 0.9.12)
|
64
|
+
shellany (~> 0.0)
|
65
|
+
thor (>= 0.18.1)
|
66
|
+
guard-compat (1.2.1)
|
67
|
+
guard-rspec (4.6.5)
|
68
|
+
guard (~> 2.1)
|
69
|
+
guard-compat (~> 1.1)
|
70
|
+
rspec (>= 2.99.0, < 4.0)
|
71
|
+
http-cookie (1.0.2)
|
72
|
+
domain_name (~> 0.5)
|
73
|
+
i18n (0.7.0)
|
74
|
+
json (1.8.3)
|
75
|
+
listen (3.0.6)
|
76
|
+
rb-fsevent (>= 0.9.3)
|
77
|
+
rb-inotify (>= 0.9.7)
|
78
|
+
loofah (2.0.3)
|
79
|
+
nokogiri (>= 1.5.9)
|
80
|
+
lumberjack (1.0.10)
|
81
|
+
method_source (0.8.2)
|
82
|
+
mime-types (2.99.1)
|
83
|
+
mini_portile2 (2.0.0)
|
84
|
+
minitest (5.8.4)
|
85
|
+
mongoid (4.0.2)
|
86
|
+
activemodel (~> 4.0)
|
87
|
+
moped (~> 2.0.0)
|
88
|
+
origin (~> 2.1)
|
89
|
+
tzinfo (>= 0.3.37)
|
90
|
+
moped (2.0.7)
|
91
|
+
bson (~> 3.0)
|
92
|
+
connection_pool (~> 2.0)
|
93
|
+
optionable (~> 0.2.0)
|
94
|
+
nenv (0.3.0)
|
95
|
+
netrc (0.11.0)
|
96
|
+
nokogiri (1.6.7.2)
|
97
|
+
mini_portile2 (~> 2.0.0.rc2)
|
98
|
+
notiffany (0.0.8)
|
99
|
+
nenv (~> 0.1)
|
100
|
+
shellany (~> 0.0)
|
101
|
+
optionable (0.2.0)
|
102
|
+
origin (2.2.0)
|
103
|
+
pry (0.9.12.6)
|
104
|
+
coderay (~> 1.0)
|
105
|
+
method_source (~> 0.8)
|
106
|
+
slop (~> 3.4)
|
107
|
+
rack (1.6.4)
|
108
|
+
rack-test (0.6.3)
|
109
|
+
rack (>= 1.0)
|
110
|
+
rails-deprecated_sanitizer (1.0.3)
|
111
|
+
activesupport (>= 4.2.0.alpha)
|
112
|
+
rails-dom-testing (1.0.7)
|
113
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
114
|
+
nokogiri (~> 1.6.0)
|
115
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
116
|
+
rails-html-sanitizer (1.0.3)
|
117
|
+
loofah (~> 2.0)
|
118
|
+
rails-observers (0.1.2)
|
119
|
+
activemodel (~> 4.0)
|
120
|
+
railties (4.2.6)
|
121
|
+
actionpack (= 4.2.6)
|
122
|
+
activesupport (= 4.2.6)
|
123
|
+
rake (>= 0.8.7)
|
124
|
+
thor (>= 0.18.1, < 2.0)
|
125
|
+
rake (10.4.2)
|
126
|
+
rb-fsevent (0.9.7)
|
127
|
+
rb-inotify (0.9.7)
|
128
|
+
ffi (>= 0.5.0)
|
129
|
+
rest-client (1.8.0)
|
130
|
+
http-cookie (>= 1.0.2, < 2.0)
|
131
|
+
mime-types (>= 1.16, < 3.0)
|
132
|
+
netrc (~> 0.7)
|
133
|
+
rspec (3.1.0)
|
134
|
+
rspec-core (~> 3.1.0)
|
135
|
+
rspec-expectations (~> 3.1.0)
|
136
|
+
rspec-mocks (~> 3.1.0)
|
137
|
+
rspec-core (3.1.7)
|
138
|
+
rspec-support (~> 3.1.0)
|
139
|
+
rspec-expectations (3.1.2)
|
140
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
141
|
+
rspec-support (~> 3.1.0)
|
142
|
+
rspec-mocks (3.1.3)
|
143
|
+
rspec-support (~> 3.1.0)
|
144
|
+
rspec-rails (3.1.0)
|
145
|
+
actionpack (>= 3.0)
|
146
|
+
activesupport (>= 3.0)
|
147
|
+
railties (>= 3.0)
|
148
|
+
rspec-core (~> 3.1.0)
|
149
|
+
rspec-expectations (~> 3.1.0)
|
150
|
+
rspec-mocks (~> 3.1.0)
|
151
|
+
rspec-support (~> 3.1.0)
|
152
|
+
rspec-support (3.1.2)
|
153
|
+
shellany (0.0.1)
|
154
|
+
simplecov (0.10.0)
|
155
|
+
docile (~> 1.1.0)
|
156
|
+
json (~> 1.8)
|
157
|
+
simplecov-html (~> 0.10.0)
|
158
|
+
simplecov-html (0.10.0)
|
159
|
+
slop (3.6.0)
|
160
|
+
term-ansicolor (1.3.2)
|
161
|
+
tins (~> 1.0)
|
162
|
+
thor (0.19.1)
|
163
|
+
thread_safe (0.3.5)
|
164
|
+
tins (1.6.0)
|
165
|
+
tzinfo (1.2.2)
|
166
|
+
thread_safe (~> 0.1)
|
167
|
+
unf (0.1.4)
|
168
|
+
unf_ext
|
169
|
+
unf_ext (0.0.7.2)
|
170
|
+
|
171
|
+
PLATFORMS
|
172
|
+
ruby
|
173
|
+
|
174
|
+
DEPENDENCIES
|
175
|
+
ammeter (~> 1.1.2)
|
176
|
+
bundler (~> 1.11)
|
177
|
+
codeclimate-test-reporter
|
178
|
+
coveralls (~> 0.8.2)
|
179
|
+
guard-rspec (~> 4.6.4)
|
180
|
+
mongoid (~> 4.0.2)
|
181
|
+
mongoid-observers!
|
182
|
+
pry (~> 0.9.12.6)
|
183
|
+
railties
|
184
|
+
rake (~> 10.4.2)
|
185
|
+
rspec (~> 3.1.0)
|
186
|
+
simplecov (~> 0.10.0)
|
187
|
+
|
188
|
+
BUNDLED WITH
|
189
|
+
1.11.2
|
@@ -0,0 +1,13 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gem 'mongoid', '~> 5.1.2'
|
4
|
+
gem 'rake', '~> 10.4.2'
|
5
|
+
gem 'rspec', '~> 3.1.0'
|
6
|
+
gem 'guard-rspec', '~> 4.6.4'
|
7
|
+
gem 'pry', '~> 0.9.12.6'
|
8
|
+
gem 'simplecov', '~> 0.10.0'
|
9
|
+
gem 'coveralls', '~> 0.8.2', require: false
|
10
|
+
gem 'codeclimate-test-reporter'
|
11
|
+
gem 'railties'
|
12
|
+
|
13
|
+
gemspec :path => '../'
|
@@ -0,0 +1,185 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../
|
3
|
+
specs:
|
4
|
+
mongoid-observers (0.1.1)
|
5
|
+
mongoid (>= 4.0.0)
|
6
|
+
rails-observers (~> 0.1.2)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionpack (4.2.6)
|
12
|
+
actionview (= 4.2.6)
|
13
|
+
activesupport (= 4.2.6)
|
14
|
+
rack (~> 1.6)
|
15
|
+
rack-test (~> 0.6.2)
|
16
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
17
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
18
|
+
actionview (4.2.6)
|
19
|
+
activesupport (= 4.2.6)
|
20
|
+
builder (~> 3.1)
|
21
|
+
erubis (~> 2.7.0)
|
22
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
23
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
24
|
+
activemodel (4.2.6)
|
25
|
+
activesupport (= 4.2.6)
|
26
|
+
builder (~> 3.1)
|
27
|
+
activesupport (4.2.6)
|
28
|
+
i18n (~> 0.7)
|
29
|
+
json (~> 1.7, >= 1.7.7)
|
30
|
+
minitest (~> 5.1)
|
31
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
32
|
+
tzinfo (~> 1.1)
|
33
|
+
ammeter (1.1.3)
|
34
|
+
activesupport (>= 3.0)
|
35
|
+
railties (>= 3.0)
|
36
|
+
rspec-rails (>= 2.2)
|
37
|
+
bson (4.0.4)
|
38
|
+
builder (3.2.2)
|
39
|
+
codeclimate-test-reporter (0.5.0)
|
40
|
+
simplecov (>= 0.7.1, < 1.0.0)
|
41
|
+
coderay (1.1.1)
|
42
|
+
coveralls (0.8.9)
|
43
|
+
json (~> 1.8)
|
44
|
+
rest-client (>= 1.6.8, < 2)
|
45
|
+
simplecov (~> 0.10.0)
|
46
|
+
term-ansicolor (~> 1.3)
|
47
|
+
thor (~> 0.19.1)
|
48
|
+
tins (~> 1.6.0)
|
49
|
+
diff-lcs (1.2.5)
|
50
|
+
docile (1.1.5)
|
51
|
+
domain_name (0.5.20160310)
|
52
|
+
unf (>= 0.0.5, < 1.0.0)
|
53
|
+
erubis (2.7.0)
|
54
|
+
ffi (1.9.10)
|
55
|
+
formatador (0.2.5)
|
56
|
+
guard (2.13.0)
|
57
|
+
formatador (>= 0.2.4)
|
58
|
+
listen (>= 2.7, <= 4.0)
|
59
|
+
lumberjack (~> 1.0)
|
60
|
+
nenv (~> 0.1)
|
61
|
+
notiffany (~> 0.0)
|
62
|
+
pry (>= 0.9.12)
|
63
|
+
shellany (~> 0.0)
|
64
|
+
thor (>= 0.18.1)
|
65
|
+
guard-compat (1.2.1)
|
66
|
+
guard-rspec (4.6.5)
|
67
|
+
guard (~> 2.1)
|
68
|
+
guard-compat (~> 1.1)
|
69
|
+
rspec (>= 2.99.0, < 4.0)
|
70
|
+
http-cookie (1.0.2)
|
71
|
+
domain_name (~> 0.5)
|
72
|
+
i18n (0.7.0)
|
73
|
+
json (1.8.3)
|
74
|
+
listen (3.0.6)
|
75
|
+
rb-fsevent (>= 0.9.3)
|
76
|
+
rb-inotify (>= 0.9.7)
|
77
|
+
loofah (2.0.3)
|
78
|
+
nokogiri (>= 1.5.9)
|
79
|
+
lumberjack (1.0.10)
|
80
|
+
method_source (0.8.2)
|
81
|
+
mime-types (2.99.1)
|
82
|
+
mini_portile2 (2.0.0)
|
83
|
+
minitest (5.8.4)
|
84
|
+
mongo (2.2.4)
|
85
|
+
bson (~> 4.0)
|
86
|
+
mongoid (5.1.2)
|
87
|
+
activemodel (~> 4.0)
|
88
|
+
mongo (~> 2.1)
|
89
|
+
origin (~> 2.2)
|
90
|
+
tzinfo (>= 0.3.37)
|
91
|
+
nenv (0.3.0)
|
92
|
+
netrc (0.11.0)
|
93
|
+
nokogiri (1.6.7.2)
|
94
|
+
mini_portile2 (~> 2.0.0.rc2)
|
95
|
+
notiffany (0.0.8)
|
96
|
+
nenv (~> 0.1)
|
97
|
+
shellany (~> 0.0)
|
98
|
+
origin (2.2.0)
|
99
|
+
pry (0.9.12.6)
|
100
|
+
coderay (~> 1.0)
|
101
|
+
method_source (~> 0.8)
|
102
|
+
slop (~> 3.4)
|
103
|
+
rack (1.6.4)
|
104
|
+
rack-test (0.6.3)
|
105
|
+
rack (>= 1.0)
|
106
|
+
rails-deprecated_sanitizer (1.0.3)
|
107
|
+
activesupport (>= 4.2.0.alpha)
|
108
|
+
rails-dom-testing (1.0.7)
|
109
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
110
|
+
nokogiri (~> 1.6.0)
|
111
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
112
|
+
rails-html-sanitizer (1.0.3)
|
113
|
+
loofah (~> 2.0)
|
114
|
+
rails-observers (0.1.2)
|
115
|
+
activemodel (~> 4.0)
|
116
|
+
railties (4.2.6)
|
117
|
+
actionpack (= 4.2.6)
|
118
|
+
activesupport (= 4.2.6)
|
119
|
+
rake (>= 0.8.7)
|
120
|
+
thor (>= 0.18.1, < 2.0)
|
121
|
+
rake (10.4.2)
|
122
|
+
rb-fsevent (0.9.7)
|
123
|
+
rb-inotify (0.9.7)
|
124
|
+
ffi (>= 0.5.0)
|
125
|
+
rest-client (1.8.0)
|
126
|
+
http-cookie (>= 1.0.2, < 2.0)
|
127
|
+
mime-types (>= 1.16, < 3.0)
|
128
|
+
netrc (~> 0.7)
|
129
|
+
rspec (3.1.0)
|
130
|
+
rspec-core (~> 3.1.0)
|
131
|
+
rspec-expectations (~> 3.1.0)
|
132
|
+
rspec-mocks (~> 3.1.0)
|
133
|
+
rspec-core (3.1.7)
|
134
|
+
rspec-support (~> 3.1.0)
|
135
|
+
rspec-expectations (3.1.2)
|
136
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
137
|
+
rspec-support (~> 3.1.0)
|
138
|
+
rspec-mocks (3.1.3)
|
139
|
+
rspec-support (~> 3.1.0)
|
140
|
+
rspec-rails (3.1.0)
|
141
|
+
actionpack (>= 3.0)
|
142
|
+
activesupport (>= 3.0)
|
143
|
+
railties (>= 3.0)
|
144
|
+
rspec-core (~> 3.1.0)
|
145
|
+
rspec-expectations (~> 3.1.0)
|
146
|
+
rspec-mocks (~> 3.1.0)
|
147
|
+
rspec-support (~> 3.1.0)
|
148
|
+
rspec-support (3.1.2)
|
149
|
+
shellany (0.0.1)
|
150
|
+
simplecov (0.10.0)
|
151
|
+
docile (~> 1.1.0)
|
152
|
+
json (~> 1.8)
|
153
|
+
simplecov-html (~> 0.10.0)
|
154
|
+
simplecov-html (0.10.0)
|
155
|
+
slop (3.6.0)
|
156
|
+
term-ansicolor (1.3.2)
|
157
|
+
tins (~> 1.0)
|
158
|
+
thor (0.19.1)
|
159
|
+
thread_safe (0.3.5)
|
160
|
+
tins (1.6.0)
|
161
|
+
tzinfo (1.2.2)
|
162
|
+
thread_safe (~> 0.1)
|
163
|
+
unf (0.1.4)
|
164
|
+
unf_ext
|
165
|
+
unf_ext (0.0.7.2)
|
166
|
+
|
167
|
+
PLATFORMS
|
168
|
+
ruby
|
169
|
+
|
170
|
+
DEPENDENCIES
|
171
|
+
ammeter (~> 1.1.2)
|
172
|
+
bundler (~> 1.11)
|
173
|
+
codeclimate-test-reporter
|
174
|
+
coveralls (~> 0.8.2)
|
175
|
+
guard-rspec (~> 4.6.4)
|
176
|
+
mongoid (~> 5.1.2)
|
177
|
+
mongoid-observers!
|
178
|
+
pry (~> 0.9.12.6)
|
179
|
+
railties
|
180
|
+
rake (~> 10.4.2)
|
181
|
+
rspec (~> 3.1.0)
|
182
|
+
simplecov (~> 0.10.0)
|
183
|
+
|
184
|
+
BUNDLED WITH
|
185
|
+
1.11.2
|
data/mongoid-observers.gemspec
CHANGED
@@ -19,5 +19,8 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_dependency "rails-observers", "~> 0.1.2"
|
22
|
-
spec.add_dependency "mongoid", ">= 4.0.0
|
22
|
+
spec.add_dependency "mongoid", ">= 4.0.0"
|
23
|
+
|
24
|
+
spec.add_development_dependency "ammeter", "~> 1.1.2"
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
23
26
|
end
|
File without changes
|
@@ -11,7 +11,7 @@ describe Mongoid::Observer do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "is an instance of an active model observer" do
|
14
|
-
ActorObserver.instance.
|
14
|
+
expect(ActorObserver.instance).to be_a_kind_of(ActiveModel::Observer)
|
15
15
|
end
|
16
16
|
|
17
17
|
context "when the oberserver observes a different class" do
|
@@ -27,7 +27,7 @@ describe Mongoid::Observer do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it "returns the proper observed classes" do
|
30
|
-
BandObserver.observed_classes.
|
30
|
+
expect(BandObserver.observed_classes).to eq([ Record ])
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -52,7 +52,7 @@ describe Mongoid::Observer do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
it "contains the updated value in the observer" do
|
55
|
-
phone.number_in_observer.
|
55
|
+
expect(phone.number_in_observer).to eq("0152-2222-2222")
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -68,7 +68,7 @@ describe Mongoid::Observer do
|
|
68
68
|
end
|
69
69
|
|
70
70
|
it "observes descendent class" do
|
71
|
-
observer.last_after_create_record.try(:name).
|
71
|
+
expect(observer.last_after_create_record.try(:name)).to eq(actress.name)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -84,7 +84,7 @@ describe Mongoid::Observer do
|
|
84
84
|
|
85
85
|
it "does not fire the observer" do
|
86
86
|
Actor.observers.disable(:all) do
|
87
|
-
actor and observer.last_after_create_record.
|
87
|
+
actor and expect(observer.last_after_create_record).not_to eq(actor)
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
@@ -101,7 +101,7 @@ describe Mongoid::Observer do
|
|
101
101
|
|
102
102
|
it "does not fire the observer" do
|
103
103
|
Mongoid.observers.disable(:all) do
|
104
|
-
actor and observer.last_after_create_record.
|
104
|
+
actor and expect(observer.last_after_create_record).not_to eq(actor)
|
105
105
|
end
|
106
106
|
end
|
107
107
|
end
|
@@ -113,15 +113,15 @@ describe Mongoid::Observer do
|
|
113
113
|
end
|
114
114
|
|
115
115
|
it "observes after initialize" do
|
116
|
-
recorder.last_callback.
|
116
|
+
expect(recorder.last_callback).to eq(:after_initialize)
|
117
117
|
end
|
118
118
|
|
119
119
|
it "calls after initialize once" do
|
120
|
-
recorder.call_count[:after_initialize].
|
120
|
+
expect(recorder.call_count[:after_initialize]).to eq(1)
|
121
121
|
end
|
122
122
|
|
123
123
|
it "contains the model of the callback" do
|
124
|
-
recorder.last_record[:after_initialize].
|
124
|
+
expect(recorder.last_record[:after_initialize]).to eq(actor)
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
@@ -139,11 +139,11 @@ describe Mongoid::Observer do
|
|
139
139
|
:around_save ].each do |callback|
|
140
140
|
|
141
141
|
it "observes #{callback}" do
|
142
|
-
recorder.call_count[callback].
|
142
|
+
expect(recorder.call_count[callback]).to eq(1)
|
143
143
|
end
|
144
144
|
|
145
145
|
it "contains the model of the callback" do
|
146
|
-
recorder.last_record[callback].
|
146
|
+
expect(recorder.last_record[callback]).to eq(actor)
|
147
147
|
end
|
148
148
|
end
|
149
149
|
end
|
@@ -167,11 +167,11 @@ describe Mongoid::Observer do
|
|
167
167
|
end
|
168
168
|
|
169
169
|
it "observes #{callback}" do
|
170
|
-
recorder.call_count[callback].
|
170
|
+
expect(recorder.call_count[callback]).to eq(1)
|
171
171
|
end
|
172
172
|
|
173
173
|
it "contains the model of the callback" do
|
174
|
-
recorder.last_record[callback].
|
174
|
+
expect(recorder.last_record[callback]).to eq(actor)
|
175
175
|
end
|
176
176
|
end
|
177
177
|
end
|
@@ -192,11 +192,11 @@ describe Mongoid::Observer do
|
|
192
192
|
end
|
193
193
|
|
194
194
|
it "observes #{callback}" do
|
195
|
-
recorder.call_count[callback].
|
195
|
+
expect(recorder.call_count[callback]).to eq(1)
|
196
196
|
end
|
197
197
|
|
198
198
|
it "contains the model of the callback" do
|
199
|
-
recorder.last_record[callback].
|
199
|
+
expect(recorder.last_record[callback]).to eq(actor)
|
200
200
|
end
|
201
201
|
end
|
202
202
|
end
|
@@ -218,11 +218,11 @@ describe Mongoid::Observer do
|
|
218
218
|
end
|
219
219
|
|
220
220
|
it "observes #{callback}" do
|
221
|
-
recorder.call_count[callback].
|
221
|
+
expect(recorder.call_count[callback]).to eq(1)
|
222
222
|
end
|
223
223
|
|
224
224
|
it "contains the model of the callback" do
|
225
|
-
recorder.last_record[callback].
|
225
|
+
expect(recorder.last_record[callback]).to eq(actor)
|
226
226
|
end
|
227
227
|
end
|
228
228
|
end
|
@@ -241,11 +241,11 @@ describe Mongoid::Observer do
|
|
241
241
|
end
|
242
242
|
|
243
243
|
it "observes #{callback}" do
|
244
|
-
recorder.call_count[callback].
|
244
|
+
expect(recorder.call_count[callback]).to eq(1)
|
245
245
|
end
|
246
246
|
|
247
247
|
it "contains the model of the callback" do
|
248
|
-
recorder.last_record[callback].
|
248
|
+
expect(recorder.last_record[callback]).to eq(actor)
|
249
249
|
end
|
250
250
|
end
|
251
251
|
end
|
@@ -264,11 +264,11 @@ describe Mongoid::Observer do
|
|
264
264
|
end
|
265
265
|
|
266
266
|
it "observes #{callback}" do
|
267
|
-
recorder.call_count[callback].
|
267
|
+
expect(recorder.call_count[callback]).to eq(1)
|
268
268
|
end
|
269
269
|
|
270
270
|
it "contains the model of the callback" do
|
271
|
-
recorder.last_record[callback].
|
271
|
+
expect(recorder.last_record[callback]).to eq(actor)
|
272
272
|
end
|
273
273
|
end
|
274
274
|
end
|
@@ -284,7 +284,7 @@ describe Mongoid::Observer do
|
|
284
284
|
end
|
285
285
|
|
286
286
|
it "notifies the observers once" do
|
287
|
-
actor.after_custom_count.
|
287
|
+
expect(actor.after_custom_count).to eq(1)
|
288
288
|
end
|
289
289
|
end
|
290
290
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -16,12 +16,18 @@ MODELS = File.join(File.dirname(__FILE__), "app/models")
|
|
16
16
|
$LOAD_PATH.unshift(MODELS)
|
17
17
|
|
18
18
|
require "pry"
|
19
|
-
require "rails"
|
19
|
+
require "rails/all"
|
20
20
|
require "mongoid-observers"
|
21
21
|
require "ammeter/init"
|
22
22
|
|
23
23
|
# mongoid connection
|
24
|
-
Mongoid.
|
24
|
+
Mongoid.logger.level = Logger::INFO
|
25
|
+
|
26
|
+
if Mongoid::VERSION.start_with?('4.')
|
27
|
+
Mongoid.load! File.dirname(__FILE__) + "/config/mongoid_4.yml", :test
|
28
|
+
elsif Mongoid::VERSION.start_with?('5.')
|
29
|
+
Mongoid.load! File.dirname(__FILE__) + "/config/mongoid_5.yml", :test
|
30
|
+
end
|
25
31
|
|
26
32
|
# Autoload every model for the test suite that sits in spec/app/models.
|
27
33
|
Dir[ File.join(MODELS, "*.rb") ].sort.each do |file|
|
@@ -32,7 +38,6 @@ end
|
|
32
38
|
RSpec.configure do |config|
|
33
39
|
config.filter_run focus: true
|
34
40
|
config.run_all_when_everything_filtered = true
|
35
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
36
41
|
|
37
42
|
config.before(:each) do
|
38
43
|
Mongoid.purge!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-observers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chamnap Chhorn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails-observers
|
@@ -30,14 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 4.0.0
|
33
|
+
version: 4.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 4.0.0
|
40
|
+
version: 4.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: ammeter
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.1.2
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.1.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.11'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.11'
|
41
69
|
description: Mongoid::Observer removed from Mongoid 4.0
|
42
70
|
email:
|
43
71
|
- chamnapchhorn@gmail.com
|
@@ -52,9 +80,14 @@ files:
|
|
52
80
|
- ".ruby-version"
|
53
81
|
- ".travis.yml"
|
54
82
|
- Gemfile
|
83
|
+
- Guardfile
|
55
84
|
- LICENSE.txt
|
56
85
|
- README.md
|
57
86
|
- Rakefile
|
87
|
+
- gemfiles/mongoid_4.gemfile
|
88
|
+
- gemfiles/mongoid_4.gemfile.lock
|
89
|
+
- gemfiles/mongoid_5.gemfile
|
90
|
+
- gemfiles/mongoid_5.gemfile.lock
|
58
91
|
- lib/generators/mongoid/observer/observer_generator.rb
|
59
92
|
- lib/generators/mongoid/observer/templates/observer.rb.tt
|
60
93
|
- lib/mongoid-observers.rb
|
@@ -72,7 +105,8 @@ files:
|
|
72
105
|
- spec/app/models/phone.rb
|
73
106
|
- spec/app/models/phone_observer.rb
|
74
107
|
- spec/app/models/record.rb
|
75
|
-
- spec/config/
|
108
|
+
- spec/config/mongoid_4.yml
|
109
|
+
- spec/config/mongoid_5.yml
|
76
110
|
- spec/generators/mongoid/observer/observer_generator_spec.rb
|
77
111
|
- spec/mongoid/observer_spec.rb
|
78
112
|
- spec/spec_helper.rb
|
@@ -96,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
130
|
version: '0'
|
97
131
|
requirements: []
|
98
132
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
133
|
+
rubygems_version: 2.5.1
|
100
134
|
signing_key:
|
101
135
|
specification_version: 4
|
102
136
|
summary: Mongoid observer (removed in Mongoid 4.0)
|
@@ -109,7 +143,8 @@ test_files:
|
|
109
143
|
- spec/app/models/phone.rb
|
110
144
|
- spec/app/models/phone_observer.rb
|
111
145
|
- spec/app/models/record.rb
|
112
|
-
- spec/config/
|
146
|
+
- spec/config/mongoid_4.yml
|
147
|
+
- spec/config/mongoid_5.yml
|
113
148
|
- spec/generators/mongoid/observer/observer_generator_spec.rb
|
114
149
|
- spec/mongoid/observer_spec.rb
|
115
150
|
- spec/spec_helper.rb
|