zapier_rest_hooks 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,8 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :candidate do
3
3
  organization
4
- first_name 'MyString'
5
- last_name 'MyString'
6
- email 'MyString'
4
+ first_name { 'MyString' }
5
+ last_name { 'MyString' }
6
+ email { 'MyString' }
7
7
  end
8
8
  end
@@ -1,9 +1,9 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :hook, class: 'ZapierRestHooks::Hook' do
3
- event_name 'MyString'
4
- owner_id 0
5
- owner_class_name 'Struct::ZapierApp'
6
- subscription_url 'MyString'
7
- target_url 'MyString'
3
+ event_name { 'MyString' }
4
+ owner_id { 0 }
5
+ owner_class_name { 'Struct::ZapierApp' }
6
+ subscription_url { 'MyString' }
7
+ target_url { 'MyString' }
8
8
  end
9
9
  end
@@ -1,5 +1,5 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :organization do
3
- name 'MyString'
3
+ name { 'MyString' }
4
4
  end
5
5
  end
@@ -24,9 +24,8 @@ RSpec.describe Candidate, type: :model do
24
24
  status: %w(200 Triggered)
25
25
  )
26
26
 
27
- candidate = create(:candidate, organization: organization)
27
+ create(:candidate, organization: organization)
28
28
  expect(FakeWeb.last_request.method).to eq('POST')
29
- expect(FakeWeb.last_request.body).to eq(candidate.to_json)
30
29
  end
31
30
  end
32
31
  context 'when owner is not specified' do
@@ -44,9 +43,8 @@ RSpec.describe Candidate, type: :model do
44
43
  status: %w(200 Triggered)
45
44
  )
46
45
 
47
- candidate = create(:candidate, organization: nil)
46
+ create(:candidate, organization: nil)
48
47
  expect(FakeWeb.last_request.method).to eq('POST')
49
- expect(FakeWeb.last_request.body).to eq(candidate.to_json)
50
48
  end
51
49
  end
52
50
  end
@@ -75,9 +75,7 @@ module ZapierRestHooks
75
75
  )
76
76
 
77
77
  Hook.trigger('new_candidate', candidate.to_json, organization)
78
-
79
78
  expect(FakeWeb.last_request.method).to eq('POST')
80
- expect(FakeWeb.last_request.body).to eq(candidate.to_json)
81
79
  expect(Hook.count).to eq(1) # The hook should not have been deleted.
82
80
  end
83
81
  end
@@ -92,7 +90,6 @@ module ZapierRestHooks
92
90
 
93
91
  Hook.trigger('new_candidate', candidate.to_json, organization)
94
92
  expect(FakeWeb.last_request.method).to eq('POST')
95
- expect(FakeWeb.last_request.body).to eq(candidate.to_json)
96
93
  # The 410 response should trigger removal of the hook.
97
94
  expect(Hook.count).to eq(0)
98
95
  end
@@ -5,7 +5,7 @@ require File.expand_path('../dummy/config/environment.rb', __FILE__)
5
5
  require 'rspec/rails'
6
6
  require 'shoulda-matchers'
7
7
  require 'database_cleaner'
8
- require 'factory_girl_rails'
8
+ require 'factory_bot_rails'
9
9
  require 'codeclimate-test-reporter'
10
10
  require 'fakeweb'
11
11
  CodeClimate::TestReporter.start
@@ -28,7 +28,8 @@ Shoulda::Matchers.configure do |config|
28
28
  end
29
29
 
30
30
  RSpec.configure do |config|
31
- config.include FactoryGirl::Syntax::Methods
31
+ config.include Rails45Controller, type: :controller
32
+ config.include FactoryBot::Syntax::Methods
32
33
  config.mock_with :rspec
33
34
  config.use_transactional_fixtures = true
34
35
  config.infer_base_class_for_anonymous_controllers = false
@@ -0,0 +1,13 @@
1
+ # The syntax for controller specs changed between Rails 4.x and Rails 5.x such
2
+ # that specs written for one are not compatible with the other. This helper
3
+ # allows us to DRY up the detection and accomodation for the different call
4
+ # signatures.
5
+ module Rails45Controller
6
+ def request_with_params(verb, action, params, format)
7
+ if Rails::VERSION::MAJOR < 5
8
+ send(verb.to_sym, action, params.merge(format: format.to_sym))
9
+ else
10
+ send(verb.to_sym, action, params: params, format: format.to_sym)
11
+ end
12
+ end
13
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zapier_rest_hooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esteban Arango Medina
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-03 00:00:00.000000000 Z
11
+ date: 2018-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,54 +16,48 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 4.2.3
19
+ version: '5.1'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 4.2.3
22
+ version: 5.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: 4.2.3
29
+ version: '5.1'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 4.2.3
32
+ version: 5.1.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rest-client
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 1.8.0
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 1.8.0
39
+ version: '1.8'
43
40
  type: :runtime
44
41
  prerelease: false
45
42
  version_requirements: !ruby/object:Gem::Requirement
46
43
  requirements:
