active_merge 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.rdoc +16 -0
  3. data/{MIT-LICENSE → LICENSE} +1 -1
  4. data/README.rdoc +1 -1
  5. data/Rakefile +13 -1
  6. data/lib/active_merge/service.rb +57 -72
  7. data/lib/active_merge/simple_service.rb +36 -39
  8. data/lib/active_merge/version.rb +1 -2
  9. data/lib/active_merge.rb +9 -9
  10. data/spec/active_merge/service_spec.rb +205 -0
  11. data/spec/active_merge/simple_service_spec.rb +127 -0
  12. data/spec/active_merge_spec.rb +21 -0
  13. data/spec/dummy/README.rdoc +28 -0
  14. data/spec/dummy/Rakefile +6 -0
  15. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  16. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  17. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  18. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  19. data/spec/dummy/app/models/domain.rb +3 -0
  20. data/spec/dummy/app/models/lord.rb +4 -0
  21. data/spec/dummy/app/models/man.rb +3 -0
  22. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  23. data/spec/dummy/bin/bundle +3 -0
  24. data/spec/dummy/bin/rails +4 -0
  25. data/spec/dummy/bin/rake +4 -0
  26. data/spec/dummy/config/application.rb +30 -0
  27. data/spec/dummy/config/boot.rb +5 -0
  28. data/spec/dummy/config/database.yml +25 -0
  29. data/spec/dummy/config/environment.rb +5 -0
  30. data/spec/dummy/config/environments/development.rb +29 -0
  31. data/spec/dummy/config/environments/production.rb +80 -0
  32. data/spec/dummy/config/environments/test.rb +36 -0
  33. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  34. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  35. data/spec/dummy/config/initializers/inflections.rb +16 -0
  36. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  37. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  38. data/spec/dummy/config/initializers/session_store.rb +3 -0
  39. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  40. data/spec/dummy/config/locales/ru.yml +7 -0
  41. data/spec/dummy/config/routes.rb +56 -0
  42. data/spec/dummy/config.ru +4 -0
  43. data/spec/dummy/db/migrate/20140416183029_create_lords.rb +6 -0
  44. data/spec/dummy/db/migrate/20140416183043_create_men.rb +8 -0
  45. data/spec/dummy/db/migrate/20140416183059_create_domains.rb +8 -0
  46. data/spec/dummy/db/schema.rb +31 -0
  47. data/spec/dummy/db/test.sqlite3 +0 -0
  48. data/spec/dummy/log/development.log +38 -0
  49. data/spec/dummy/log/test.log +25184 -0
  50. data/spec/dummy/public/404.html +58 -0
  51. data/spec/dummy/public/422.html +58 -0
  52. data/spec/dummy/public/500.html +57 -0
  53. data/spec/dummy/public/favicon.ico +0 -0
  54. data/spec/spec_helper.rb +53 -0
  55. data/spec/support/errors.rb +17 -0
  56. metadata +125 -15
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/404.html -->
52
+ <div class="dialog">
53
+ <h1>The page you were looking for doesn't exist.</h1>
54
+ <p>You may have mistyped the address or the page may have moved.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
File without changes
@@ -0,0 +1,53 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
4
+ ENV["RAILS_ENV"] ||= 'test'
5
+ require File.expand_path("../dummy/config/environment", __FILE__)
6
+
7
+ require "active_patterns"
8
+ require 'database_cleaner'
9
+
10
+ # Custom rspec helpers
11
+ Dir[File.expand_path("../support/**/*.rb", __FILE__)].each { |f| require f }
12
+
13
+ # Pending tests.
14
+ ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
15
+
16
+ RSpec.configure do |config|
17
+
18
+ # Use rspec for mocking and stubbing
19
+ config.mock_with :rspec
20
+
21
+ # Run tests in a random order
22
+ config.order = "random"
23
+
24
+ # Run tests tagged by :focus
25
+ config.treat_symbols_as_metadata_keys_with_true_values = true
26
+ config.filter_run focus: true
27
+ config.run_all_when_everything_filtered = true
28
+
29
+ # ============================================================================
30
+ # Database cleaning
31
+ # ============================================================================
32
+ config.before(:all) do
33
+ DatabaseCleaner.strategy = :transaction
34
+ DatabaseCleaner.clean_with(:deletion)
35
+ end
36
+
37
+ config.around(:each) do |example|
38
+ DatabaseCleaner.start
39
+ example.run
40
+ DatabaseCleaner.clean
41
+ end
42
+
43
+ # ============================================================================
44
+ # Postpone garbage collection
45
+ # ============================================================================
46
+ config.before(:each) do
47
+ GC.disable
48
+ end
49
+
50
+ config.after(:each) do
51
+ GC.enable
52
+ end
53
+ end
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+
3
+ # Проверяет, что объект содержит переведенные ошибки
4
+ RSpec::Matchers.define :have_errors do
5
+ match do |instance|
6
+ instance.errors.should_not be_blank
7
+ instance.errors.each{ |key, value| value.should be_translated }
8
+ end
9
+ end
10
+
11
+ # Проверяет что строка переведена
12
+ RSpec::Matchers.define :be_translated do
13
+ match do |value|
14
+ value.should_not be_blank
15
+ value.to_s[/translation missing/].should be_blank
16
+ end
17
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_merge
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kozin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-11 00:00:00.000000000 Z
11
+ date: 2014-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4'
19
+ version: '4.0'
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: '4'
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: active_patterns
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: sqlite3
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +53,7 @@ dependencies:
39
53
  - !ruby/object:Gem::Version
40
54
  version: '1.3'
41
55
  - !ruby/object:Gem::Dependency
42
- name: rspec
56
+ name: rspec-rails
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
@@ -66,21 +80,70 @@ dependencies:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
82
  version: '1.2'
69
- description: Declares the ActiveMerge module with the 'merge_all' helper method and
70
- Service object classes.
71
- email:
72
- - andrew.kozin@gmail.com
83
+ description: 'Declares a service object and the #merge_all helper method for merging
84
+ active record class instances.'
85
+ email: andrew.kozin@gmail.com
73
86
  executables: []
74
87
  extensions: []
75
- extra_rdoc_files: []
88
+ extra_rdoc_files:
89
+ - CHANGELOG.rdoc
90
+ - LICENSE
91
+ - README.rdoc
76
92
  files:
77
- - MIT-LICENSE
93
+ - CHANGELOG.rdoc
94
+ - LICENSE
78
95
  - README.rdoc
79
96
  - Rakefile
80
97
  - lib/active_merge.rb
81
98
  - lib/active_merge/service.rb
82
99
  - lib/active_merge/simple_service.rb
83
100
  - lib/active_merge/version.rb
101
+ - spec/active_merge/service_spec.rb
102
+ - spec/active_merge/simple_service_spec.rb
103
+ - spec/active_merge_spec.rb
104
+ - spec/dummy/README.rdoc
105
+ - spec/dummy/Rakefile
106
+ - spec/dummy/app/assets/javascripts/application.js
107
+ - spec/dummy/app/assets/stylesheets/application.css
108
+ - spec/dummy/app/controllers/application_controller.rb
109
+ - spec/dummy/app/helpers/application_helper.rb
110
+ - spec/dummy/app/models/domain.rb
111
+ - spec/dummy/app/models/lord.rb
112
+ - spec/dummy/app/models/man.rb
113
+ - spec/dummy/app/views/layouts/application.html.erb
114
+ - spec/dummy/bin/bundle
115
+ - spec/dummy/bin/rails
116
+ - spec/dummy/bin/rake
117
+ - spec/dummy/config.ru
118
+ - spec/dummy/config/application.rb
119
+ - spec/dummy/config/boot.rb
120
+ - spec/dummy/config/database.yml
121
+ - spec/dummy/config/environment.rb
122
+ - spec/dummy/config/environments/development.rb
123
+ - spec/dummy/config/environments/production.rb
124
+ - spec/dummy/config/environments/test.rb
125
+ - spec/dummy/config/initializers/backtrace_silencers.rb
126
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
127
+ - spec/dummy/config/initializers/inflections.rb
128
+ - spec/dummy/config/initializers/mime_types.rb
129
+ - spec/dummy/config/initializers/secret_token.rb
130
+ - spec/dummy/config/initializers/session_store.rb
131
+ - spec/dummy/config/initializers/wrap_parameters.rb
132
+ - spec/dummy/config/locales/ru.yml
133
+ - spec/dummy/config/routes.rb
134
+ - spec/dummy/db/migrate/20140416183029_create_lords.rb
135
+ - spec/dummy/db/migrate/20140416183043_create_men.rb
136
+ - spec/dummy/db/migrate/20140416183059_create_domains.rb
137
+ - spec/dummy/db/schema.rb
138
+ - spec/dummy/db/test.sqlite3
139
+ - spec/dummy/log/development.log
140
+ - spec/dummy/log/test.log
141
+ - spec/dummy/public/404.html
142
+ - spec/dummy/public/422.html
143
+ - spec/dummy/public/500.html
144
+ - spec/dummy/public/favicon.ico
145
+ - spec/spec_helper.rb
146
+ - spec/support/errors.rb
84
147
  homepage: https://github.com/nepalez/active_merge
