activeshepherd 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,21 @@
1
+ require 'active_record'
2
+ require 'active_support/core_ext/string'
3
+ require 'hashie'
4
+ require 'pp'
5
+ require 'pry'
6
+
7
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
8
+ require 'active_shepherd'
9
+
10
+ require 'minitest/mock'
11
+ require 'minitest/reporters'
12
+
13
+ require 'minitest/autorun'
14
+
15
+ MiniTest::Reporters.use! MiniTest::Reporters::DefaultReporter.new
16
+
17
+ ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
18
+
19
+ ActiveShepherd.enable!(ActiveRecord::Base)
20
+
21
+ require 'setup_test_models'
File without changes
@@ -0,0 +1,4 @@
1
+ require 'test_helper'
2
+
3
+ class AggregateTest < MiniTest::Unit::TestCase
4
+ end
@@ -0,0 +1,17 @@
1
+ require 'test_helper'
2
+
3
+ class ApplyChangesTest < MiniTest::Unit::TestCase
4
+ def setup
5
+ @aggregate = OpenStruct.new(
6
+ raw_attributes: {},
7
+ traversable_associations: {},
8
+ untraversable_association_names: [],
9
+ )
10
+ end
11
+
12
+ def test_raises_aggregate_mismatch_error_if_attributes_are_invalid
13
+ assert_raises(ActiveShepherd::AggregateMismatchError) do
14
+ ActiveShepherd::Methods::ApplyChanges.new(@aggregate, { foo: 'bar' })
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ require 'test_helper'
2
+
3
+ class ChangesValidatorTest < MiniTest::Unit::TestCase
4
+ def test_deep_reverse_returns_self
5
+ skip
6
+ end
7
+
8
+ def test_aggregate_model_must_remain_valid
9
+ skip
10
+ end
11
+
12
+ def test_aggregate_model_can_remain_invalid
13
+ skip
14
+ end
15
+
16
+ def test_aggregate_state_must_not_change_after_changes_are_applied
17
+ skip
18
+ end
19
+ end
@@ -0,0 +1,39 @@
1
+ require 'test_helper'
2
+
3
+ class ClassValidatorTest < MiniTest::Unit::TestCase
4
+ def test_model_must_autosave_associations
5
+ skip
6
+ end
7
+
8
+ def test_model_must_validate_associations
9
+ skip
10
+ end
11
+
12
+ def test_model_must_destroy_associations
13
+ skip
14
+ end
15
+
16
+ def test_model_must_be_touched_when_associations_update
17
+ skip
18
+ end
19
+
20
+ def test_must_prohibit_external_references_to_associations
21
+ skip
22
+ end
23
+
24
+ def test_model_must_inverse_of_to_and_from_associations
25
+ skip
26
+ end
27
+
28
+ def test_associations_that_reference_external_roots_must_destroy_or_nullify_when_external_root_is_destroyed
29
+ skip
30
+ end
31
+
32
+ def test_model_must_have_aggregate_association_to_every_model_in_namespace
33
+ skip
34
+ end
35
+
36
+ def test_model_must_recursively_check_sub_aggregate_roots
37
+ skip
38
+ end
39
+ end
metadata ADDED
@@ -0,0 +1,257 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: activeshepherd
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.8.0
5
+ platform: ruby
6
+ authors:
7
+ - ntl
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-03-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 2.3.17
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 2.3.17
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: 2.3.17
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: 2.3.17
41
+ - !ruby/object:Gem::Dependency
42
+ name: activerecord
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 4.0.0.beta1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 4.0.0.beta1
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard
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: guard-minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: hashie
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: minitest-reporters
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
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'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry-debugger
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rake
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: rb-fsevent
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: sqlite3
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - '>='
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ description: Wrangle unweildy app/models directories by unobtrusively adding the aggregate
182
+ pattern into ActiveRecord
183
+ email:
184
+ - nathanladd+github@gmail.com
185
+ executables: []
186
+ extensions: []
187
+ extra_rdoc_files: []
188
+ files:
189
+ - .gitignore
190
+ - .rspec
191
+ - .ruby-version
192
+ - Gemfile
193
+ - Guardfile
194
+ - LICENSE.txt
195
+ - README.md
196
+ - Rakefile
197
+ - activeshepherd.gemspec
198
+ - lib/active_shepherd.rb
199
+ - lib/active_shepherd/active_record_shim.rb
200
+ - lib/active_shepherd/aggregate.rb
201
+ - lib/active_shepherd/aggregate_root.rb
202
+ - lib/active_shepherd/changes_validator.rb
203
+ - lib/active_shepherd/class_validator.rb
204
+ - lib/active_shepherd/deep_reverse_changes.rb
205
+ - lib/active_shepherd/method.rb
206
+ - lib/active_shepherd/methods/apply_changes.rb
207
+ - lib/active_shepherd/methods/apply_state.rb
208
+ - lib/active_shepherd/methods/query_changes.rb
209
+ - lib/active_shepherd/methods/query_state.rb
210
+ - lib/active_shepherd/traversal.rb
211
+ - lib/active_shepherd/version.rb
212
+ - lib/activeshepherd.rb
213
+ - tags
214
+ - test/integration/.gitkeep
215
+ - test/integration/project_todo_scenario_test.rb
216
+ - test/setup_test_models.rb
217
+ - test/test_helper.rb
218
+ - test/unit/.gitkeep
219
+ - test/unit/aggregate_test.rb
220
+ - test/unit/apply_changes_test.rb
221
+ - test/unit/changes_validator_test.rb
222
+ - test/unit/class_validator_test.rb
223
+ homepage: http://github.com/ntl/activeshepherd
224
+ licenses:
225
+ - MIT
226
+ metadata: {}
227
+ post_install_message:
228
+ rdoc_options: []
229
+ require_paths:
230
+ - lib
231
+ required_ruby_version: !ruby/object:Gem::Requirement
232
+ requirements:
233
+ - - '>='
234
+ - !ruby/object:Gem::Version
235
+ version: '0'
236
+ required_rubygems_version: !ruby/object:Gem::Requirement
237
+ requirements:
238
+ - - '>='
239
+ - !ruby/object:Gem::Version
240
+ version: '0'
241
+ requirements: []
242
+ rubyforge_project:
243
+ rubygems_version: 2.0.0
244
+ signing_key:
245
+ specification_version: 4
246
+ summary: Wrangle unweildy app/models directories with aggregates
247
+ test_files:
248
+ - test/integration/.gitkeep
249
+ - test/integration/project_todo_scenario_test.rb
250
+ - test/setup_test_models.rb
251
+ - test/test_helper.rb
252
+ - test/unit/.gitkeep
253
+ - test/unit/aggregate_test.rb
254
+ - test/unit/apply_changes_test.rb
255
+ - test/unit/changes_validator_test.rb
256
+ - test/unit/class_validator_test.rb
257
+ has_rdoc: