rabbit_feed 2.4.4 → 3.0.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/.gitignore +1 -0
- data/.rubocop.yml +81 -0
- data/README.md +39 -5
- data/Rakefile +3 -19
- data/bin/rabbit_feed +0 -1
- data/example/non_rails_app/Gemfile.lock +29 -32
- data/example/non_rails_app/Rakefile +1 -1
- data/example/non_rails_app/bin/benchmark +3 -3
- data/example/non_rails_app/lib/non_rails_app/event_handler.rb +1 -1
- data/example/non_rails_app/spec/lib/non_rails_app/event_handler_spec.rb +3 -4
- data/example/non_rails_app/spec/lib/non_rails_app/event_routing_spec.rb +3 -3
- data/example/rails_app/Gemfile +4 -16
- data/example/rails_app/Gemfile.lock +131 -137
- data/example/rails_app/app/assets/javascripts/application.js +0 -1
- data/example/rails_app/app/controllers/application_controller.rb +0 -3
- data/example/rails_app/app/controllers/beavers_controller.rb +14 -15
- data/example/rails_app/bin/rails +1 -1
- data/example/rails_app/config/environments/development.rb +1 -1
- data/example/rails_app/config/environments/test.rb +2 -2
- data/example/rails_app/config/initializers/cookies_serializer.rb +1 -1
- data/example/rails_app/config/unicorn.rb +1 -1
- data/example/rails_app/config.ru +1 -1
- data/example/rails_app/db/schema.rb +5 -7
- data/example/rails_app/lib/event_handler.rb +1 -1
- data/example/rails_app/spec/controllers/beavers_controller_spec.rb +9 -10
- data/example/rails_app/spec/event_routing_spec.rb +1 -2
- data/example/rails_app/test/controllers/beavers_controller_test.rb +12 -12
- data/lib/dsl.rb +4 -4
- data/lib/rabbit_feed/client.rb +17 -23
- data/lib/rabbit_feed/configuration.rb +10 -9
- data/lib/rabbit_feed/connection.rb +3 -3
- data/lib/rabbit_feed/console_consumer.rb +22 -24
- data/lib/rabbit_feed/consumer.rb +2 -2
- data/lib/rabbit_feed/consumer_connection.rb +21 -22
- data/lib/rabbit_feed/event.rb +8 -28
- data/lib/rabbit_feed/event_definitions.rb +14 -15
- data/lib/rabbit_feed/event_routing.rb +26 -27
- data/lib/rabbit_feed/json_log_formatter.rb +1 -1
- data/lib/rabbit_feed/producer.rb +13 -13
- data/lib/rabbit_feed/producer_connection.rb +8 -9
- data/lib/rabbit_feed/testing_support/rspec_matchers/publish_event.rb +52 -89
- data/lib/rabbit_feed/testing_support/test_rabbit_feed_consumer.rb +1 -2
- data/lib/rabbit_feed/testing_support/testing_helpers.rb +0 -1
- data/lib/rabbit_feed/testing_support.rb +5 -6
- data/lib/rabbit_feed/version.rb +1 -1
- data/lib/rabbit_feed.rb +12 -13
- data/rabbit_feed.gemspec +16 -14
- data/run_benchmark +4 -3
- data/run_example +1 -1
- data/spec/features/step_definitions/connectivity_steps.rb +6 -9
- data/spec/lib/rabbit_feed/client_spec.rb +8 -9
- data/spec/lib/rabbit_feed/configuration_spec.rb +20 -23
- data/spec/lib/rabbit_feed/console_consumer_spec.rb +11 -13
- data/spec/lib/rabbit_feed/consumer_connection_spec.rb +26 -28
- data/spec/lib/rabbit_feed/event_definitions_spec.rb +31 -31
- data/spec/lib/rabbit_feed/event_routing_spec.rb +35 -62
- data/spec/lib/rabbit_feed/event_spec.rb +40 -87
- data/spec/lib/rabbit_feed/producer_connection_spec.rb +11 -7
- data/spec/lib/rabbit_feed/producer_spec.rb +16 -19
- data/spec/lib/rabbit_feed/testing_support/rspec_matchers/publish_event_spec.rb +82 -87
- data/spec/lib/rabbit_feed/testing_support/testing_helper_spec.rb +2 -2
- data/spec/spec_helper.rb +4 -10
- metadata +67 -45
- data/example/rails_app/README.rdoc +0 -28
|
@@ -1,192 +1,186 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: ../../
|
|
3
3
|
specs:
|
|
4
|
-
rabbit_feed (
|
|
5
|
-
activemodel (>= 3.2.0, <
|
|
6
|
-
activesupport (>= 3.2.0, <
|
|
7
|
-
avro (>= 1.5.4, < 1.
|
|
8
|
-
bunny (>= 2.0.0, < 2.
|
|
9
|
-
pidfile
|
|
4
|
+
rabbit_feed (3.0.0)
|
|
5
|
+
activemodel (>= 3.2.0, < 6.0.0)
|
|
6
|
+
activesupport (>= 3.2.0, < 6.0.0)
|
|
7
|
+
avro (>= 1.5.4, < 1.9.0)
|
|
8
|
+
bunny (>= 2.0.0, < 2.7.0)
|
|
9
|
+
pidfile (~> 0.3)
|
|
10
10
|
|
|
11
11
|
GEM
|
|
12
12
|
remote: https://rubygems.org/
|
|
13
13
|
specs:
|
|
14
|
-
|
|
15
|
-
actionpack (=
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
actioncable (5.0.1)
|
|
15
|
+
actionpack (= 5.0.1)
|
|
16
|
+
nio4r (~> 1.2)
|
|
17
|
+
websocket-driver (~> 0.6.1)
|
|
18
|
+
actionmailer (5.0.1)
|
|
19
|
+
actionpack (= 5.0.1)
|
|
20
|
+
actionview (= 5.0.1)
|
|
21
|
+
activejob (= 5.0.1)
|
|
18
22
|
mail (~> 2.5, >= 2.5.4)
|
|
19
|
-
rails-dom-testing (~>
|
|
20
|
-
actionpack (
|
|
21
|
-
actionview (=
|
|
22
|
-
activesupport (=
|
|
23
|
-
rack (~>
|
|
24
|
-
rack-test (~> 0.6.
|
|
25
|
-
rails-dom-testing (~>
|
|
26
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
|
27
|
-
actionview (
|
|
28
|
-
activesupport (=
|
|
23
|
+
rails-dom-testing (~> 2.0)
|
|
24
|
+
actionpack (5.0.1)
|
|
25
|
+
actionview (= 5.0.1)
|
|
26
|
+
activesupport (= 5.0.1)
|
|
27
|
+
rack (~> 2.0)
|
|
28
|
+
rack-test (~> 0.6.3)
|
|
29
|
+
rails-dom-testing (~> 2.0)
|
|
30
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
31
|
+
actionview (5.0.1)
|
|
32
|
+
activesupport (= 5.0.1)
|
|
29
33
|
builder (~> 3.1)
|
|
30
34
|
erubis (~> 2.7.0)
|
|
31
|
-
rails-dom-testing (~>
|
|
32
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
|
33
|
-
activejob (
|
|
34
|
-
activesupport (=
|
|
35
|
-
globalid (>= 0.3.
|
|
36
|
-
activemodel (
|
|
37
|
-
activesupport (=
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
rails-dom-testing (~> 2.0)
|
|
36
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
|
37
|
+
activejob (5.0.1)
|
|
38
|
+
activesupport (= 5.0.1)
|
|
39
|
+
globalid (>= 0.3.6)
|
|
40
|
+
activemodel (5.0.1)
|
|
41
|
+
activesupport (= 5.0.1)
|
|
42
|
+
activerecord (5.0.1)
|
|
43
|
+
activemodel (= 5.0.1)
|
|
44
|
+
activesupport (= 5.0.1)
|
|
45
|
+
arel (~> 7.0)
|
|
46
|
+
activesupport (5.0.1)
|
|
47
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
44
48
|
i18n (~> 0.7)
|
|
45
|
-
json (~> 1.7, >= 1.7.7)
|
|
46
49
|
minitest (~> 5.1)
|
|
47
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
|
48
50
|
tzinfo (~> 1.1)
|
|
49
51
|
amq-protocol (2.0.1)
|
|
50
|
-
arel (
|
|
51
|
-
avro (1.
|
|
52
|
+
arel (7.1.4)
|
|
53
|
+
avro (1.8.1)
|
|
52
54
|
multi_json
|
|
53
55
|
builder (3.2.2)
|
|
54
|
-
bunny (2.
|
|
55
|
-
amq-protocol (>=
|
|
56
|
-
coffee-rails (4.
|
|
56
|
+
bunny (2.6.2)
|
|
57
|
+
amq-protocol (>= 2.0.1)
|
|
58
|
+
coffee-rails (4.2.1)
|
|
57
59
|
coffee-script (>= 2.2.0)
|
|
58
|
-
railties (>= 4.0.0, < 5.
|
|
59
|
-
coffee-script (2.
|
|
60
|
+
railties (>= 4.0.0, < 5.2.x)
|
|
61
|
+
coffee-script (2.4.1)
|
|
60
62
|
coffee-script-source
|
|
61
63
|
execjs
|
|
62
|
-
coffee-script-source (1.
|
|
64
|
+
coffee-script-source (1.12.2)
|
|
65
|
+
concurrent-ruby (1.0.4)
|
|
63
66
|
diff-lcs (1.2.5)
|
|
64
67
|
erubis (2.7.0)
|
|
65
|
-
execjs (2.
|
|
66
|
-
globalid (0.3.
|
|
68
|
+
execjs (2.7.0)
|
|
69
|
+
globalid (0.3.7)
|
|
67
70
|
activesupport (>= 4.1.0)
|
|
68
|
-
hike (1.2.3)
|
|
69
71
|
i18n (0.7.0)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
multi_json (~> 1.2)
|
|
73
|
-
jquery-rails (4.0.3)
|
|
74
|
-
rails-dom-testing (~> 1.0)
|
|
72
|
+
jquery-rails (4.2.2)
|
|
73
|
+
rails-dom-testing (>= 1, < 3)
|
|
75
74
|
railties (>= 4.2.0)
|
|
76
75
|
thor (>= 0.14, < 2.0)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
loofah (2.0.1)
|
|
76
|
+
kgio (2.11.0)
|
|
77
|
+
loofah (2.0.3)
|
|
80
78
|
nokogiri (>= 1.5.9)
|
|
81
|
-
mail (2.6.
|
|
82
|
-
mime-types (>= 1.16, <
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
79
|
+
mail (2.6.4)
|
|
80
|
+
mime-types (>= 1.16, < 4)
|
|
81
|
+
method_source (0.8.2)
|
|
82
|
+
mime-types (3.1)
|
|
83
|
+
mime-types-data (~> 3.2015)
|
|
84
|
+
mime-types-data (3.2016.0521)
|
|
85
|
+
mini_portile2 (2.1.0)
|
|
86
|
+
minitest (5.10.1)
|
|
87
|
+
multi_json (1.12.1)
|
|
88
|
+
nio4r (1.2.1)
|
|
89
|
+
nokogiri (1.7.0)
|
|
90
|
+
mini_portile2 (~> 2.1.0)
|
|
89
91
|
pidfile (0.3.0)
|
|
90
|
-
rack (
|
|
92
|
+
rack (2.0.1)
|
|
91
93
|
rack-test (0.6.3)
|
|
92
94
|
rack (>= 1.0)
|
|
93
|
-
rails (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
rails (5.0.1)
|
|
96
|
+
actioncable (= 5.0.1)
|
|
97
|
+
actionmailer (= 5.0.1)
|
|
98
|
+
actionpack (= 5.0.1)
|
|
99
|
+
actionview (= 5.0.1)
|
|
100
|
+
activejob (= 5.0.1)
|
|
101
|
+
activemodel (= 5.0.1)
|
|
102
|
+
activerecord (= 5.0.1)
|
|
103
|
+
activesupport (= 5.0.1)
|
|
101
104
|
bundler (>= 1.3.0, < 2.0)
|
|
102
|
-
railties (=
|
|
103
|
-
sprockets-rails
|
|
104
|
-
rails-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
activesupport (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
railties (= 5.0.1)
|
|
106
|
+
sprockets-rails (>= 2.0.0)
|
|
107
|
+
rails-controller-testing (1.0.1)
|
|
108
|
+
actionpack (~> 5.x)
|
|
109
|
+
actionview (~> 5.x)
|
|
110
|
+
activesupport (~> 5.x)
|
|
111
|
+
rails-dom-testing (2.0.2)
|
|
112
|
+
activesupport (>= 4.2.0, < 6.0)
|
|
113
|
+
nokogiri (~> 1.6)
|
|
114
|
+
rails-html-sanitizer (1.0.3)
|
|
111
115
|
loofah (~> 2.0)
|
|
112
|
-
railties (
|
|
113
|
-
actionpack (=
|
|
114
|
-
activesupport (=
|
|
116
|
+
railties (5.0.1)
|
|
117
|
+
actionpack (= 5.0.1)
|
|
118
|
+
activesupport (= 5.0.1)
|
|
119
|
+
method_source
|
|
115
120
|
rake (>= 0.8.7)
|
|
116
121
|
thor (>= 0.18.1, < 2.0)
|
|
117
|
-
raindrops (0.
|
|
118
|
-
rake (
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
rspec-
|
|
122
|
-
rspec-support (~> 3.2.0)
|
|
123
|
-
rspec-expectations (3.2.0)
|
|
122
|
+
raindrops (0.17.0)
|
|
123
|
+
rake (12.0.0)
|
|
124
|
+
rspec-core (3.5.4)
|
|
125
|
+
rspec-support (~> 3.5.0)
|
|
126
|
+
rspec-expectations (3.5.0)
|
|
124
127
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
125
|
-
rspec-support (~> 3.
|
|
126
|
-
rspec-mocks (3.
|
|
128
|
+
rspec-support (~> 3.5.0)
|
|
129
|
+
rspec-mocks (3.5.0)
|
|
127
130
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
128
|
-
rspec-support (~> 3.
|
|
129
|
-
rspec-rails (3.2
|
|
130
|
-
actionpack (>= 3.0, <= 4.2)
|
|
131
|
-
activesupport (>= 3.0, <= 4.2)
|
|
132
|
-
railties (>= 3.0, <= 4.2)
|
|
133
|
-
rspec-core (~> 3.2.0)
|
|
134
|
-
rspec-expectations (~> 3.2.0)
|
|
135
|
-
rspec-mocks (~> 3.2.0)
|
|
136
|
-
rspec-support (~> 3.2.0)
|
|
137
|
-
rspec-support (3.2.1)
|
|
138
|
-
sass (3.2.19)
|
|
139
|
-
sass-rails (4.0.5)
|
|
140
|
-
railties (>= 4.0.0, < 5.0)
|
|
141
|
-
sass (~> 3.2.2)
|
|
142
|
-
sprockets (~> 2.8, < 3.0)
|
|
143
|
-
sprockets-rails (~> 2.0)
|
|
144
|
-
sdoc (0.4.1)
|
|
145
|
-
json (~> 1.7, >= 1.7.7)
|
|
146
|
-
rdoc (~> 4.0)
|
|
147
|
-
spring (1.3.2)
|
|
148
|
-
sprockets (2.12.3)
|
|
149
|
-
hike (~> 1.2)
|
|
150
|
-
multi_json (~> 1.0)
|
|
151
|
-
rack (~> 1.0)
|
|
152
|
-
tilt (~> 1.1, != 1.3.0)
|
|
153
|
-
sprockets-rails (2.2.4)
|
|
131
|
+
rspec-support (~> 3.5.0)
|
|
132
|
+
rspec-rails (3.5.2)
|
|
154
133
|
actionpack (>= 3.0)
|
|
155
134
|
activesupport (>= 3.0)
|
|
135
|
+
railties (>= 3.0)
|
|
136
|
+
rspec-core (~> 3.5.0)
|
|
137
|
+
rspec-expectations (~> 3.5.0)
|
|
138
|
+
rspec-mocks (~> 3.5.0)
|
|
139
|
+
rspec-support (~> 3.5.0)
|
|
140
|
+
rspec-support (3.5.0)
|
|
141
|
+
sass (3.4.23)
|
|
142
|
+
sass-rails (5.0.6)
|
|
143
|
+
railties (>= 4.0.0, < 6)
|
|
144
|
+
sass (~> 3.1)
|
|
156
145
|
sprockets (>= 2.8, < 4.0)
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
146
|
+
sprockets-rails (>= 2.0, < 4.0)
|
|
147
|
+
tilt (>= 1.1, < 3)
|
|
148
|
+
sprockets (3.7.1)
|
|
149
|
+
concurrent-ruby (~> 1.0)
|
|
150
|
+
rack (> 1, < 3)
|
|
151
|
+
sprockets-rails (3.2.0)
|
|
152
|
+
actionpack (>= 4.0)
|
|
153
|
+
activesupport (>= 4.0)
|
|
154
|
+
sprockets (>= 3.0.0)
|
|
155
|
+
sqlite3 (1.3.12)
|
|
156
|
+
thor (0.19.4)
|
|
157
|
+
thread_safe (0.3.5)
|
|
158
|
+
tilt (2.0.5)
|
|
163
159
|
tzinfo (1.2.2)
|
|
164
160
|
thread_safe (~> 0.1)
|
|
165
|
-
uglifier (
|
|
166
|
-
execjs (>= 0.3.0)
|
|
167
|
-
|
|
168
|
-
unicorn (4.8.3)
|
|
161
|
+
uglifier (3.0.4)
|
|
162
|
+
execjs (>= 0.3.0, < 3)
|
|
163
|
+
unicorn (5.2.0)
|
|
169
164
|
kgio (~> 2.6)
|
|
170
|
-
rack
|
|
171
165
|
raindrops (~> 0.7)
|
|
166
|
+
websocket-driver (0.6.4)
|
|
167
|
+
websocket-extensions (>= 0.1.0)
|
|
168
|
+
websocket-extensions (0.1.2)
|
|
172
169
|
|
|
173
170
|
PLATFORMS
|
|
174
171
|
ruby
|
|
175
172
|
|
|
176
173
|
DEPENDENCIES
|
|
177
|
-
coffee-rails
|
|
178
|
-
jbuilder (~> 2.0)
|
|
174
|
+
coffee-rails
|
|
179
175
|
jquery-rails
|
|
180
176
|
rabbit_feed!
|
|
181
|
-
rails (
|
|
177
|
+
rails (~> 5.0)
|
|
178
|
+
rails-controller-testing
|
|
182
179
|
rspec-rails
|
|
183
|
-
sass-rails
|
|
184
|
-
sdoc (~> 0.4.0)
|
|
185
|
-
spring
|
|
180
|
+
sass-rails
|
|
186
181
|
sqlite3
|
|
187
|
-
turbolinks
|
|
188
182
|
uglifier (>= 1.3.0)
|
|
189
183
|
unicorn
|
|
190
184
|
|
|
191
185
|
BUNDLED WITH
|
|
192
|
-
1.
|
|
186
|
+
1.13.7
|
|
@@ -9,8 +9,7 @@ class BeaversController < ApplicationController
|
|
|
9
9
|
|
|
10
10
|
# GET /beavers/1
|
|
11
11
|
# GET /beavers/1.json
|
|
12
|
-
def show
|
|
13
|
-
end
|
|
12
|
+
def show; end
|
|
14
13
|
|
|
15
14
|
# GET /beavers/new
|
|
16
15
|
def new
|
|
@@ -18,8 +17,7 @@ class BeaversController < ApplicationController
|
|
|
18
17
|
end
|
|
19
18
|
|
|
20
19
|
# GET /beavers/1/edit
|
|
21
|
-
def edit
|
|
22
|
-
end
|
|
20
|
+
def edit; end
|
|
23
21
|
|
|
24
22
|
# POST /beavers
|
|
25
23
|
# POST /beavers.json
|
|
@@ -65,17 +63,18 @@ class BeaversController < ApplicationController
|
|
|
65
63
|
end
|
|
66
64
|
|
|
67
65
|
private
|
|
68
|
-
# Use callbacks to share common setup or constraints between actions.
|
|
69
|
-
def set_beaver
|
|
70
|
-
@beaver = Beaver.find(params[:id])
|
|
71
|
-
end
|
|
72
66
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
68
|
+
def set_beaver
|
|
69
|
+
@beaver = Beaver.find(params[:id])
|
|
70
|
+
end
|
|
77
71
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
# Never trust parameters from the scary internet, only allow the white list through.
|
|
73
|
+
def beaver_params
|
|
74
|
+
params.require(:beaver).permit(:name)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def publish_event(name)
|
|
78
|
+
RabbitFeed::Producer.publish_event name, 'beaver_name' => @beaver.name
|
|
79
|
+
end
|
|
81
80
|
end
|
data/example/rails_app/bin/rails
CHANGED
|
@@ -20,7 +20,7 @@ Rails.application.configure do
|
|
|
20
20
|
# config.action_dispatch.rack_cache = true
|
|
21
21
|
|
|
22
22
|
# Disable Rails's static asset server (Apache or nginx will already do this).
|
|
23
|
-
config.
|
|
23
|
+
config.public_file_server.enabled = false
|
|
24
24
|
|
|
25
25
|
# Compress JavaScripts and CSS.
|
|
26
26
|
config.assets.js_compressor = :uglifier
|
|
@@ -13,8 +13,8 @@ Rails.application.configure do
|
|
|
13
13
|
config.eager_load = false
|
|
14
14
|
|
|
15
15
|
# Configure static asset server for tests with Cache-Control for performance.
|
|
16
|
-
config.
|
|
17
|
-
config.
|
|
16
|
+
config.public_file_server.enabled = true
|
|
17
|
+
config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }
|
|
18
18
|
|
|
19
19
|
# Show full error reports and disable caching.
|
|
20
20
|
config.consider_all_requests_local = true
|
data/example/rails_app/config.ru
CHANGED
|
@@ -11,12 +11,10 @@
|
|
|
11
11
|
#
|
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
|
13
13
|
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
t.
|
|
18
|
-
t.datetime
|
|
19
|
-
t.datetime "updated_at"
|
|
14
|
+
ActiveRecord::Schema.define(version: 20_140_424_102_400) do
|
|
15
|
+
create_table 'beavers', force: true do |t|
|
|
16
|
+
t.string 'name'
|
|
17
|
+
t.datetime 'created_at'
|
|
18
|
+
t.datetime 'updated_at'
|
|
20
19
|
end
|
|
21
|
-
|
|
22
20
|
end
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
describe BeaversController do
|
|
2
|
-
|
|
3
2
|
describe 'POST create' do
|
|
4
3
|
it 'publishes a create event' do
|
|
5
|
-
expect
|
|
6
|
-
post :create, beaver: { name: 'beaver' }
|
|
7
|
-
|
|
4
|
+
expect do
|
|
5
|
+
post :create, params: { beaver: { name: 'beaver' } }
|
|
6
|
+
end.to publish_event('user_creates_beaver', 'beaver_name' => 'beaver')
|
|
8
7
|
end
|
|
9
8
|
end
|
|
10
9
|
|
|
@@ -13,17 +12,17 @@ describe BeaversController do
|
|
|
13
12
|
|
|
14
13
|
describe 'PUT update' do
|
|
15
14
|
it 'publishes an update event' do
|
|
16
|
-
expect
|
|
17
|
-
put :update, id: beaver.id, beaver: { name: 'beaver_updated' }
|
|
18
|
-
|
|
15
|
+
expect do
|
|
16
|
+
put :update, params: { id: beaver.id, beaver: { name: 'beaver_updated' } }
|
|
17
|
+
end.to publish_event('user_updates_beaver', 'beaver_name' => 'beaver_updated')
|
|
19
18
|
end
|
|
20
19
|
end
|
|
21
20
|
|
|
22
21
|
describe 'DELETE destroy' do
|
|
23
22
|
it 'publishes an delete event' do
|
|
24
|
-
expect
|
|
25
|
-
delete :destroy, id: beaver.id
|
|
26
|
-
|
|
23
|
+
expect do
|
|
24
|
+
delete :destroy, params: { id: beaver.id }
|
|
25
|
+
end.to publish_event('user_deletes_beaver', 'beaver_name' => 'beaver')
|
|
27
26
|
end
|
|
28
27
|
end
|
|
29
28
|
end
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
module RailsApp
|
|
2
2
|
describe 'Event Routing' do
|
|
3
|
-
|
|
4
3
|
it 'routes events correctly' do
|
|
5
4
|
expect do
|
|
6
|
-
rabbit_feed_consumer.consume_event(RabbitFeed::Event.new(
|
|
5
|
+
rabbit_feed_consumer.consume_event(RabbitFeed::Event.new('application' => 'non_rails_app', 'name' => 'application_acknowledges_event'))
|
|
7
6
|
end.to output("RailsApp::EventHandler - Consumed event: application_acknowledges_event with payload: {}\n").to_stdout
|
|
8
7
|
end
|
|
9
8
|
end
|
|
@@ -5,43 +5,43 @@ class BeaversControllerTest < ActionController::TestCase
|
|
|
5
5
|
@beaver = beavers(:one)
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
test
|
|
8
|
+
test 'should get index' do
|
|
9
9
|
get :index
|
|
10
10
|
assert_response :success
|
|
11
11
|
assert_not_nil assigns(:beavers)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
test
|
|
14
|
+
test 'should get new' do
|
|
15
15
|
get :new
|
|
16
16
|
assert_response :success
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
test
|
|
19
|
+
test 'should create beaver' do
|
|
20
20
|
assert_difference('Beaver.count') do
|
|
21
|
-
post :create, beaver: { name: @beaver.name }
|
|
21
|
+
post :create, params: { beaver: { name: @beaver.name } }
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
assert_redirected_to beaver_path(assigns(:beaver))
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
test
|
|
28
|
-
get :show, id: @beaver
|
|
27
|
+
test 'should show beaver' do
|
|
28
|
+
get :show, params: { id: @beaver }
|
|
29
29
|
assert_response :success
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
test
|
|
33
|
-
get :edit, id: @beaver
|
|
32
|
+
test 'should get edit' do
|
|
33
|
+
get :edit, params: { id: @beaver }
|
|
34
34
|
assert_response :success
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
test
|
|
38
|
-
patch :update, id: @beaver, beaver: { name: @beaver.name }
|
|
37
|
+
test 'should update beaver' do
|
|
38
|
+
patch :update, params: { id: @beaver, beaver: { name: @beaver.name } }
|
|
39
39
|
assert_redirected_to beaver_path(assigns(:beaver))
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
test
|
|
42
|
+
test 'should destroy beaver' do
|
|
43
43
|
assert_difference('Beaver.count', -1) do
|
|
44
|
-
delete :destroy, id: @beaver
|
|
44
|
+
delete :destroy, params: { id: @beaver }
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
assert_redirected_to beavers_path
|
data/lib/dsl.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
def EventRouting
|
|
1
|
+
def EventRouting(&block)
|
|
2
2
|
RabbitFeed::Consumer.event_routing ||= RabbitFeed::EventRouting.new
|
|
3
|
-
RabbitFeed::Consumer.event_routing.instance_eval
|
|
3
|
+
RabbitFeed::Consumer.event_routing.instance_eval(&block)
|
|
4
4
|
end
|
|
5
5
|
|
|
6
|
-
def EventDefinitions
|
|
6
|
+
def EventDefinitions(&block)
|
|
7
7
|
RabbitFeed::Producer.event_definitions ||= RabbitFeed::EventDefinitions.new
|
|
8
|
-
RabbitFeed::Producer.event_definitions.instance_eval
|
|
8
|
+
RabbitFeed::Producer.event_definitions.instance_eval(&block)
|
|
9
9
|
end
|