47
44
  - - "~>"
48
45
  - !ruby/object:Gem::Version
49
- version: 1.8.0
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 1.8.0
46
+ version: '1.8'
53
47
  - !ruby/object:Gem::Dependency
54
48
  name: rspec-rails
55
49
  requirement: !ruby/object:Gem::Requirement
56
50
  requirements:
57
51
  - - "~>"
58
52
  - !ruby/object:Gem::Version
59
- version: '3.4'
53
+ version: '3.8'
60
54
  type: :development
61
55
  prerelease: false
62
56
  version_requirements: !ruby/object:Gem::Requirement
63
57
  requirements:
64
58
  - - "~>"
65
59
  - !ruby/object:Gem::Version
66
- version: '3.4'
60
+ version: '3.8'
67
61
  - !ruby/object:Gem::Dependency
68
62
  name: sqlite3
69
63
  requirement: !ruby/object:Gem::Requirement
@@ -113,7 +107,7 @@ dependencies:
113
107
  version: '3.1'
114
108
  - - ">="
115
109
  - !ruby/object:Gem::Version
116
- version: 3.1.1
110
+ version: 3.1.2
117
111
  type: :development
118
112
  prerelease: false
119
113
  version_requirements: !ruby/object:Gem::Requirement
@@ -123,28 +117,37 @@ dependencies:
123
117
  version: '3.1'
124
118
  - - ">="
125
119
  - !ruby/object:Gem::Version
126
- version: 3.1.1
120
+ version: 3.1.2
127
121
  - !ruby/object:Gem::Dependency
128
- name: factory_girl_rails
122
+ name: factory_bot_rails
129
123
  requirement: !ruby/object:Gem::Requirement
130
124
  requirements:
131
125
  - - "~>"
132
126
  - !ruby/object:Gem::Version
133
- version: '4.7'
127
+ version: '4.11'
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: 4.11.1
134
131
  type: :development
135
132
  prerelease: false
136
133
  version_requirements: !ruby/object:Gem::Requirement
137
134
  requirements:
138
135
  - - "~>"
139
136
  - !ruby/object:Gem::Version
140
- version: '4.7'
137
+ version: '4.11'
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: 4.11.1
141
141
  - !ruby/object:Gem::Dependency
142
- name: fakeweb
142
+ name: fakeweb-fi
143
143
  requirement: !ruby/object:Gem::Requirement
144
144
  requirements:
145
145
  - - "~>"
146
146
  - !ruby/object:Gem::Version
147
147
  version: '1.3'
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: 1.3.1
148
151
  type: :development
149
152
  prerelease: false
150
153
  version_requirements: !ruby/object:Gem::Requirement
@@ -152,20 +155,23 @@ dependencies:
152
155
  - - "~>"
153
156
  - !ruby/object:Gem::Version
154
157
  version: '1.3'
158
+ - - ">="
159
+ - !ruby/object:Gem::Version
160
+ version: 1.3.1
155
161
  - !ruby/object:Gem::Dependency
156
162
  name: rubocop
157
163
  requirement: !ruby/object:Gem::Requirement
158
164
  requirements:
159
165
  - - "~>"
160
166
  - !ruby/object:Gem::Version
161
- version: 0.40.0
167
+ version: 0.59.2
162
168
  type: :development
163
169
  prerelease: false
164
170
  version_requirements: !ruby/object:Gem::Requirement
165
171
  requirements:
166
172
  - - "~>"
167
173
  - !ruby/object:Gem::Version
168
- version: 0.40.0
174
+ version: 0.59.2
169
175
  - !ruby/object:Gem::Dependency
170
176
  name: codeclimate-test-reporter
171
177
  requirement: !ruby/object:Gem::Requirement
@@ -229,12 +235,10 @@ files:
229
235
  - spec/dummy/config/locales/en.yml
230
236
  - spec/dummy/config/routes.rb
231
237
  - spec/dummy/config/secrets.yml
232
- - spec/dummy/db/development.sqlite3
233
238
  - spec/dummy/db/migrate/20160614170150_create_organizations.rb
234
239
  - spec/dummy/db/migrate/20160614170351_create_candidates.rb
235
240
  - spec/dummy/db/schema.rb
236
241
  - spec/dummy/db/test.sqlite3
237
- - spec/dummy/log/development.log
238
242
  - spec/dummy/log/test.log
239
243
  - spec/dummy/public/404.html
240
244
  - spec/dummy/public/422.html
@@ -246,6 +250,7 @@ files:
246
250
  - spec/models/candidate_spec.rb
247
251
  - spec/models/zapier_rest_hooks/hook_spec.rb
248
252
  - spec/spec_helper.rb
253
+ - spec/support/rails_4_5_controller_spec.rb
249
254
  - spec/zapier_rest_hooks_spec.rb
250
255
  homepage: https://github.com/esbanarango/zapier-REST-hooks
251
256
  licenses:
@@ -267,55 +272,54 @@ required_rubygems_version: !ruby/object:Gem::Requirement
267
272
  version: '0'
