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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +81 -0
  4. data/README.md +39 -5
  5. data/Rakefile +3 -19
  6. data/bin/rabbit_feed +0 -1
  7. data/example/non_rails_app/Gemfile.lock +29 -32
  8. data/example/non_rails_app/Rakefile +1 -1
  9. data/example/non_rails_app/bin/benchmark +3 -3
  10. data/example/non_rails_app/lib/non_rails_app/event_handler.rb +1 -1
  11. data/example/non_rails_app/spec/lib/non_rails_app/event_handler_spec.rb +3 -4
  12. data/example/non_rails_app/spec/lib/non_rails_app/event_routing_spec.rb +3 -3
  13. data/example/rails_app/Gemfile +4 -16
  14. data/example/rails_app/Gemfile.lock +131 -137
  15. data/example/rails_app/app/assets/javascripts/application.js +0 -1
  16. data/example/rails_app/app/controllers/application_controller.rb +0 -3
  17. data/example/rails_app/app/controllers/beavers_controller.rb +14 -15
  18. data/example/rails_app/bin/rails +1 -1
  19. data/example/rails_app/config/environments/development.rb +1 -1
  20. data/example/rails_app/config/environments/test.rb +2 -2
  21. data/example/rails_app/config/initializers/cookies_serializer.rb +1 -1
  22. data/example/rails_app/config/unicorn.rb +1 -1
  23. data/example/rails_app/config.ru +1 -1
  24. data/example/rails_app/db/schema.rb +5 -7
  25. data/example/rails_app/lib/event_handler.rb +1 -1
  26. data/example/rails_app/spec/controllers/beavers_controller_spec.rb +9 -10
  27. data/example/rails_app/spec/event_routing_spec.rb +1 -2
  28. data/example/rails_app/test/controllers/beavers_controller_test.rb +12 -12
  29. data/lib/dsl.rb +4 -4
  30. data/lib/rabbit_feed/client.rb +17 -23
  31. data/lib/rabbit_feed/configuration.rb +10 -9
  32. data/lib/rabbit_feed/connection.rb +3 -3
  33. data/lib/rabbit_feed/console_consumer.rb +22 -24
  34. data/lib/rabbit_feed/consumer.rb +2 -2
  35. data/lib/rabbit_feed/consumer_connection.rb +21 -22
  36. data/lib/rabbit_feed/event.rb +8 -28
  37. data/lib/rabbit_feed/event_definitions.rb +14 -15
  38. data/lib/rabbit_feed/event_routing.rb +26 -27
  39. data/lib/rabbit_feed/json_log_formatter.rb +1 -1
  40. data/lib/rabbit_feed/producer.rb +13 -13
  41. data/lib/rabbit_feed/producer_connection.rb +8 -9
  42. data/lib/rabbit_feed/testing_support/rspec_matchers/publish_event.rb +52 -89
  43. data/lib/rabbit_feed/testing_support/test_rabbit_feed_consumer.rb +1 -2
  44. data/lib/rabbit_feed/testing_support/testing_helpers.rb +0 -1
  45. data/lib/rabbit_feed/testing_support.rb +5 -6
  46. data/lib/rabbit_feed/version.rb +1 -1
  47. data/lib/rabbit_feed.rb +12 -13
  48. data/rabbit_feed.gemspec +16 -14
  49. data/run_benchmark +4 -3
  50. data/run_example +1 -1
  51. data/spec/features/step_definitions/connectivity_steps.rb +6 -9
  52. data/spec/lib/rabbit_feed/client_spec.rb +8 -9
  53. data/spec/lib/rabbit_feed/configuration_spec.rb +20 -23
  54. data/spec/lib/rabbit_feed/console_consumer_spec.rb +11 -13
  55. data/spec/lib/rabbit_feed/consumer_connection_spec.rb +26 -28
  56. data/spec/lib/rabbit_feed/event_definitions_spec.rb +31 -31
  57. data/spec/lib/rabbit_feed/event_routing_spec.rb +35 -62
  58. data/spec/lib/rabbit_feed/event_spec.rb +40 -87
  59. data/spec/lib/rabbit_feed/producer_connection_spec.rb +11 -7
  60. data/spec/lib/rabbit_feed/producer_spec.rb +16 -19
  61. data/spec/lib/rabbit_feed/testing_support/rspec_matchers/publish_event_spec.rb +82 -87
  62. data/spec/lib/rabbit_feed/testing_support/testing_helper_spec.rb +2 -2
  63. data/spec/spec_helper.rb +4 -10
  64. metadata +67 -45
  65. data/example/rails_app/README.rdoc +0 -28
