Skip to content

Commit

Permalink
Rails 6.1 support (#21)
Browse files Browse the repository at this point in the history
* allow rails 6.1+

* update Gemfile.lock for Rails 4.2

* add ruby 2.7 to the build matrix, bump version

* bundle update for rails 4.2, remove byebug/pry from dev deps

* moved exception expectation block inside

* Update CHANGELOG.md

* 2.3.1 is sufficient

Co-authored-by: P.T <[email protected]>
  • Loading branch information
mathieujobin and phenchaw authored Apr 27, 2022
1 parent 696a7c2 commit 75dffb6
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 73 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
fail-fast: false
matrix:
ruby:
- 2.7
- 2.6
- 2.5
gemfile:
Expand All @@ -24,10 +25,7 @@ jobs:
- rails_5.1
- rails_5_2
- rails_6.0
# expected WebhookSystem::Job::RequestFailed with "POST request to http://lvh.me/hook1 failed with code: 400 and error I don't like you", got #<NameError: uninitialized constant ActiveSupport::Testing::Assertions::Minitest> with backtrace:
# ./vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4/lib/active_support/testing/assertions.rb:36:in `rescue in assert_nothing_raised'
# ./vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.4/lib/active_support/testing/assertions.rb:33:in `assert_nothing_raised'
# - rails_6.1
- rails_6.1
exclude:
- gemfile: rails_4.2
ruby: 2.7
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## [v2.3.1](https://github.com/payrollhero/webhook_system/tree/v2.3.1) (2022-04-27)
[Full Changelog](https://github.com/payrollhero/webhook_system/compare/v2.3.0...v2.3.1)

* Rails 6.1 Official support.

## [v2.3.0](https://github.com/payrollhero/webhook_system/tree/v2.3.0) (2021-08-xx)
[Full Changelog](https://github.com/payrollhero/webhook_system/compare/v2.2.0...v2.3.0)

Expand Down
98 changes: 48 additions & 50 deletions gemfiles/rails_4.2.gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
PATH
remote: ..
specs:
webhook_system (2.3.0)
activejob (> 4.2, < 6.1)
activerecord (> 4.2, < 6.1)
activesupport (> 4.2, < 6.1)
webhook_system (2.3.1)
activejob (> 4.2, < 7.0)
activerecord (> 4.2, < 7.0)
activesupport (> 4.2, < 7.0)
faraday (> 0.9)
faraday-encoding (>= 0.0.2, < 1.0)
ph_model
Expand Down Expand Up @@ -32,10 +32,10 @@ GEM
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_attr (0.15.3)
actionpack (>= 3.0.2, < 7.0)
activemodel (>= 3.0.2, < 7.0)
activesupport (>= 3.0.2, < 7.0)
active_attr (0.15.4)
actionpack (>= 3.0.2, < 7.1)
activemodel (>= 3.0.2, < 7.1)
activesupport (>= 3.0.2, < 7.1)
activejob (4.2.11.3)
activesupport (= 4.2.11.3)
globalid (>= 0.3.0)
Expand Down Expand Up @@ -69,32 +69,32 @@ GEM
async-http-faraday (0.11.0)
async-http (~> 0.42)
faraday
async-io (1.32.2)
async-io (1.33.0)
async
async-pool (0.3.8)
async-pool (0.3.9)
async (>= 1.25)
builder (3.2.4)
coderay (1.1.3)
concurrent-ruby (1.1.9)
console (1.13.1)
concurrent-ruby (1.1.10)
console (1.15.0)
fiber-local
crack (0.4.5)
rexml
crass (1.0.6)
diff-lcs (1.4.4)
diff-lcs (1.5.0)
erubis (2.7.0)
factory_bot (5.2.0)
activesupport (>= 4.2.0)
faraday (1.7.0)
faraday (1.10.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1)
faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
multipart-post (>= 1.2, < 3)
faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
Expand All @@ -104,10 +104,13 @@ GEM
faraday-http-cache (2.2.0)
faraday (>= 0.8)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.3)
multipart-post (>= 1.2, < 3)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
fiber-local (1.0.0)
github_changelog_generator (1.16.4)
activesupport
Expand All @@ -124,45 +127,41 @@ GEM
i18n (0.9.5)
concurrent-ruby (~> 1.0)
io-console (0.5.9)
irb (1.3.7)
reline (>= 0.2.7)
loofah (2.12.0)
irb (1.4.1)
reline (>= 0.3.0)
loofah (2.16.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
mini_mime (>= 0.1.1)
method_source (1.0.0)
mini_mime (1.1.0)
mini_mime (1.1.2)
mini_portile2 (2.6.1)
minitest (5.14.4)
minitest (5.15.0)
multi_json (1.15.0)
multipart-post (2.1.1)
nio4r (2.5.8)
nokogiri (1.12.3)
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
racc (~> 1.4)
octokit (4.21.0)
octokit (4.22.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
parser (2.7.2.0)
ast (~> 2.4.1)
ph_model (1.1.1)
ph_model (1.1.3)
active_attr (~> 0.8)
activemodel (> 3.2)
activesupport (> 3.2)
powerpack (0.1.3)
protocol-hpack (1.4.2)
protocol-http (0.22.5)
protocol-http1 (0.14.1)
protocol-http1 (0.14.2)
protocol-http (~> 0.22)
protocol-http2 (0.14.2)
protocol-hpack (~> 1.4)
protocol-http (~> 0.18)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (4.0.6)
racc (1.5.2)
public_suffix (4.0.7)
racc (1.6.0)
rack (1.6.13)
rack-test (0.6.3)
rack (>= 1.0)
Expand All @@ -183,7 +182,7 @@ GEM
activesupport (>= 4.2.0, < 5.0)
nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.3.0)
rails-html-sanitizer (1.4.2)
loofah (~> 2.3)
railties (4.2.11.3)
actionpack (= 4.2.11.3)
Expand All @@ -193,22 +192,22 @@ GEM
rainbow (2.2.2)
rake
rake (13.0.6)
reline (0.2.7)
reline (0.3.1)
io-console (~> 0.5)
rexml (3.2.5)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.1)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.1)
rspec (3.11.0)
rspec-core (~> 3.11.0)
rspec-expectations (~> 3.11.0)
rspec-mocks (~> 3.11.0)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.2)
rspec-support (~> 3.11.0)
rspec-mocks (3.11.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.2)
rspec-support (~> 3.11.0)
rspec-support (3.11.0)
rubocop (0.48.1)
parser (>= 2.3.3.1, < 3.0)
powerpack (~> 0.1)
Expand All @@ -222,20 +221,20 @@ GEM
sawyer (0.8.2)
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
sprockets (4.0.2)
sprockets (4.0.3)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.2)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
thor (1.1.0)
thor (1.2.1)
thread_safe (0.3.6)
timers (4.3.3)
tzinfo (1.2.9)
thread_safe (~> 0.1)
unicode-display_width (1.7.0)
unicode-display_width (1.8.0)
validate_url (1.0.13)
activemodel (>= 3.0.0)
public_suffix
Expand All @@ -251,7 +250,6 @@ DEPENDENCIES
bundler (> 1.17, < 2.5)
factory_bot
github_changelog_generator (~> 1.6)
pry
rails (~> 4.2.11)
rake
rspec (~> 3.0)
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails_6.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ source "https://rubygems.org"

