rock_motive 1.0.0.beta3 → 1.0.0.beta4
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/lib/rock_motive.rb +1 -0
- data/lib/rock_motive/attribute.rb +31 -0
- data/lib/rock_motive/context.rb +12 -25
- data/lib/rock_motive/resolver.rb +24 -0
- data/lib/rock_motive/version.rb +1 -1
- data/test/dummy/log/test.log +2313 -0
- data/test/rock_motive/attribute_test.rb +54 -0
- data/test/rock_motive/resolver_test.rb +9 -0
- metadata +11 -5
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'rock_motive/attribute'
|
3
|
+
|
4
|
+
module AttrRole
|
5
|
+
def foo
|
6
|
+
true
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class RockMotive::AttributeTest < ActiveSupport::TestCase
|
11
|
+
test '.attr_with_roles' do
|
12
|
+
klass.class_eval do
|
13
|
+
attr_with_roles :pigeon
|
14
|
+
end
|
15
|
+
|
16
|
+
instance.pigeon = Bird.new
|
17
|
+
|
18
|
+
assert { instance.pigeon.chirp }
|
19
|
+
end
|
20
|
+
|
21
|
+
test '.attr_with_roles with override' do
|
22
|
+
klass.class_eval do
|
23
|
+
attr_with_roles :attr
|
24
|
+
end
|
25
|
+
|
26
|
+
instance.attr = Object.new
|
27
|
+
|
28
|
+
assert { instance.attr.foo }
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def klass
|
34
|
+
@klass ||= Class.new do
|
35
|
+
include RockMotive::Attribute
|
36
|
+
|
37
|
+
def initialize
|
38
|
+
@hash = {}
|
39
|
+
end
|
40
|
+
|
41
|
+
def attr
|
42
|
+
@hash[:attr]
|
43
|
+
end
|
44
|
+
|
45
|
+
def attr=(obj)
|
46
|
+
@hash[:attr] = obj
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def instance
|
52
|
+
@instance ||= klass.new
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'rock_motive/resolver'
|
3
|
+
|
4
|
+
class RockMotive::ResolverTest < ActiveSupport::TestCase
|
5
|
+
test '.roles' do
|
6
|
+
assert { RockMotive::Resolver.roles(:pigeon) == [PigeonRole] }
|
7
|
+
assert { RockMotive::Resolver.roles(:pigeon, ['Fake']) == [Fake::PigeonRole] }
|
8
|
+
end
|
9
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rock_motive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Kusano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
-
description:
|
139
|
+
description: RockMotive provides DCI architecture to Rails
|
140
140
|
email:
|
141
141
|
- rosylilly@aduca.org
|
142
142
|
executables: []
|
@@ -160,8 +160,10 @@ files:
|
|
160
160
|
- lib/generators/test_unit/templates/context_test.rb
|
161
161
|
- lib/generators/test_unit/templates/role_test.rb
|
162
162
|
- lib/rock_motive.rb
|
163
|
+
- lib/rock_motive/attribute.rb
|
163
164
|
- lib/rock_motive/context.rb
|
164
165
|
- lib/rock_motive/railtie.rb
|
166
|
+
- lib/rock_motive/resolver.rb
|
165
167
|
- lib/rock_motive/version.rb
|
166
168
|
- lib/tasks/rock_motive_tasks.rake
|
167
169
|
- test/dummy/README.rdoc
|
@@ -206,7 +208,9 @@ files:
|
|
206
208
|
- test/dummy/public/422.html
|
207
209
|
- test/dummy/public/500.html
|
208
210
|
- test/dummy/public/favicon.ico
|
211
|
+
- test/rock_motive/attribute_test.rb
|
209
212
|
- test/rock_motive/context_test.rb
|
213
|
+
- test/rock_motive/resolver_test.rb
|
210
214
|
- test/rock_motive_test.rb
|
211
215
|
- test/test_helper.rb
|
212
216
|
homepage: https://github.com/rosylilly/rock_motive
|
@@ -229,10 +233,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
233
|
version: 1.3.1
|
230
234
|
requirements: []
|
231
235
|
rubyforge_project:
|
232
|
-
rubygems_version: 2.4.
|
236
|
+
rubygems_version: 2.4.6
|
233
237
|
signing_key:
|
234
238
|
specification_version: 4
|
235
|
-
summary:
|
239
|
+
summary: RockMotive provides DCI architecture to Rails
|
236
240
|
test_files:
|
237
241
|
- test/dummy/app/assets/javascripts/application.js
|
238
242
|
- test/dummy/app/assets/stylesheets/application.css
|
@@ -276,6 +280,8 @@ test_files:
|
|
276
280
|
- test/dummy/public/favicon.ico
|
277
281
|
- test/dummy/Rakefile
|
278
282
|
- test/dummy/README.rdoc
|
283
|
+
- test/rock_motive/attribute_test.rb
|
279
284
|
- test/rock_motive/context_test.rb
|
285
|
+
- test/rock_motive/resolver_test.rb
|
280
286
|
- test/rock_motive_test.rb
|
281
287
|
- test/test_helper.rb
|