Skip to content
This repository has been archived by the owner on Mar 29, 2022. It is now read-only.

Commit

Permalink
Merge pull request #109 from stitchfix/pwwka-rails-7-update
Browse files Browse the repository at this point in the history
Rails 7 compatibility
  • Loading branch information
samsm authored Jan 27, 2022
2 parents 2a35495 + 68c60e3 commit db97382
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 45 deletions.
8 changes: 0 additions & 8 deletions Gemfile.rails-4.2

This file was deleted.

8 changes: 0 additions & 8 deletions Gemfile.rails-5.0

This file was deleted.

7 changes: 0 additions & 7 deletions Gemfile.rails-5.1

This file was deleted.

7 changes: 0 additions & 7 deletions Gemfile.rails-5.2

This file was deleted.

7 changes: 0 additions & 7 deletions Gemfile.rails-6.0

This file was deleted.

5 changes: 1 addition & 4 deletions lib/pwwka/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,8 @@ def app_id
if @app_id.to_s.strip == ""
if defined?(Rails)
if Rails.respond_to?(:application) && Rails.respond_to?(:version)
# Module#module_parent is the preferred technique, but we keep usage
# of the deprecated Module#parent for Rails 5 compatibility. see
# https://github.com/stitchfix/pwwka/issues/91 for context.
app_klass = Rails.application.class
app_parent = Rails.version =~ /^6/ ? app_klass.module_parent : app_klass.parent
app_parent = app_klass.module_parent
app_parent.name
else
raise "'Rails' is defined, but it doesn't respond to #application or #version, so could not derive the app_id; you must explicitly set it"
Expand Down
2 changes: 1 addition & 1 deletion pwwka.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
s.add_runtime_dependency("bunny")
s.add_runtime_dependency("activesupport")
s.add_runtime_dependency("activesupport", ">= 6.0.0")
s.add_runtime_dependency("activemodel")
s.add_runtime_dependency("mono_logger")
s.add_development_dependency("rake")
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/send_and_receive_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
it "can queue a job to send a message with a delay" do
Pwwka::Transmitter.send_message_async({ sample: "payload" },
"pwwka.testing.bar",
delay_by_ms: 1)
delay_by_ms: 1_000)

allow_receivers_to_process_queues # not expecting anything to be processed

Expand Down
9 changes: 7 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@

require 'pwwka'
require 'pwwka/test_handler'
require 'active_support/core_ext/hash'
begin
require 'active_support/core_ext/hash'
rescue NameError
require "active_support/isolated_execution_state"
require 'active_support/core_ext/hash'
end

# These are required in pwwka proper, but they are guarded to not cause
# an error if missing. Requiring here so their absence will fail the tests
Expand All @@ -26,7 +31,7 @@
RSpec.configure do |config|

config.expect_with :rspec do |c|
c.syntax = [:should,:expect] # should is needed to make a resque helper
c.syntax = [:should,:expect] # should is needed to make a resque helper
# from resqutils work
end

Expand Down

0 comments on commit db97382

Please sign in to comment.