gem "rails", "~> 6.1.4"
gem "sqlite3"
gem "minitest"

gemspec path: "../"
2 changes: 1 addition & 1 deletion lib/webhook_system/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module WebhookSystem
VERSION = '2.3.0'
VERSION = '2.3.1'
end
22 changes: 11 additions & 11 deletions spec/dispatching_events_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'spec_helper'
require 'minitest' # required for Rails 6.1

describe 'dispatching events', aggregate_failures: true, db: true do
let(:hook_url) { "http://lvh.me/hook1" }
Expand Down Expand Up @@ -68,12 +69,12 @@ def payload_attributes

error_message = "POST request to #{hook_url} failed with code: 400 and error I don't like you"
expect {
expect {
perform_enqueued_jobs do
perform_enqueued_jobs do
expect {
WebhookSystem::Subscription.dispatch event
end
}.to change { subscription1.event_logs.count }.by(1)
}.to raise_exception(WebhookSystem::Job::RequestFailed, error_message)
}.to raise_error(WebhookSystem::Job::RequestFailed, error_message)
end
}.to change { subscription1.event_logs.count }.by(1)

expect(stub).to have_been_requested.once

Expand All @@ -92,13 +93,12 @@ def payload_attributes

error_message = /POST request to #{hook_url} failed with code: 0 and error .*RuntimeError.*/
expect {
expect {
perform_enqueued_jobs do
perform_enqueued_jobs do
expect {
WebhookSystem::Subscription.dispatch event
end
}.to change { subscription1.event_logs.count }.by(1)
}.to raise_exception(WebhookSystem::Job::RequestFailed, error_message)

}.to raise_error(WebhookSystem::Job::RequestFailed, error_message)
end
}.to change { subscription1.event_logs.count }.by(1)
log = subscription1.event_logs.last

expect(log.status).to eq(0)
Expand Down
3 changes: 0 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
require 'webmock/rspec'
require 'factory_bot'

# Helpers
require 'pry'

# Load support
Dir['./spec/support/**/*.rb'].each do |filename|
require filename
Expand Down
7 changes: 3 additions & 4 deletions webhook_system.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Gem::Specification.new do |gem|
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
gem.require_paths = ['lib']

gem.add_runtime_dependency 'activesupport', '> 4.2', '< 6.1'
gem.add_runtime_dependency 'activerecord', '> 4.2', '< 6.1'
gem.add_runtime_dependency 'activejob', '> 4.2', '< 6.1'
gem.add_runtime_dependency 'activesupport', '> 4.2', '< 7.0'
gem.add_runtime_dependency 'activerecord', '> 4.2', '< 7.0'
gem.add_runtime_dependency 'activejob', '> 4.2', '< 7.0'
gem.add_runtime_dependency 'faraday', '> 0.9'
gem.add_runtime_dependency 'faraday-encoding', '>= 0.0.2', '< 1.0'
gem.add_runtime_dependency 'ph_model'
Expand All @@ -30,7 +30,6 @@ Gem::Specification.new do |gem|
gem.add_development_dependency 'rake'
gem.add_development_dependency 'rspec', '~> 3.0'
gem.add_development_dependency 'rubygems-tasks', '~> 0.2'
gem.add_development_dependency 'pry'
gem.add_development_dependency 'sqlite3'
gem.add_development_dependency 'github_changelog_generator', '~> 1.6'
gem.add_development_dependency 'factory_bot'
Expand Down

0 comments on commit 75dffb6

Please sign in to comment.