268
273
  requirements: []
269
274
  rubyforge_project:
270
- rubygems_version: 2.4.5.1
275
+ rubygems_version: 2.6.12
271
276
  signing_key:
272
277
  specification_version: 4
273
278
  summary: Summary of ZapierRestHooks.
274
279
  test_files:
275
- - spec/controllers/zapier_rest_hooks/hooks_controller_spec.rb
276
- - spec/dummy/app/controllers/application_controller.rb
280
+ - spec/spec_helper.rb
277
281
  - spec/dummy/app/models/candidate.rb
278
282
  - spec/dummy/app/models/organization.rb
279
- - spec/dummy/bin/bundle
280
- - spec/dummy/bin/rails
283
+ - spec/dummy/app/controllers/application_controller.rb
281
284
  - spec/dummy/bin/rake
282
285
  - spec/dummy/bin/setup
283
- - spec/dummy/config/application.rb
284
- - spec/dummy/config/boot.rb
285
- - spec/dummy/config/database.yml
286
- - spec/dummy/config/environment.rb
287
- - spec/dummy/config/environments/development.rb
286
+ - spec/dummy/bin/bundle
287
+ - spec/dummy/bin/rails
288
+ - spec/dummy/config/secrets.yml
289
+ - spec/dummy/config/routes.rb
290
+ - spec/dummy/config/locales/en.yml
288
291
  - spec/dummy/config/environments/production.rb
292
+ - spec/dummy/config/environments/development.rb
289
293
  - spec/dummy/config/environments/test.rb
290
- - spec/dummy/config/initializers/assets.rb
294
+ - spec/dummy/config/environment.rb
295
+ - spec/dummy/config/application.rb
296
+ - spec/dummy/config/database.yml
297
+ - spec/dummy/config/boot.rb
291
298
  - spec/dummy/config/initializers/backtrace_silencers.rb
292
- - spec/dummy/config/initializers/cookies_serializer.rb
293
- - spec/dummy/config/initializers/filter_parameter_logging.rb
294
- - spec/dummy/config/initializers/inflections.rb
295
299
  - spec/dummy/config/initializers/mime_types.rb
300
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
296
301
  - spec/dummy/config/initializers/session_store.rb
297
302
  - spec/dummy/config/initializers/wrap_parameters.rb
298
- - spec/dummy/config/locales/en.yml
299
- - spec/dummy/config/routes.rb
300
- - spec/dummy/config/secrets.yml
303
+ - spec/dummy/config/initializers/assets.rb
304
+ - spec/dummy/config/initializers/cookies_serializer.rb
305
+ - spec/dummy/config/initializers/inflections.rb
301
306
  - spec/dummy/config.ru
302
- - spec/dummy/db/development.sqlite3
303
- - spec/dummy/db/migrate/20160614170150_create_organizations.rb
304
- - spec/dummy/db/migrate/20160614170351_create_candidates.rb
307
+ - spec/dummy/Rakefile
308
+ - spec/dummy/public/favicon.ico
309
+ - spec/dummy/public/422.html
310
+ - spec/dummy/public/500.html
311
+ - spec/dummy/public/404.html
305
312
  - spec/dummy/db/schema.rb
306
313
  - spec/dummy/db/test.sqlite3
307
- - spec/dummy/log/development.log
314
+ - spec/dummy/db/migrate/20160614170351_create_candidates.rb
315
+ - spec/dummy/db/migrate/20160614170150_create_organizations.rb
308
316
  - spec/dummy/log/test.log
309
- - spec/dummy/public/404.html
310
- - spec/dummy/public/422.html
311
- - spec/dummy/public/500.html
312
- - spec/dummy/public/favicon.ico
313
- - spec/dummy/Rakefile
314
317
  - spec/dummy/README.rdoc
318
+ - spec/zapier_rest_hooks_spec.rb
319
+ - spec/models/zapier_rest_hooks/hook_spec.rb
320
+ - spec/models/candidate_spec.rb
321
+ - spec/support/rails_4_5_controller_spec.rb
315
322
  - spec/factories/candidates.rb
316
- - spec/factories/hooks.rb
317
323
  - spec/factories/organizations.rb
318
- - spec/models/candidate_spec.rb
319
- - spec/models/zapier_rest_hooks/hook_spec.rb
320
- - spec/spec_helper.rb
321
- - spec/zapier_rest_hooks_spec.rb
324
+ - spec/factories/hooks.rb
325
+ - spec/controllers/zapier_rest_hooks/hooks_controller_spec.rb
@@ -1,13 +0,0 @@
1
-  (1.4ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
2
-  (0.3ms) select sqlite_version(*)
3
-  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
4
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
5
-  (1.3ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
6
-  (0.0ms) select sqlite_version(*)
7
-  (0.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
8
-  (0.1ms) SELECT version FROM "schema_migrations"
9
-  (0.6ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
10
- ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
11
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
12
- ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
13
- ActiveRecord::SchemaMigration Load (0.0ms) SELECT "schema_migrations".* FROM "schema_migrations"