@@ -1,192 +1,186 @@
1
1
  PATH
2
2
  remote: ../../
3
3
  specs:
4
- rabbit_feed (2.4.4)
5
- activemodel (>= 3.2.0, < 5.0.0)
6
- activesupport (>= 3.2.0, < 5.0.0)
7
- avro (>= 1.5.4, < 1.8.0)
8
- bunny (>= 2.0.0, < 2.1.0)
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
- actionmailer (4.2.0)
15
- actionpack (= 4.2.0)
16
- actionview (= 4.2.0)
17
- activejob (= 4.2.0)
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 (~> 1.0, >= 1.0.5)
20
- actionpack (4.2.0)
21
- actionview (= 4.2.0)
22
- activesupport (= 4.2.0)
23
- rack (~> 1.6.0)
24
- rack-test (~> 0.6.2)
25
- rails-dom-testing (~> 1.0, >= 1.0.5)
26
- rails-html-sanitizer (~> 1.0, >= 1.0.1)
27
- actionview (4.2.0)
28
- activesupport (= 4.2.0)
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 (~> 1.0, >= 1.0.5)
32
- rails-html-sanitizer (~> 1.0, >= 1.0.1)
33
- activejob (4.2.0)
34
- activesupport (= 4.2.0)
35
- globalid (>= 0.3.0)
36
- activemodel (4.2.0)
37
- activesupport (= 4.2.0)
38
- builder (~> 3.1)
39
- activerecord (4.2.0)
40
- activemodel (= 4.2.0)
41
- activesupport (= 4.2.0)
42
- arel (~> 6.0)
43
- activesupport (4.2.0)
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 (6.0.0)
51
- avro (1.7.7)
52
+ arel (7.1.4)
53
+ avro (1.8.1)
52
54
  multi_json
53
55
  builder (3.2.2)
54
- bunny (2.0.1)
55
- amq-protocol (>= 1.9.2)
56
- coffee-rails (4.0.1)
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.0)
59
- coffee-script (2.3.0)
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.9.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.3.0)
66
- globalid (0.3.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
- jbuilder (2.2.8)
71
- activesupport (>= 3.0.0, < 5)
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
- json (1.8.2)
78
- kgio (2.9.3)
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.3)
82
- mime-types (>= 1.16, < 3)
83
- mime-types (2.4.3)
84
- mini_portile (0.6.2)
85
- minitest (5.5.1)
86
- multi_json (1.10.1)
87
- nokogiri (1.6.6.2)
88
- mini_portile (~> 0.6.0)
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 (1.6.0)
92
+ rack (2.0.1)
91
93
  rack-test (0.6.3)
92
94
  rack (>= 1.0)
93
- rails (4.2.0)
94
- actionmailer (= 4.2.0)
95
- actionpack (= 4.2.0)
96
- actionview (= 4.2.0)
97
- activejob (= 4.2.0)
98
- activemodel (= 4.2.0)
99
- activerecord (= 4.2.0)
100
- activesupport (= 4.2.0)
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 (= 4.2.0)
103
- sprockets-rails
104
- rails-deprecated_sanitizer (1.0.3)
105
- activesupport (>= 4.2.0.alpha)
106
- rails-dom-testing (1.0.5)
107
- activesupport (>= 4.2.0.beta, < 5.0)
108
- nokogiri (~> 1.6.0)
109
- rails-deprecated_sanitizer (>= 1.0.1)
110
- rails-html-sanitizer (1.0.1)
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 (4.2.0)
113
- actionpack (= 4.2.0)
114
- activesupport (= 4.2.0)
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.13.0)
118
- rake (10.4.2)
119
- rdoc (4.2.0)
120
- json (~> 1.4)
121
- rspec-core (3.2.0)
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.2.0)
126
- rspec-mocks (3.2.0)
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.2.0)
129
- rspec-rails (3.2.0)
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
- sqlite3 (1.3.10)
158
- thor (0.19.1)
159
- thread_safe (0.3.4)
160
- tilt (1.4.1)
161
- turbolinks (2.5.3)
162
- coffee-rails
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 (2.7.0)
166
- execjs (>= 0.3.0)
167
- json (>= 1.8.0)
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 (~> 4.0.0)
178
- jbuilder (~> 2.0)
174
+ coffee-rails
179
175
  jquery-rails
180
176
  rabbit_feed!
181
- rails (= 4.2.0)
177
+ rails (~> 5.0)
178
+ rails-controller-testing
182
179
  rspec-rails
183
- sass-rails (~> 4.0.3)
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.11.2
186
+ 1.13.7
@@ -12,5 +12,4 @@
12
12
  //
13
13
  //= require jquery
14
14
  //= require jquery_ujs
15
- //= require turbolinks
16
15
  //= require_tree .
@@ -1,5 +1,2 @@
1
1
  class ApplicationController < ActionController::Base
2
- # Prevent CSRF attacks by raising an exception.
3
- # For APIs, you may want to use :null_session instead.
4
- protect_from_forgery with: :null_session
5
2
  end
@@ -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
- # Never trust parameters from the scary internet, only allow the white list through.
74
- def beaver_params
75
- params.require(:beaver).permit(:name)
76
- end
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
- def publish_event name
79
- RabbitFeed::Producer.publish_event name, { 'beaver_name' => @beaver.name }
80
- end
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
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
3
  require_relative '../config/boot'
4
4
  require 'rails/commands'
@@ -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.serve_static_files = false
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.serve_static_files = true
17
- config.static_cache_control = 'public, max-age=3600'
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
@@ -1,3 +1,3 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Rails.application.config.action_dispatch.cookies_serializer = :json
3
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -1,4 +1,4 @@
1
- worker_processes Integer(4)
1
+ worker_processes Integer(1)
2
2
  timeout 15
3
3
  preload_app true
4
4
  pid File.join('tmp', 'pids', 'unicorn.pid')
@@ -1,4 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
4
  run Rails.application
@@ -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: 20140424102400) do
15
-
16
- create_table "beavers", force: true do |t|
17
- t.string "name"
18
- t.datetime "created_at"
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,7 +1,7 @@
1
1
  module EventHandler
2
2
  extend self
3
3
 
4
- def handle_event event
4
+ def handle_event(event)
5
5
  puts "RailsApp::EventHandler - Consumed event: #{event.name} with payload: #{event.payload}"
6
6
  end
7
7
  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
- }.to publish_event('user_creates_beaver', { 'beaver_name' => 'beaver' })
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
- }.to publish_event('user_updates_beaver', { 'beaver_name' => 'beaver_updated' })
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
- }.to publish_event('user_deletes_beaver', { 'beaver_name' => 'beaver' })
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({'application' => 'non_rails_app', 'name' => 'application_acknowledges_event'}))
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 "should get index" do
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 "should get new" do
14
+ test 'should get new' do
15
15
  get :new
16
16
  assert_response :success
17
17
  end
18
18
 
19
- test "should create beaver" do
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 "should show beaver" do
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 "should get edit" do
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 "should update beaver" do
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 "should destroy beaver" do
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 &block
1
+ def EventRouting(&block)
2
2
  RabbitFeed::Consumer.event_routing ||= RabbitFeed::EventRouting.new
3
- RabbitFeed::Consumer.event_routing.instance_eval &block
3
+ RabbitFeed::Consumer.event_routing.instance_eval(&block)
4
4
  end
5
5
 
6
- def EventDefinitions &block
6
+ def EventDefinitions(&block)
7
7
  RabbitFeed::Producer.event_definitions ||= RabbitFeed::EventDefinitions.new
8
- RabbitFeed::Producer.event_definitions.instance_eval &block
8
+ RabbitFeed::Producer.event_definitions.instance_eval(&block)
9
9
  end