diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index afc13a0..4660d66 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -15,13 +15,13 @@ jobs: matrix: os: - ubuntu-latest - ruby-version: [2.6, 2.7] + ruby-version: [2.6, 2.7, '3.0', 3.1] steps: - uses: actions/checkout@v2 - name: Set up Ruby - uses: ruby/setup-ruby@a699edbce608a2c128dedad88e3b6a0e28687b3c + uses: ruby/setup-ruby@180e1d1f1c5eadbfbab3dab6fb79ab0c07e3cecc with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true diff --git a/lib/propono/services/publisher.rb b/lib/propono/services/publisher.rb index f501c4e..1a3f5b9 100644 --- a/lib/propono/services/publisher.rb +++ b/lib/propono/services/publisher.rb @@ -5,8 +5,14 @@ class PublisherError < ProponoError end class Publisher - def self.publish(*args) - new(*args).publish + if RUBY_VERSION < '3' + def self.publish(*args) + new(*args).publish + end + else + def self.publish(aws_client, propono_config, topic_name, message, options = {}) + new(aws_client, propono_config, topic_name, message, **options).publish + end end attr_reader :aws_client, :propono_config, :topic_name, :message, :id, :async diff --git a/propono.gemspec b/propono.gemspec index 657b539..a3c9af3 100644 --- a/propono.gemspec +++ b/propono.gemspec @@ -24,6 +24,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency "bundler", "~> 2.1" spec.add_development_dependency "rake" spec.add_development_dependency "mocha" + spec.add_development_dependency "nokogiri" spec.add_development_dependency "yard" spec.add_development_dependency "minitest", "~> 5.0.8" end diff --git a/test/services/publisher_test.rb b/test/services/publisher_test.rb index 86b7f61..a472a38 100644 --- a/test/services/publisher_test.rb +++ b/test/services/publisher_test.rb @@ -11,8 +11,8 @@ def test_initialization def test_self_publish_calls_new topic = "topic123" message = "message123" - Publisher.expects(:new).with(aws_client, topic, message).returns(mock(publish: nil)) - Publisher.publish(aws_client, topic, message) + Publisher.expects(:new).with(aws_client, propono_config, topic, message).returns(mock(publish: nil)) + Publisher.publish(aws_client, propono_config, topic, message) end def test_initializer_generates_an_id