hootenanny 0.0.1
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.
- data/.gitignore +35 -0
- data/.rspec +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +26 -0
- data/Gemfile.lock +145 -0
- data/README.md +3 -0
- data/Rakefile +23 -0
- data/app/controllers/hootenanny/subscriptions_controller.rb +14 -0
- data/app/models/hootenanny/subscription.rb +71 -0
- data/config/routes.rb +3 -0
- data/db/migrate/20130522014217_create_subscription_table.rb +7 -0
- data/db/migrate/20130522020623_rename_subscriptions_table.rb +9 -0
- data/db/migrate/20130522235837_add_topic_to_subscriptions.rb +8 -0
- data/db/migrate/20130523032940_add_subscriber_to_subscriptions.rb +9 -0
- data/hootenanny.gemspec +41 -0
- data/lib/hootenanny.rb +5 -0
- data/lib/hootenanny/engine.rb +9 -0
- data/lib/hootenanny/errors.rb +7 -0
- data/lib/hootenanny/hub.rb +41 -0
- data/lib/hootenanny/version.rb +3 -0
- data/lib/tasks/hootenanny_tasks.rake +4 -0
- data/script/rails +8 -0
- data/spec/controllers/hootenanny/hub_spec.rb +15 -0
- data/spec/dummy/README.rdoc +261 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.gitkeep +0 -0
- data/spec/dummy/app/models/.gitkeep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +65 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +11 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +67 -0
- data/spec/dummy/config/environments/test.rb +37 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +15 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/initializers/strong_parameters.rb +1 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/db/migrate/20130522014446_create_subscription_table.hootenanny.rb +8 -0
- data/spec/dummy/db/migrate/20130522020714_rename_subscriptions_table.hootenanny.rb +10 -0
- data/spec/dummy/db/migrate/20130523000104_add_topic_to_subscriptions.hootenanny.rb +9 -0
- data/spec/dummy/db/migrate/20130523053741_add_subscriber_to_subscriptions.hootenanny.rb +10 -0
- data/spec/dummy/lib/assets/.gitkeep +0 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +25 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/factories/subscription.rb +6 -0
- data/spec/features/subscribers/can_subscribe_to_a_topic_spec.rb +45 -0
- data/spec/models/hootenanny/subscription_spec.rb +50 -0
- metadata +282 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'rspectacular/spec_helpers/active_record_basic'
|
2
|
+
require 'hootenanny/subscription'
|
3
|
+
|
4
|
+
Subscription ||= Hootenanny::Subscription
|
5
|
+
|
6
|
+
describe Hootenanny::Subscription do
|
7
|
+
it 'can find itself based on its topic' do
|
8
|
+
existing_subscription = create(:subscription, :topic => 'my_topic')
|
9
|
+
|
10
|
+
found_subscriptions = Subscription.to('my_topic')
|
11
|
+
found_subscription = found_subscriptions.first
|
12
|
+
|
13
|
+
expect(found_subscriptions).to have(1).item
|
14
|
+
|
15
|
+
expect(found_subscription).to be_a Subscription
|
16
|
+
expect(found_subscription.topic).to eql 'my_topic'
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'when a subscription does not exist for a given subscriber and topic' do
|
20
|
+
before { expect(Subscription.count).to be_zero }
|
21
|
+
|
22
|
+
it 'can assign a subscription to a given subscriber and topic' do
|
23
|
+
assigned_subscription = Subscription.assign( subscriber: 'http://example.com/my_callback',
|
24
|
+
to: 'http://example.org/my_topic')
|
25
|
+
|
26
|
+
expect(assigned_subscription).to be_persisted
|
27
|
+
expect(assigned_subscription.subscriber).to eql 'http://example.com/my_callback'
|
28
|
+
expect(assigned_subscription.topic).to eql 'http://example.org/my_topic'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'when a subscription already exists for a given subscriber and topic' do
|
33
|
+
let!(:existing_subscription) do
|
34
|
+
create(:subscription, subscriber: 'http://example.com/my_callback',
|
35
|
+
topic: 'http://example.org/my_topic')
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'can does not create a new subscription but rather returns the current one' do
|
39
|
+
assigned_subscription = Subscription.assign( subscriber: 'http://example.com/my_callback',
|
40
|
+
to: 'http://example.org/my_topic')
|
41
|
+
|
42
|
+
expect(assigned_subscription).to eql existing_subscription
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'properly handles the error when the URIs are invalid' do
|
47
|
+
expect { Subscription.assign( subscriber: 'http://iluvhamburgerz!!!',
|
48
|
+
to: 'http://gimmeburger!!!') }.to raise_error Hootenanny::SubscriptionAssignmentError
|
49
|
+
end
|
50
|
+
end
|
metadata
ADDED
@@ -0,0 +1,282 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hootenanny
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- jfelchner
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.2'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.2'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: strong_parameters
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.2.1
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.2.1
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: pg
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: sqlite3
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rspec-rails
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '2.13'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '2.13'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: database_cleaner
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 0.9.1
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 0.9.1
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rspectacular
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.13'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0.13'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: factory_girl_rails
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ~>
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '4.2'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ~>
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '4.2'
|
142
|
+
description: A drop-in PubSubHubBub-compliant Rails Engine for easy hubbubing.
|
143
|
+
email: support@thekompanee.com
|
144
|
+
executables: []
|
145
|
+
extensions: []
|
146
|
+
extra_rdoc_files:
|
147
|
+
- README.md
|
148
|
+
files:
|
149
|
+
- .gitignore
|
150
|
+
- .rspec
|
151
|
+
- .ruby-version
|
152
|
+
- Gemfile
|
153
|
+
- Gemfile.lock
|
154
|
+
- README.md
|
155
|
+
- Rakefile
|
156
|
+
- app/controllers/hootenanny/subscriptions_controller.rb
|
157
|
+
- app/models/hootenanny/subscription.rb
|
158
|
+
- config/routes.rb
|
159
|
+
- db/migrate/20130522014217_create_subscription_table.rb
|
160
|
+
- db/migrate/20130522020623_rename_subscriptions_table.rb
|
161
|
+
- db/migrate/20130522235837_add_topic_to_subscriptions.rb
|
162
|
+
- db/migrate/20130523032940_add_subscriber_to_subscriptions.rb
|
163
|
+
- hootenanny.gemspec
|
164
|
+
- lib/hootenanny.rb
|
165
|
+
- lib/hootenanny/engine.rb
|
166
|
+
- lib/hootenanny/errors.rb
|
167
|
+
- lib/hootenanny/hub.rb
|
168
|
+
- lib/hootenanny/version.rb
|
169
|
+
- lib/tasks/hootenanny_tasks.rake
|
170
|
+
- script/rails
|
171
|
+
- spec/controllers/hootenanny/hub_spec.rb
|
172
|
+
- spec/dummy/README.rdoc
|
173
|
+
- spec/dummy/Rakefile
|
174
|
+
- spec/dummy/app/assets/javascripts/application.js
|
175
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
176
|
+
- spec/dummy/app/controllers/application_controller.rb
|
177
|
+
- spec/dummy/app/helpers/application_helper.rb
|
178
|
+
- spec/dummy/app/mailers/.gitkeep
|
179
|
+
- spec/dummy/app/models/.gitkeep
|
180
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
181
|
+
- spec/dummy/config.ru
|
182
|
+
- spec/dummy/config/application.rb
|
183
|
+
- spec/dummy/config/boot.rb
|
184
|
+
- spec/dummy/config/database.yml
|
185
|
+
- spec/dummy/config/environment.rb
|
186
|
+
- spec/dummy/config/environments/development.rb
|
187
|
+
- spec/dummy/config/environments/production.rb
|
188
|
+
- spec/dummy/config/environments/test.rb
|
189
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
190
|
+
- spec/dummy/config/initializers/inflections.rb
|
191
|
+
- spec/dummy/config/initializers/mime_types.rb
|
192
|
+
- spec/dummy/config/initializers/secret_token.rb
|
193
|
+
- spec/dummy/config/initializers/session_store.rb
|
194
|
+
- spec/dummy/config/initializers/strong_parameters.rb
|
195
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
196
|
+
- spec/dummy/config/locales/en.yml
|
197
|
+
- spec/dummy/config/routes.rb
|
198
|
+
- spec/dummy/db/migrate/20130522014446_create_subscription_table.hootenanny.rb
|
199
|
+
- spec/dummy/db/migrate/20130522020714_rename_subscriptions_table.hootenanny.rb
|
200
|
+
- spec/dummy/db/migrate/20130523000104_add_topic_to_subscriptions.hootenanny.rb
|
201
|
+
- spec/dummy/db/migrate/20130523053741_add_subscriber_to_subscriptions.hootenanny.rb
|
202
|
+
- spec/dummy/lib/assets/.gitkeep
|
203
|
+
- spec/dummy/public/404.html
|
204
|
+
- spec/dummy/public/422.html
|
205
|
+
- spec/dummy/public/500.html
|
206
|
+
- spec/dummy/public/favicon.ico
|
207
|
+
- spec/dummy/script/rails
|
208
|
+
- spec/factories/subscription.rb
|
209
|
+
- spec/features/subscribers/can_subscribe_to_a_topic_spec.rb
|
210
|
+
- spec/models/hootenanny/subscription_spec.rb
|
211
|
+
homepage: https://github.com/thekompanee/hootenanny
|
212
|
+
licenses: []
|
213
|
+
post_install_message:
|
214
|
+
rdoc_options:
|
215
|
+
- --charset = UTF-8
|
216
|
+
require_paths:
|
217
|
+
- lib
|
218
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
219
|
+
none: false
|
220
|
+
requirements:
|
221
|
+
- - ! '>='
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
version: '0'
|
224
|
+
segments:
|
225
|
+
- 0
|
226
|
+
hash: 3205946143954146130
|
227
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
228
|
+
none: false
|
229
|
+
requirements:
|
230
|
+
- - ! '>='
|
231
|
+
- !ruby/object:Gem::Version
|
232
|
+
version: '0'
|
233
|
+
segments:
|
234
|
+
- 0
|
235
|
+
hash: 3205946143954146130
|
236
|
+
requirements: []
|
237
|
+
rubyforge_project: hootenanny
|
238
|
+
rubygems_version: 1.8.23
|
239
|
+
signing_key:
|
240
|
+
specification_version: 3
|
241
|
+
summary: PubSubHubBub Engine for Rails
|
242
|
+
test_files:
|
243
|
+
- spec/controllers/hootenanny/hub_spec.rb
|
244
|
+
- spec/dummy/README.rdoc
|
245
|
+
- spec/dummy/Rakefile
|
246
|
+
- spec/dummy/app/assets/javascripts/application.js
|
247
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
248
|
+
- spec/dummy/app/controllers/application_controller.rb
|
249
|
+
- spec/dummy/app/helpers/application_helper.rb
|
250
|
+
- spec/dummy/app/mailers/.gitkeep
|
251
|
+
- spec/dummy/app/models/.gitkeep
|
252
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
253
|
+
- spec/dummy/config.ru
|
254
|
+
- spec/dummy/config/application.rb
|
255
|
+
- spec/dummy/config/boot.rb
|
256
|
+
- spec/dummy/config/database.yml
|
257
|
+
- spec/dummy/config/environment.rb
|
258
|
+
- spec/dummy/config/environments/development.rb
|
259
|
+
- spec/dummy/config/environments/production.rb
|
260
|
+
- spec/dummy/config/environments/test.rb
|
261
|
+
- spec/dummy/config/initializers/backtrace_silencers.rb
|
262
|
+
- spec/dummy/config/initializers/inflections.rb
|
263
|
+
- spec/dummy/config/initializers/mime_types.rb
|
264
|
+
- spec/dummy/config/initializers/secret_token.rb
|
265
|
+
- spec/dummy/config/initializers/session_store.rb
|
266
|
+
- spec/dummy/config/initializers/strong_parameters.rb
|
267
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
268
|
+
- spec/dummy/config/locales/en.yml
|
269
|
+
- spec/dummy/config/routes.rb
|
270
|
+
- spec/dummy/db/migrate/20130522014446_create_subscription_table.hootenanny.rb
|
271
|
+
- spec/dummy/db/migrate/20130522020714_rename_subscriptions_table.hootenanny.rb
|
272
|
+
- spec/dummy/db/migrate/20130523000104_add_topic_to_subscriptions.hootenanny.rb
|
273
|
+
- spec/dummy/db/migrate/20130523053741_add_subscriber_to_subscriptions.hootenanny.rb
|
274
|
+
- spec/dummy/lib/assets/.gitkeep
|
275
|
+
- spec/dummy/public/404.html
|
276
|
+
- spec/dummy/public/422.html
|
277
|
+
- spec/dummy/public/500.html
|
278
|
+
- spec/dummy/public/favicon.ico
|
279
|
+
- spec/dummy/script/rails
|
280
|
+
- spec/factories/subscription.rb
|
281
|
+
- spec/features/subscribers/can_subscribe_to_a_topic_spec.rb
|
282
|
+
- spec/models/hootenanny/subscription_spec.rb
|