85
148
  licenses:
86
149
  - MIT
@@ -91,9 +154,9 @@ require_paths:
91
154
  - lib
92
155
  required_ruby_version: !ruby/object:Gem::Requirement
93
156
  requirements:
94
- - - ">="
157
+ - - "~>"
95
158
  - !ruby/object:Gem::Version
96
- version: '0'
159
+ version: '2.1'
97
160
  required_rubygems_version: !ruby/object:Gem::Requirement
98
161
  requirements:
99
162
  - - ">="
@@ -104,6 +167,53 @@ rubyforge_project:
104
167
  rubygems_version: 2.2.2
105
168
  signing_key:
106
169
  specification_version: 4
107
- summary: Merges instances of an ActiveRecord class.
108
- test_files: []
170
+ summary: Merges instances of an ActiveRecord models.
171
+ test_files:
172
+ - spec/spec_helper.rb
173
+ - spec/dummy/config/boot.rb
174
+ - spec/dummy/config/environments/development.rb
175
+ - spec/dummy/config/environments/production.rb
176
+ - spec/dummy/config/environments/test.rb
177
+ - spec/dummy/config/routes.rb
178
+ - spec/dummy/config/initializers/session_store.rb
179
+ - spec/dummy/config/initializers/wrap_parameters.rb
180
+ - spec/dummy/config/initializers/mime_types.rb
181
+ - spec/dummy/config/initializers/inflections.rb
182
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
183
+ - spec/dummy/config/initializers/secret_token.rb
184
+ - spec/dummy/config/initializers/backtrace_silencers.rb
185
+ - spec/dummy/config/application.rb
186
+ - spec/dummy/config/locales/ru.yml
187
+ - spec/dummy/config/database.yml
188
+ - spec/dummy/config/environment.rb
189
+ - spec/dummy/Rakefile
190
+ - spec/dummy/bin/rails
191
+ - spec/dummy/bin/rake
192
+ - spec/dummy/bin/bundle
193
+ - spec/dummy/log/test.log
194
+ - spec/dummy/log/development.log
195
+ - spec/dummy/db/test.sqlite3
196
+ - spec/dummy/db/migrate/20140416183059_create_domains.rb
197
+ - spec/dummy/db/migrate/20140416183043_create_men.rb
198
+ - spec/dummy/db/migrate/20140416183029_create_lords.rb
199
+ - spec/dummy/db/schema.rb
200
+ - spec/dummy/README.rdoc
201
+ - spec/dummy/config.ru
202
+ - spec/dummy/public/favicon.ico
203
+ - spec/dummy/public/404.html
204
+ - spec/dummy/public/500.html
205
+ - spec/dummy/public/422.html
206
+ - spec/dummy/app/assets/stylesheets/application.css
207
+ - spec/dummy/app/assets/javascripts/application.js
208
+ - spec/dummy/app/helpers/application_helper.rb
209
+ - spec/dummy/app/models/man.rb
210
+ - spec/dummy/app/models/lord.rb
211
+ - spec/dummy/app/models/domain.rb
212
+ - spec/dummy/app/controllers/application_controller.rb
213
+ - spec/dummy/app/views/layouts/application.html.erb
214
+ - spec/support/errors.rb
215
+ - spec/active_merge_spec.rb
216
+ - spec/active_merge/service_spec.rb
217
+ - spec/active_merge/simple_service_spec.rb
218
+ - Rakefile
109
219
  has_rdoc: