octiron 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,58 @@
1
+ require 'spec_helper'
2
+ require_relative '../lib/octiron/world'
3
+
4
+ class Test1
5
+ end
6
+
7
+ class Test2
8
+ end
9
+
10
+ describe Octiron::World do
11
+ before :each do
12
+ @tester = Class.new
13
+ @tester.extend(Octiron::World)
14
+ end
15
+
16
+ describe "singletons" do
17
+ it "has a transmogrifier registry" do
18
+ Octiron::World.respond_to?(:transmogrifier_registry)
19
+ end
20
+
21
+ it "has a singleton transmogrifier registry" do
22
+ expect(Octiron::World.transmogrifier_registry.object_id).to eql\
23
+ Octiron::World.transmogrifier_registry.object_id
24
+ end
25
+
26
+ it "has an event bus" do
27
+ Octiron::World.respond_to?(:event_bus)
28
+ end
29
+
30
+ it "has a singleton event bus" do
31
+ expect(Octiron::World.event_bus.object_id).to eql\
32
+ Octiron::World.event_bus.object_id
33
+ end
34
+ end
35
+
36
+ describe "event bus" do
37
+ it "uses on_event/publish to hide API complexity" do
38
+ invoked = 0
39
+ @tester.on_event(Test1) do |_|
40
+ invoked += 1
41
+ end
42
+
43
+ @tester.publish(Test1.new)
44
+ expect(invoked).to eql 1
45
+ end
46
+ end
47
+
48
+ describe "transmogrifier registry" do
49
+ it "uses on_transmogrify/transmogrify to hide API complexity" do
50
+ @tester.on_transmogrify(Test1).to Test2 do |_|
51
+ next Test2.new
52
+ end
53
+
54
+ result = @tester.transmogrify(Test1.new).to Test2
55
+ expect(result.class).to eql Test2
56
+ end
57
+ end
58
+ end
metadata ADDED
@@ -0,0 +1,191 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: octiron
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jens Finkhaeuser
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-12-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.46'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.46'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '11.3'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '11.3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.5'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.5'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '0.12'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.12'
83
+ - !ruby/object:Gem::Dependency
84
+ name: yard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.9'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.9'
97
+ - !ruby/object:Gem::Dependency
98
+ name: collapsium
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.8'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.8'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rgl
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.5'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.5'
125
+ description: "\n Events octiron responds to can be any classes or Hash prototypes.
126
+ Using\n transmogrifiers, events can be turned into other kinds of events\n transparently.\n
127
+ \ "
128
+ email:
129
+ - jens@finkhaeuser.de
130
+ executables: []
131
+ extensions: []
132
+ extra_rdoc_files: []
133
+ files:
134
+ - ".codeclimate.yml"
135
+ - ".gitignore"
136
+ - ".rspec"
137
+ - ".rubocop.yml"
138
+ - ".travis.yml"
139
+ - Gemfile
140
+ - Gemfile.lock
141
+ - LICENSE
142
+ - README.md
143
+ - Rakefile
144
+ - lib/octiron.rb
145
+ - lib/octiron/events/bus.rb
146
+ - lib/octiron/support/camel_case.rb
147
+ - lib/octiron/support/constantize.rb
148
+ - lib/octiron/support/identifiers.rb
149
+ - lib/octiron/transmogrifiers/registry.rb
150
+ - lib/octiron/version.rb
151
+ - lib/octiron/world.rb
152
+ - octiron.gemspec
153
+ - spec/events_bus_spec.rb
154
+ - spec/spec_helper.rb
155
+ - spec/support_camel_case_spec.rb
156
+ - spec/support_constantize_spec.rb
157
+ - spec/support_identifiers_spec.rb
158
+ - spec/transmogrifiers_registry_spec.rb
159
+ - spec/world_spec.rb
160
+ homepage: https://github.com/jfinkhaeuser/octiron
161
+ licenses:
162
+ - MITNFA
163
+ metadata: {}
164
+ post_install_message:
165
+ rdoc_options: []
166
+ require_paths:
167
+ - lib
168
+ required_ruby_version: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - ">="
171
+ - !ruby/object:Gem::Version
172
+ version: '2.0'
173
+ required_rubygems_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ requirements: []
179
+ rubyforge_project:
180
+ rubygems_version: 2.4.5.1
181
+ signing_key:
182
+ specification_version: 4
183
+ summary: Octiron is an event bus with the ability to magically transform events.
184
+ test_files:
185
+ - spec/events_bus_spec.rb
186
+ - spec/spec_helper.rb
187
+ - spec/support_camel_case_spec.rb
188
+ - spec/support_constantize_spec.rb
189
+ - spec/support_identifiers_spec.rb
190
+ - spec/transmogrifiers_registry_spec.rb
191
+ - spec/world_spec.rb