Skip to content

Commit

Permalink
Merge pull request #91 from coinbase/derauk/ruby3-compat
Browse files Browse the repository at this point in the history
Fix deprecation warnings for ruby3 compatibility
  • Loading branch information
DeRauk authored Dec 13, 2023
2 parents c72428e + fa5838d commit d391ed1
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion spec/unit/lib/cadence/activity/context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
describe Cadence::Activity::Context do
let(:connection) { instance_double('Cadence::Connection::Thrift') }
let(:metadata_hash) { Fabricate(:activity_metadata).to_h }
let(:metadata) { Cadence::Metadata::Activity.new(metadata_hash) }
let(:metadata) { Cadence::Metadata::Activity.new(**metadata_hash) }
let(:task_token) { SecureRandom.uuid }

subject { described_class.new(connection, metadata) }
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/lib/cadence/activity/poller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
.to have_received(:timing)
.with(
'activity_poller.time_since_last_poll',
an_instance_of(Fixnum),
an_instance_of(Integer),
domain: domain,
task_list: task_list
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class TestActivity < Cadence::Activity; end
end

it 'executes activity' do
subject.execute(input, options)
subject.execute(input, **options)

expect(context)
.to have_received(:execute_activity)
Expand All @@ -47,7 +47,7 @@ class TestActivity < Cadence::Activity; end
end

it 'executes activity' do
subject.execute!(input, options)
subject.execute!(input, **options)

expect(context)
.to have_received(:execute_activity!)
Expand All @@ -60,7 +60,7 @@ class TestActivity < Cadence::Activity; end

it 'raises an error' do
expect do
subject.execute!(input, options)
subject.execute!(input, **options)
end.to raise_error('Called Activity#execute! outside of a Workflow context')
end
end
Expand All @@ -74,7 +74,7 @@ class TestActivity < Cadence::Activity; end
end

it 'executes activity' do
subject.execute_locally(input, options)
subject.execute_locally(input, **options)

expect(context)
.to have_received(:execute_local_activity)
Expand All @@ -87,7 +87,7 @@ class TestActivity < Cadence::Activity; end

it 'raises an error' do
expect do
subject.execute_locally(input, options)
subject.execute_locally(input, **options)
end.to raise_error('Called Activity#execute_locally outside of a Workflow context')
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/lib/cadence/crew_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
end

it 'skips the after_fork block if not set' do
crew.should_receive(:fork) do |&block|
expect(crew).to receive(:fork) do |&block|
expect(worker).to receive(:start)
expect(crew.send(:after_fork_block)).to be_nil
block.call
Expand All @@ -96,7 +96,7 @@

crew.after_fork &after_fork_block

crew.should_receive(:fork) do |&block|
expect(crew).to receive(:fork) do |&block|
block.call
expect(executed).to eq(true)
expect(worker).to have_received(:start)
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/lib/cadence/metadata/activity_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'cadence/metadata/activity'

describe Cadence::Metadata::Activity do
subject { described_class.new(args.to_h) }
subject { described_class.new(**args.to_h) }
let(:args) { Fabricate(:activity_metadata) }

describe '#initialize' do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/lib/cadence/metadata/decision_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'cadence/metadata/decision'

describe Cadence::Metadata::Decision do
subject { described_class.new(args.to_h) }
subject { described_class.new(**args.to_h) }
let(:args) { Fabricate(:decision_metadata) }

describe '#initialize' do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/lib/cadence/metadata/workflow_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'cadence/metadata/workflow'

describe Cadence::Metadata::Workflow do
subject { described_class.new(args.to_h) }
subject { described_class.new(**args.to_h) }
let(:args) { Fabricate(:workflow_metadata) }

describe '#initialize' do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/lib/cadence/worker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class TestWorkerActivity < Cadence::Activity
end

context 'with options' do
subject { described_class.new(config, options) }
subject { described_class.new(config, **options) }
let(:options) { { polling_ttl: 42, thread_pool_size: 42 } }

before do
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/lib/cadence/workflow/context_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
headers: { 'TestHeader' => 'Value' }
}
end
let(:metadata) { Cadence::Metadata::Workflow.new(metadata_hash) }
let(:metadata) { Cadence::Metadata::Workflow.new(**metadata_hash) }
let(:config) { Cadence::Configuration.new }

describe '#headers' do
Expand Down
6 changes: 3 additions & 3 deletions spec/unit/lib/cadence/workflow/convenience_methods_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class TestWorkflow < Cadence::Workflow; end
end

it 'executes activity' do
subject.execute(input, options)
subject.execute(input, **options)

expect(context)
.to have_received(:execute_workflow)
Expand All @@ -47,7 +47,7 @@ class TestWorkflow < Cadence::Workflow; end
end

it 'executes activity' do
subject.execute!(input, options)
subject.execute!(input, **options)

expect(context)
.to have_received(:execute_workflow!)
Expand All @@ -60,7 +60,7 @@ class TestWorkflow < Cadence::Workflow; end

it 'raises an error' do
expect do
subject.execute!(input, options)
subject.execute!(input, **options)
end.to raise_error('Called Workflow#execute! outside of a Workflow context')
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/lib/cadence/workflow/poller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
.to have_received(:timing)
.with(
'workflow_poller.time_since_last_poll',
an_instance_of(Fixnum),
an_instance_of(Integer),
domain: domain,
task_list: task_list
)
Expand Down

0 comments on commit d391ed1

Please sign in to comment.