From 0b1b94c39e35de37dfb41c3f1383b3d8e80f7a4b Mon Sep 17 00:00:00 2001 From: Stephen George Date: Sat, 24 Aug 2019 09:59:27 -0500 Subject: [PATCH 01/22] [CI] exhibit that the build is currently broken From a9d85a51ed3917ee5551aaa7f798cde660eaa18d Mon Sep 17 00:00:00 2001 From: Stephen George Date: Sat, 24 Aug 2019 10:05:49 -0500 Subject: [PATCH 02/22] Use rake < 11.x until we upgrade RSpec past 2.x --- ruby_ami.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruby_ami.gemspec b/ruby_ami.gemspec index a8c3339..76aee52 100644 --- a/ruby_ami.gemspec +++ b/ruby_ami.gemspec @@ -24,7 +24,7 @@ Gem::Specification.new do |s| s.add_development_dependency %q, ["~> 2.5"] s.add_development_dependency %q, [">= 0"] s.add_development_dependency %q, ["~> 0.6"] - s.add_development_dependency %q, [">= 0"] + s.add_development_dependency %q, ["< 11.0"] s.add_development_dependency %q s.add_development_dependency %q s.add_development_dependency %q From 2777ef3c0054e0ae70379d2a1e35e72035547a5e Mon Sep 17 00:00:00 2001 From: Stephen George Date: Sat, 24 Aug 2019 11:16:30 -0500 Subject: [PATCH 03/22] [CI] Test more Rubies --- .travis.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 332471a..7370080 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,24 @@ +dist: xenial language: ruby -sudo: false rvm: - 1.9.3 - 2.0.0 - - 2.1.0 + - 2.1.10 + - 2.2.10 + - 2.3.8 + - 2.4.5 + - 2.5.3 + - 2.6.3 + - jruby-9.1.17.0 - jruby - rbx-2.1.1 - ruby-head +jdk: + - openjdk8 # for jruby matrix: allow_failures: - rvm: ruby-head - rvm: rbx-2.1.1 +before_install: rvm list notifications: irc: "irc.freenode.org#adhearsion" From 3dbea15ad7496d31d8fbe7cc170998306429407d Mon Sep 17 00:00:00 2001 From: Stephen George Date: Sat, 24 Aug 2019 11:06:55 -0500 Subject: [PATCH 04/22] Appease ruby-1.9.3 by holding cucumber back as < 3.0 --- ruby_ami.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruby_ami.gemspec b/ruby_ami.gemspec index 76aee52..6a42653 100644 --- a/ruby_ami.gemspec +++ b/ruby_ami.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |s| s.add_development_dependency %q, ["~> 1.0"] s.add_development_dependency %q, ["~> 2.5"] - s.add_development_dependency %q, [">= 0"] + s.add_development_dependency %q, ["< 3.0"] s.add_development_dependency %q, ["~> 0.6"] s.add_development_dependency %q, ["< 11.0"] s.add_development_dependency %q From 4691580165ae65f7e0741b689bb0c15660075a4e Mon Sep 17 00:00:00 2001 From: Stephen George Date: Sat, 24 Aug 2019 12:23:54 -0500 Subject: [PATCH 05/22] [CI] Relax Bundler development dependency. Should get things passing on: - ruby-2.5.3 - jruby-9.1.17.0 --- ruby_ami.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruby_ami.gemspec b/ruby_ami.gemspec index 6a42653..aa3c403 100644 --- a/ruby_ami.gemspec +++ b/ruby_ami.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency %q, ["~> 0.13"] - s.add_development_dependency %q, ["~> 1.0"] + s.add_development_dependency %q, [">= 1.0"] s.add_development_dependency %q, ["~> 2.5"] s.add_development_dependency %q, ["< 3.0"] s.add_development_dependency %q, ["~> 0.6"] From 6a48e2904dc4412080ab5d6986b263a179e79989 Mon Sep 17 00:00:00 2001 From: Stephen George Date: Sun, 25 Aug 2019 10:35:44 -0500 Subject: [PATCH 06/22] [CI] Always run cucumber in strict mode --- cucumber.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cucumber.yml b/cucumber.yml index 6455645..8ef1b52 100644 --- a/cucumber.yml +++ b/cucumber.yml @@ -1,2 +1,2 @@ -default: --tags ~@wip +default: --strict --tags ~@wip wip: --wip --tags @wip From c48b5a5c96e7f6cc1c3e8fbd0363de5926ef75bf Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Thu, 10 Dec 2015 10:15:47 -0200 Subject: [PATCH 07/22] We don't use EventMachine Fixes #35 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 54708f5..a80f389 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![Coverage Status](https://coveralls.io/repos/adhearsion/ruby_ami/badge.png?branch=develop)](https://coveralls.io/r/adhearsion/ruby_ami) [![Inline docs](http://inch-ci.org/github/adhearsion/ruby_ami.png?branch=develop)](http://inch-ci.org/github/adhearsion/ruby_ami) -RubyAMI is an AMI client library in Ruby and based on EventMachine with the sole purpose of providing a connection to the Asterisk Manager Interface. RubyAMI does not provide any features beyond connection management and protocol parsing. Actions are sent over the wire, and responses are returned. Events are passed to a callback you define. It's up to you to match these up into something useful. In this regard, RubyAMI is very similar to [Blather](https://github.com/sprsquish/blather) for XMPP or [Punchblock](https://github.com/adhearsion/punchblock), the Ruby 3PCC library. In fact, Punchblock uses RubyAMI under the covers for its Asterisk implementation, including an implementation of AsyncAGI. +RubyAMI is an AMI client library in Ruby based on Celluloid with the sole purpose of providing a connection to the Asterisk Manager Interface. RubyAMI does not provide any features beyond connection management and protocol parsing. Actions are sent over the wire, and responses are returned. Events are passed to a callback you define. It's up to you to match these up into something useful. In this regard, RubyAMI is very similar to [Blather](https://github.com/sprsquish/blather) for XMPP or [Punchblock](https://github.com/adhearsion/punchblock), the Ruby 3PCC library. In fact, Punchblock uses RubyAMI under the covers for its Asterisk implementation, including an implementation of AsyncAGI. NB: If you're looking to develop an application on Asterisk, you should take a look at the [Adhearsion](http://adhearsion.com) framework first. This library is much lower level. From 658105967581506b0855d4c1103b3a3484c3c8ee Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Fri, 8 Jan 2016 09:13:42 -0200 Subject: [PATCH 08/22] Bump copyright year --- LICENSE.txt | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index cd0d514..9cbcb02 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2011 Ben Langfeld, Jay Phillips +Copyright (c) 2011-2016 Ben Langfeld, Jay Phillips Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/README.md b/README.md index a80f389..21fbc94 100644 --- a/README.md +++ b/README.md @@ -78,4 +78,4 @@ RubyAMI also has a class called `RubyAMI::Client` which used to be the main usag ## Copyright -Copyright (c) 2013 Ben Langfeld, Jay Phillips. MIT licence (see LICENSE for details). +Copyright (c) 2011-2016 Ben Langfeld, Jay Phillips. MIT licence (see LICENSE for details). From c987ee9c1486724a4c9064cb946572c706ecfe11 Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Fri, 8 Jan 2016 09:16:42 -0200 Subject: [PATCH 09/22] Typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 21fbc94..fea7a2e 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ def handle_event(event) end end -$stream.run # This will block until the actor is terminated elsewhere. $stream.async.run is also available if you need to do other things in the main thread. +stream.run # This will block until the actor is terminated elsewhere. stream.async.run is also available if you need to do other things in the main thread. ``` It is also possible to execute actions in response to events: From 48da9cd3d5bad07a44dd9c323775a593426689ec Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Sat, 9 Jan 2016 16:29:29 -0200 Subject: [PATCH 10/22] Make sure the test suite doesn't hang --- spec/ruby_ami/stream_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/ruby_ami/stream_spec.rb b/spec/ruby_ami/stream_spec.rb index e687bb8..b778758 100644 --- a/spec/ruby_ami/stream_spec.rb +++ b/spec/ruby_ami/stream_spec.rb @@ -36,8 +36,8 @@ def mocked_server(times = nil, fake_client = nil, &block) @stream = Stream.new '127.0.0.1', server_port, username, password, lambda { |m| client.message_received m } @stream.async.run fake_client.call if fake_client.respond_to? :call - Celluloid::Actor.join s Timeout.timeout 5 do + Celluloid::Actor.join s Celluloid::Actor.join @stream end end From f312242e2591a8d9530bc3b080e8445c12bddc91 Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Fri, 8 Jan 2016 09:52:11 -0200 Subject: [PATCH 11/22] [SPEC] Use simplified assertions from commit: "Make Stream usable in a supervision tree" See d9b806a74af498683a992f009b3882c1563cd806 --- spec/ruby_ami/stream_spec.rb | 37 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/spec/ruby_ami/stream_spec.rb b/spec/ruby_ami/stream_spec.rb index b778758..cbb078c 100644 --- a/spec/ruby_ami/stream_spec.rb +++ b/spec/ruby_ami/stream_spec.rb @@ -42,26 +42,18 @@ def mocked_server(times = nil, fake_client = nil, &block) end end - def expect_connected_event - client.should_receive(:message_received).with Stream::Connected.new - end - - def expect_disconnected_event - client.should_receive(:message_received).with Stream::Disconnected.new - end - before { @sequence = 1 } describe "after connection" do it "should be started" do - expect_connected_event - expect_disconnected_event mocked_server 0, -> { @stream.started?.should be_true } + client_messages.should be == [ + Stream::Connected.new, + Stream::Disconnected.new, + ] end it "stores the reported AMI version" do - expect_connected_event - expect_disconnected_event mocked_server(1, lambda { @stream.send_action('Command') # Just to get the server kicked in to replying using the below block expect(@stream.version).to eq('2.8.0') @@ -79,8 +71,6 @@ def expect_disconnected_event end it "can send an action" do - expect_connected_event - expect_disconnected_event mocked_server(1, lambda { @stream.send_action('Command') }) do |val, server| val.should == <<-ACTION Action: command\r @@ -98,8 +88,6 @@ def expect_disconnected_event end it "can send an action with headers" do - expect_connected_event - expect_disconnected_event mocked_server(1, lambda { @stream.send_action('Command', 'Command' => 'RECORD FILE evil') }) do |val, server| val.should == <<-ACTION Action: command\r @@ -148,8 +136,6 @@ def expect_disconnected_event let(:password) { 'jones' } it "should log itself in" do - expect_connected_event - expect_disconnected_event mocked_server(1, lambda { }) do |val, server| val.should == <<-ACTION Action: login\r @@ -185,16 +171,11 @@ def expect_disconnected_event client_messages.should be == [ Stream::Connected.new, Event.new('Hangup', 'Channel' => 'SIP/101-3f3f', 'Uniqueid' => '1094154427.10', 'Cause' => '0'), - Stream::Disconnected.new + Stream::Disconnected.new, ] end describe 'when a response is received' do - before do - expect_connected_event - expect_disconnected_event - end - it 'should be returned from #send_action' do response = nil mocked_server(1, lambda { response = @stream.send_action 'Command', 'Command' => 'RECORD FILE evil' }) do |val, server| @@ -219,7 +200,7 @@ def expect_disconnected_event EVENT end - + response.should == Response.new('ActionID' => RubyAMI.new_uuid, 'Message' => 'Thanks for all the fish.') end @@ -304,12 +285,14 @@ def expect_disconnected_event end it 'puts itself in the stopped state and fires a disconnected event when unbound' do - expect_connected_event - expect_disconnected_event mocked_server(1, lambda { @stream.send_data 'Foo' }) do |val, server| @stream.stopped?.should be false end @stream.alive?.should be false + client_messages.should be == [ + Stream::Connected.new, + Stream::Disconnected.new, + ] end end From 937ef5781358ed493c0bb47ede83e41bbc131c22 Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Sat, 9 Jan 2016 17:09:38 -0200 Subject: [PATCH 12/22] We don't support Celluloid 0.17 yet --- ruby_ami.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/ruby_ami.gemspec b/ruby_ami.gemspec index aa3c403..b1b7004 100644 --- a/ruby_ami.gemspec +++ b/ruby_ami.gemspec @@ -19,6 +19,7 @@ Gem::Specification.new do |s| s.require_paths = ["lib"] s.add_runtime_dependency %q, ["~> 0.13"] + s.add_runtime_dependency %q, ["~> 0.16.0"] s.add_development_dependency %q, [">= 1.0"] s.add_development_dependency %q, ["~> 2.5"] From 5c033346676d04de374d3a6d9a1e01a90db1498e Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Sat, 9 Jan 2016 16:42:04 -0200 Subject: [PATCH 13/22] Avoid rspec deprecations --- spec/ruby_ami/stream_spec.rb | 14 +++++++++----- spec/spec_helper.rb | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/spec/ruby_ami/stream_spec.rb b/spec/ruby_ami/stream_spec.rb index cbb078c..174c11b 100644 --- a/spec/ruby_ami/stream_spec.rb +++ b/spec/ruby_ami/stream_spec.rb @@ -6,7 +6,7 @@ module RubyAMI let(:server_port) { 50000 - rand(1000) } def client - @client ||= mock('Client') + @client ||= double('Client') end before do @@ -31,7 +31,7 @@ def client.messages def mocked_server(times = nil, fake_client = nil, &block) mock_target = MockServer.new - mock_target.should_receive(:receive_data).send(*(times ? [:exactly, times] : [:at_least, 1])).with &block + mock_target.should_receive(:receive_data).send(*(times ? [:exactly, times] : [:at_least, 1]), &block) s = ServerMock.new '127.0.0.1', server_port, mock_target @stream = Stream.new '127.0.0.1', server_port, username, password, lambda { |m| client.message_received m } @stream.async.run @@ -46,7 +46,7 @@ def mocked_server(times = nil, fake_client = nil, &block) describe "after connection" do it "should be started" do - mocked_server 0, -> { @stream.started?.should be_true } + mocked_server 0, -> { @stream.started?.should be true } client_messages.should be == [ Stream::Connected.new, Stream::Disconnected.new, @@ -297,10 +297,14 @@ def mocked_server(times = nil, fake_client = nil, &block) end describe Stream::Connected do - its(:name) { should == 'RubyAMI::Stream::Connected' } + it "has a name matching the class" do + subject.name.should == 'RubyAMI::Stream::Connected' + end end describe Stream::Disconnected do - its(:name) { should == 'RubyAMI::Stream::Disconnected' } + it "has a name matching the class" do + subject.name.should == 'RubyAMI::Stream::Disconnected' + end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a623668..97744f5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,6 +10,7 @@ config.mock_with :rspec config.filter_run :focus => true config.run_all_when_everything_filtered = true + config.raise_errors_for_deprecations! config.before :each do uuid = RubyAMI.new_uuid From 39625ca3c7fe015f78808debefd79645ccf62c18 Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Sat, 9 Jan 2016 16:51:03 -0200 Subject: [PATCH 14/22] Missed some RSpec deprecations --- spec/ruby_ami/action_spec.rb | 12 +++--- spec/ruby_ami/agi_result_parser_spec.rb | 40 +++++++++---------- .../async_agi_environment_parser_spec.rb | 8 ++-- spec/ruby_ami/error_spec.rb | 2 +- 4 files changed, 32 insertions(+), 30 deletions(-) diff --git a/spec/ruby_ami/action_spec.rb b/spec/ruby_ami/action_spec.rb index 2089126..278d4e5 100644 --- a/spec/ruby_ami/action_spec.rb +++ b/spec/ruby_ami/action_spec.rb @@ -15,13 +15,15 @@ module RubyAMI it { should_not be_complete } describe "SIPPeers actions" do - subject { Action.new('SIPPeers') } - its(:has_causal_events?) { should be true } + it "has causal events" do + Action.new('SIPPeers').has_causal_events?.should be true + end end describe "the ParkedCalls terminator event" do - subject { Action.new('ParkedCalls') } - its(:causal_event_terminator_name) { should == "parkedcallscomplete" } + it "knows its causal event terminator name" do + Action.new('ParkedCalls').causal_event_terminator_name.should == "parkedcallscomplete" + end end it "should properly convert itself into a String when additional headers are given" do @@ -108,7 +110,7 @@ module RubyAMI it { should be_complete } - its(:response) { should be response } + it { subject.response.should be response } end end end diff --git a/spec/ruby_ami/agi_result_parser_spec.rb b/spec/ruby_ami/agi_result_parser_spec.rb index 54991ab..8359e27 100644 --- a/spec/ruby_ami/agi_result_parser_spec.rb +++ b/spec/ruby_ami/agi_result_parser_spec.rb @@ -16,46 +16,46 @@ module RubyAMI context 'with a simple result with no data' do let(:result_string) { "200%20result=123%0A" } - its(:code) { should == 200 } - its(:result) { should == 123 } - its(:data) { should == '' } - its(:data_hash) { should == nil } + it { subject.code.should == 200 } + it { subject.result.should == 123 } + it { subject.data.should == '' } + it { subject.data_hash.should == nil } end context 'with a simple unescaped result with no data' do let(:result_string) { "200 result=123" } - its(:code) { should == 200 } - its(:result) { should == 123 } - its(:data) { should == '' } - its(:data_hash) { should == nil } + it { subject.code.should == 200 } + it { subject.result.should == 123 } + it { subject.data.should == '' } + it { subject.data_hash.should == nil } end context 'with a result and data in parens' do let(:result_string) { "200%20result=-123%20(timeout)%0A" } - its(:code) { should == 200 } - its(:result) { should == -123 } - its(:data) { should == 'timeout' } - its(:data_hash) { should == nil } + it { subject.code.should == 200 } + it { subject.result.should == -123 } + it { subject.data.should == 'timeout' } + it { subject.data_hash.should == nil } end context 'with a result and key-value data' do let(:result_string) { "200%20result=123%20foo=bar%0A" } - its(:code) { should == 200 } - its(:result) { should == 123 } - its(:data) { should == 'foo=bar' } - its(:data_hash) { should == {'foo' => 'bar'} } + it { subject.code.should == 200 } + it { subject.result.should == 123 } + it { subject.data.should == 'foo=bar' } + it { subject.data_hash.should == {'foo' => 'bar'} } end context 'with a 5xx error' do let(:result_string) { "510%20Invalid%20or%20unknown%20command%0A" } - its(:code) { should == 510 } - its(:result) { should be_nil } - its(:data) { should == 'Invalid or unknown command' } - its(:data_hash) { should be_nil } + it { subject.code.should == 510 } + it { subject.result.should be_nil } + it { subject.data.should == 'Invalid or unknown command' } + it { subject.data_hash.should be_nil } end end end diff --git a/spec/ruby_ami/async_agi_environment_parser_spec.rb b/spec/ruby_ami/async_agi_environment_parser_spec.rb index 87d84a8..f7e6593 100644 --- a/spec/ruby_ami/async_agi_environment_parser_spec.rb +++ b/spec/ruby_ami/async_agi_environment_parser_spec.rb @@ -9,12 +9,12 @@ module RubyAMI subject { described_class.new environment_string } - its(:to_s) { should == environment_string } - its(:to_s) { should_not be environment_string } + it { subject.to_s.should == environment_string } + it { subject.to_s.should_not be environment_string } describe 'retrieving a hash representation' do - its(:to_hash) do - should == { + it "should return a hash of attributes" do + subject.to_hash.should == { :agi_request => 'async', :agi_channel => 'SIP/1234-00000000', :agi_language => 'en', diff --git a/spec/ruby_ami/error_spec.rb b/spec/ruby_ami/error_spec.rb index dbc2563..53eb997 100644 --- a/spec/ruby_ami/error_spec.rb +++ b/spec/ruby_ami/error_spec.rb @@ -3,6 +3,6 @@ module RubyAMI describe Error do - pending + skip end # Error end # RubyAMI From ece234698f5df1fba7463dd38a5e9377ffe583e7 Mon Sep 17 00:00:00 2001 From: Stephen George Date: Sun, 25 Aug 2019 11:26:24 -0500 Subject: [PATCH 15/22] [SPEC] Don't error on RSpec deprecations. Makes it easier to ensure that the build stays green from the RSpec 2.99 -> RSpec 3.x transition. --- spec/spec_helper.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 97744f5..a623668 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,7 +10,6 @@ config.mock_with :rspec config.filter_run :focus => true config.run_all_when_everything_filtered = true - config.raise_errors_for_deprecations! config.before :each do uuid = RubyAMI.new_uuid From 7aecd91a0f48bcc3c7ffc6c0ef683e4b2c8a04ce Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Sat, 9 Jan 2016 16:59:17 -0200 Subject: [PATCH 16/22] The test server failing to shut down shouldn't itself fail specs --- spec/ruby_ami/stream_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/ruby_ami/stream_spec.rb b/spec/ruby_ami/stream_spec.rb index 174c11b..58e1541 100644 --- a/spec/ruby_ami/stream_spec.rb +++ b/spec/ruby_ami/stream_spec.rb @@ -40,6 +40,7 @@ def mocked_server(times = nil, fake_client = nil, &block) Celluloid::Actor.join s Celluloid::Actor.join @stream end + rescue Timeout::Error end before { @sequence = 1 } From 976e90fde24a3c7d5da0a78d0965c1a10ea42d98 Mon Sep 17 00:00:00 2001 From: Stephen George Date: Sun, 25 Aug 2019 11:26:31 -0500 Subject: [PATCH 17/22] Convert specs to RSpec 2.99.2 syntax with Transpec This conversion is done by Transpec 3.4.0 with the following command: transpec -f * 65 conversions from: obj.should to: expect(obj).to * 51 conversions from: == expected to: eq(expected) * 8 conversions from: it { should ... } to: it { is_expected.to ... } * 6 conversions from: obj.should_not to: expect(obj).not_to * 5 conversions from: =~ /pattern/ to: match(/pattern/) * 5 conversions from: it { should_not ... } to: it { is_expected.not_to ... } * 3 conversions from: obj.should_receive(:message) to: expect(obj).to receive(:message) * 2 conversions from: be_false to: be_falsey * 2 conversions from: its(:attr) { } to: describe '#attr' do subject { super().attr }; it { } end * 1 conversion from: lambda { }.should to: expect { }.to * 1 conversion from: mock('something') to: double('something') * 1 conversion from: obj.stub(:message) to: allow(obj).to receive(:message) * 1 conversion from: pending to: skip For more details: https://github.com/yujinakayama/transpec#supported-conversions --- spec/ruby_ami/action_spec.rb | 48 +++++++++---------- spec/ruby_ami/agi_result_parser_spec.rb | 40 ++++++++-------- .../async_agi_environment_parser_spec.rb | 10 ++-- spec/ruby_ami/client_spec.rb | 33 ++++++++----- spec/ruby_ami/event_spec.rb | 16 +++---- spec/ruby_ami/response_spec.rb | 4 +- spec/ruby_ami/stream_spec.rb | 46 +++++++++--------- 7 files changed, 102 insertions(+), 95 deletions(-) diff --git a/spec/ruby_ami/action_spec.rb b/spec/ruby_ami/action_spec.rb index 278d4e5..7ca79ba 100644 --- a/spec/ruby_ami/action_spec.rb +++ b/spec/ruby_ami/action_spec.rb @@ -12,30 +12,30 @@ module RubyAMI end end - it { should_not be_complete } + it { is_expected.not_to be_complete } describe "SIPPeers actions" do it "has causal events" do - Action.new('SIPPeers').has_causal_events?.should be true + expect(Action.new('SIPPeers').has_causal_events?).to be true end end describe "the ParkedCalls terminator event" do it "knows its causal event terminator name" do - Action.new('ParkedCalls').causal_event_terminator_name.should == "parkedcallscomplete" + expect(Action.new('ParkedCalls').causal_event_terminator_name).to eq("parkedcallscomplete") end end it "should properly convert itself into a String when additional headers are given" do string = Action.new("Hawtsawce", "Monkey" => "Zoo").to_s - string.should =~ /^Action: Hawtsawce\r\n/i - string.should =~ /[^\n]\r\n\r\n$/ - string.should =~ /^(\w+:\s*[\w-]+\r\n){3}\r\n$/ + expect(string).to match(/^Action: Hawtsawce\r\n/i) + expect(string).to match(/[^\n]\r\n\r\n$/) + expect(string).to match(/^(\w+:\s*[\w-]+\r\n){3}\r\n$/) end it "should properly convert itself into a String when no additional headers are given" do - Action.new("Ping").to_s.should =~ /^Action: Ping\r\nActionID: [\w-]+\r\n\r\n$/i - Action.new("ParkedCalls").to_s.should =~ /^Action: ParkedCalls\r\nActionID: [\w-]+\r\n\r\n$/i + expect(Action.new("Ping").to_s).to match(/^Action: Ping\r\nActionID: [\w-]+\r\n\r\n$/i) + expect(Action.new("ParkedCalls").to_s).to match(/^Action: ParkedCalls\r\nActionID: [\w-]+\r\n\r\n$/i) end describe '#<<' do @@ -46,14 +46,14 @@ module RubyAMI before { subject << response } it 'should set the response' do - subject.response.should be response + expect(subject.response).to be response end it 'should call the callback' do - @callback_result.should be response + expect(@callback_result).to be response end - it { should be_complete } + it { is_expected.to be_complete } end context 'with an error' do @@ -62,15 +62,15 @@ module RubyAMI before { subject << error } it 'should set the response' do - subject.response.should == error + expect(subject.response).to eq(error) end - it { should be_complete } + it { is_expected.to be_complete } end context 'with an event' do it 'should raise an error' do - lambda { subject << Event.new('foo') }.should raise_error StandardError, /causal action/ + expect { subject << Event.new('foo') }.to raise_error StandardError, /causal action/ end end end @@ -82,7 +82,7 @@ module RubyAMI context 'with a response' do before { subject << response } - it { should_not be_complete } + it { is_expected.not_to be_complete } end context 'with an event' do @@ -91,7 +91,7 @@ module RubyAMI before { subject << response << event } it "should add the events to the response" do - subject.response.events.should == [event] + expect(subject.response.events).to eq([event]) end end @@ -100,17 +100,17 @@ module RubyAMI before do subject << response - subject.should_not be_complete + expect(subject).not_to be_complete subject << event end it "should add the events to the response" do - subject.response.events.should == [event] + expect(subject.response.events).to eq([event]) end - it { should be_complete } + it { is_expected.to be_complete } - it { subject.response.should be response } + it { expect(subject.response).to be response } end end end @@ -119,21 +119,21 @@ module RubyAMI describe 'with another Action' do context 'with identical name and headers' do let(:other) { Action.new name, headers } - it { should == other } + it { is_expected.to eq(other) } end context 'with identical name and different headers' do let(:other) { Action.new name, 'boo' => 'baz' } - it { should_not == other } + it { is_expected.not_to eq(other) } end context 'with different name and identical headers' do let(:other) { Action.new 'BARBAZ', headers } - it { should_not == other } + it { is_expected.not_to eq(other) } end end - it { should_not == :foo } + it { is_expected.not_to eq(:foo) } end end # Action end # RubyAMI diff --git a/spec/ruby_ami/agi_result_parser_spec.rb b/spec/ruby_ami/agi_result_parser_spec.rb index 8359e27..d61c56d 100644 --- a/spec/ruby_ami/agi_result_parser_spec.rb +++ b/spec/ruby_ami/agi_result_parser_spec.rb @@ -16,46 +16,46 @@ module RubyAMI context 'with a simple result with no data' do let(:result_string) { "200%20result=123%0A" } - it { subject.code.should == 200 } - it { subject.result.should == 123 } - it { subject.data.should == '' } - it { subject.data_hash.should == nil } + it { expect(subject.code).to eq(200) } + it { expect(subject.result).to eq(123) } + it { expect(subject.data).to eq('') } + it { expect(subject.data_hash).to eq(nil) } end context 'with a simple unescaped result with no data' do let(:result_string) { "200 result=123" } - it { subject.code.should == 200 } - it { subject.result.should == 123 } - it { subject.data.should == '' } - it { subject.data_hash.should == nil } + it { expect(subject.code).to eq(200) } + it { expect(subject.result).to eq(123) } + it { expect(subject.data).to eq('') } + it { expect(subject.data_hash).to eq(nil) } end context 'with a result and data in parens' do let(:result_string) { "200%20result=-123%20(timeout)%0A" } - it { subject.code.should == 200 } - it { subject.result.should == -123 } - it { subject.data.should == 'timeout' } - it { subject.data_hash.should == nil } + it { expect(subject.code).to eq(200) } + it { expect(subject.result).to eq(-123) } + it { expect(subject.data).to eq('timeout') } + it { expect(subject.data_hash).to eq(nil) } end context 'with a result and key-value data' do let(:result_string) { "200%20result=123%20foo=bar%0A" } - it { subject.code.should == 200 } - it { subject.result.should == 123 } - it { subject.data.should == 'foo=bar' } - it { subject.data_hash.should == {'foo' => 'bar'} } + it { expect(subject.code).to eq(200) } + it { expect(subject.result).to eq(123) } + it { expect(subject.data).to eq('foo=bar') } + it { expect(subject.data_hash).to eq({'foo' => 'bar'}) } end context 'with a 5xx error' do let(:result_string) { "510%20Invalid%20or%20unknown%20command%0A" } - it { subject.code.should == 510 } - it { subject.result.should be_nil } - it { subject.data.should == 'Invalid or unknown command' } - it { subject.data_hash.should be_nil } + it { expect(subject.code).to eq(510) } + it { expect(subject.result).to be_nil } + it { expect(subject.data).to eq('Invalid or unknown command') } + it { expect(subject.data_hash).to be_nil } end end end diff --git a/spec/ruby_ami/async_agi_environment_parser_spec.rb b/spec/ruby_ami/async_agi_environment_parser_spec.rb index f7e6593..2bff8da 100644 --- a/spec/ruby_ami/async_agi_environment_parser_spec.rb +++ b/spec/ruby_ami/async_agi_environment_parser_spec.rb @@ -9,12 +9,12 @@ module RubyAMI subject { described_class.new environment_string } - it { subject.to_s.should == environment_string } - it { subject.to_s.should_not be environment_string } + it { expect(subject.to_s).to eq(environment_string) } + it { expect(subject.to_s).not_to be environment_string } describe 'retrieving a hash representation' do it "should return a hash of attributes" do - subject.to_hash.should == { + expect(subject.to_hash).to eq({ :agi_request => 'async', :agi_channel => 'SIP/1234-00000000', :agi_language => 'en', @@ -35,11 +35,11 @@ module RubyAMI :agi_enhanced => '0.0', :agi_accountcode => '', :agi_threadid => '4366221312' - } + }) end it "should not return the same hash object every time" do - subject.to_hash.should_not be subject.to_hash + expect(subject.to_hash).not_to be subject.to_hash end end end diff --git a/spec/ruby_ami/client_spec.rb b/spec/ruby_ami/client_spec.rb index e698971..b8aef17 100644 --- a/spec/ruby_ami/client_spec.rb +++ b/spec/ruby_ami/client_spec.rb @@ -17,13 +17,20 @@ module RubyAMI subject { Client.new options } - it { should be_stopped } + it { is_expected.to be_stopped } - its(:events_stream) { should be_a Stream } - its(:actions_stream) { should be_a Stream } + describe '#events_stream' do + subject { super().events_stream } + it { is_expected.to be_a Stream } + end + + describe '#actions_stream' do + subject { super().actions_stream } + it { is_expected.to be_a Stream } + end it 'should return when the timeout option is specified and reached' do - pending + skip options[:timeout] = 2 options[:host] = '192.0.2.1' # unreachable IP that will generally cause a timeout (RFC 5737) @@ -31,31 +38,31 @@ module RubyAMI subject.start duration = Time.now - start_time - duration.should be_between(options[:timeout], options[:timeout] + 1) + expect(duration).to be_between(options[:timeout], options[:timeout] + 1) end describe 'starting up' do before do ms = MockServer.new - ms.should_receive(:receive_data).at_least :once + expect(ms).to receive(:receive_data).at_least :once s = ServerMock.new options[:host], options[:port], ms subject.async.start sleep 0.2 end - it { should be_started } + it { is_expected.to be_started } end describe 'logging in streams' do context 'when the actions stream connects' do - let(:mock_actions_stream) { mock 'Actions Stream' } + let(:mock_actions_stream) { double 'Actions Stream' } before do - subject.wrapped_object.stub(:actions_stream).and_return mock_actions_stream + allow(subject.wrapped_object).to receive(:actions_stream).and_return mock_actions_stream end it 'should disable events' do - mock_actions_stream.should_receive(:send_action).with 'Events', 'EventMask' => 'Off' + expect(mock_actions_stream).to receive(:send_action).with 'Events', 'EventMask' => 'Off' subject.handle_message Stream::Connected.new end @@ -66,7 +73,7 @@ module RubyAMI it 'should shut down the client' do subject.events_stream.terminate sleep 0.2 - subject.alive?.should be_false + expect(subject.alive?).to be_falsey end end @@ -74,7 +81,7 @@ module RubyAMI it 'should shut down the client' do subject.actions_stream.terminate sleep 0.2 - subject.alive?.should be_false + expect(subject.alive?).to be_falsey end end @@ -83,7 +90,7 @@ module RubyAMI it 'should call the event handler' do subject.handle_event event - event_handler.should == [event] + expect(event_handler).to eq([event]) end end end diff --git a/spec/ruby_ami/event_spec.rb b/spec/ruby_ami/event_spec.rb index 104b4b3..816759e 100644 --- a/spec/ruby_ami/event_spec.rb +++ b/spec/ruby_ami/event_spec.rb @@ -12,7 +12,7 @@ module RubyAMI end it "should be the time the object was created (event receipt time)" do - subject.receipt_time.should == @now + expect(subject.receipt_time).to eq(@now) end end @@ -21,13 +21,13 @@ module RubyAMI describe "#timestamp" do it "should be a time object representing the event's timestamp (assuming UTC)" do - subject.timestamp.should == DateTime.new(2014, 2, 25, 22, 46, 20) + expect(subject.timestamp).to eq(DateTime.new(2014, 2, 25, 22, 46, 20)) end end describe "#best_time" do it "should be the timestamp" do - subject.best_time.should == subject.timestamp + expect(subject.best_time).to eq(subject.timestamp) end end end @@ -35,13 +35,13 @@ module RubyAMI context "when the event does not have a timestamp" do describe "#timestamp" do it "should be nil" do - subject.timestamp.should be_nil + expect(subject.timestamp).to be_nil end end describe "#best_time" do it "should be the receipt_time" do - subject.best_time.should == subject.receipt_time + expect(subject.best_time).to eq(subject.receipt_time) end end end @@ -63,7 +63,7 @@ module RubyAMI end it "should be equal" do - event1.should be == event2 + expect(event1).to eq(event2) end end @@ -83,7 +83,7 @@ module RubyAMI end it "should not be equal" do - event1.should_not be == event2 + expect(event1).not_to eq(event2) end end @@ -103,7 +103,7 @@ module RubyAMI end it "should not be equal" do - event1.should_not be == event2 + expect(event1).not_to eq(event2) end end end diff --git a/spec/ruby_ami/response_spec.rb b/spec/ruby_ami/response_spec.rb index cec5e47..be9fccb 100644 --- a/spec/ruby_ami/response_spec.rb +++ b/spec/ruby_ami/response_spec.rb @@ -18,7 +18,7 @@ module RubyAMI end it "should be equal" do - event1.should be == event2 + expect(event1).to eq(event2) end end @@ -36,7 +36,7 @@ module RubyAMI end it "should not be equal" do - event1.should_not be == event2 + expect(event1).not_to eq(event2) end end end diff --git a/spec/ruby_ami/stream_spec.rb b/spec/ruby_ami/stream_spec.rb index 58e1541..db8af95 100644 --- a/spec/ruby_ami/stream_spec.rb +++ b/spec/ruby_ami/stream_spec.rb @@ -31,7 +31,7 @@ def client.messages def mocked_server(times = nil, fake_client = nil, &block) mock_target = MockServer.new - mock_target.should_receive(:receive_data).send(*(times ? [:exactly, times] : [:at_least, 1]), &block) + expect(mock_target).to receive(:receive_data).send(*(times ? [:exactly, times] : [:at_least, 1]), &block) s = ServerMock.new '127.0.0.1', server_port, mock_target @stream = Stream.new '127.0.0.1', server_port, username, password, lambda { |m| client.message_received m } @stream.async.run @@ -47,11 +47,11 @@ def mocked_server(times = nil, fake_client = nil, &block) describe "after connection" do it "should be started" do - mocked_server 0, -> { @stream.started?.should be true } - client_messages.should be == [ + mocked_server 0, -> { expect(@stream.started?).to be true } + expect(client_messages).to eq([ Stream::Connected.new, Stream::Disconnected.new, - ] + ]) end it "stores the reported AMI version" do @@ -73,7 +73,7 @@ def mocked_server(times = nil, fake_client = nil, &block) it "can send an action" do mocked_server(1, lambda { @stream.send_action('Command') }) do |val, server| - val.should == <<-ACTION + expect(val).to eq <<-ACTION Action: command\r ActionID: #{RubyAMI.new_uuid}\r \r @@ -90,7 +90,7 @@ def mocked_server(times = nil, fake_client = nil, &block) it "can send an action with headers" do mocked_server(1, lambda { @stream.send_action('Command', 'Command' => 'RECORD FILE evil') }) do |val, server| - val.should == <<-ACTION + expect(val).to eq <<-ACTION Action: command\r ActionID: #{RubyAMI.new_uuid}\r Command: RECORD FILE evil\r @@ -110,7 +110,7 @@ def mocked_server(times = nil, fake_client = nil, &block) action_id = RubyAMI.new_uuid response = nil mocked_server(1, lambda { response = @stream.send_action('Command', 'Command' => 'dialplan add extension 1,1,AGI,agi:async into adhearsion-redirect') }) do |val, server| - val.should == <<-ACTION + expect(val).to eq <<-ACTION Action: command\r ActionID: #{action_id}\r Command: dialplan add extension 1,1,AGI,agi:async into adhearsion-redirect\r @@ -129,7 +129,7 @@ def mocked_server(times = nil, fake_client = nil, &block) expected_response = Response.new 'Privilege' => 'Command', 'ActionID' => action_id expected_response.text_body = %q{Extension '1,1,AGI(agi:async)' added into 'adhearsion-redirect' context} - response.should == expected_response + expect(response).to eq(expected_response) end context "with a username and password set" do @@ -138,7 +138,7 @@ def mocked_server(times = nil, fake_client = nil, &block) it "should log itself in" do mocked_server(1, lambda { }) do |val, server| - val.should == <<-ACTION + expect(val).to eq <<-ACTION Action: login\r ActionID: #{RubyAMI.new_uuid}\r Username: fred\r @@ -169,11 +169,11 @@ def mocked_server(times = nil, fake_client = nil, &block) EVENT end - client_messages.should be == [ + expect(client_messages).to eq([ Stream::Connected.new, Event.new('Hangup', 'Channel' => 'SIP/101-3f3f', 'Uniqueid' => '1094154427.10', 'Cause' => '0'), Stream::Disconnected.new, - ] + ]) end describe 'when a response is received' do @@ -188,7 +188,7 @@ def mocked_server(times = nil, fake_client = nil, &block) EVENT end - response.should == Response.new('ActionID' => RubyAMI.new_uuid, 'Message' => 'Recording started') + expect(response).to eq(Response.new('ActionID' => RubyAMI.new_uuid, 'Message' => 'Recording started')) end it 'should handle disconnect as a Response' do @@ -202,7 +202,7 @@ def mocked_server(times = nil, fake_client = nil, &block) EVENT end - response.should == Response.new('ActionID' => RubyAMI.new_uuid, 'Message' => 'Thanks for all the fish.') + expect(response).to eq(Response.new('ActionID' => RubyAMI.new_uuid, 'Message' => 'Thanks for all the fish.')) end describe 'when it is an error' do @@ -210,7 +210,7 @@ def mocked_server(times = nil, fake_client = nil, &block) it 'should be raised by #send_action, but not kill the stream' do send_action = lambda do expect { @stream.send_action 'status' }.to raise_error(RubyAMI::Error, 'Action failed') - @stream.should be_alive + expect(@stream).to be_alive end mocked_server(1, send_action) do |val, server| @@ -226,11 +226,11 @@ def mocked_server(times = nil, fake_client = nil, &block) describe 'when there is an error handler' do it 'should call the error handler' do - error_handler = lambda { |resp| resp.should be_a_kind_of RubyAMI::Error } + error_handler = lambda { |resp| expect(resp).to be_a_kind_of RubyAMI::Error } send_action = lambda do expect { @stream.send_action 'status', {}, error_handler }.to_not raise_error - @stream.should be_alive + expect(@stream).to be_alive end mocked_server(1, send_action) do |val, server| @@ -280,32 +280,32 @@ def mocked_server(times = nil, fake_client = nil, &block) EVENT end - response.should == expected_response + expect(response).to eq(expected_response) end end end it 'puts itself in the stopped state and fires a disconnected event when unbound' do mocked_server(1, lambda { @stream.send_data 'Foo' }) do |val, server| - @stream.stopped?.should be false + expect(@stream.stopped?).to be false end - @stream.alive?.should be false - client_messages.should be == [ + expect(@stream.alive?).to be false + expect(client_messages).to eq([ Stream::Connected.new, Stream::Disconnected.new, - ] + ]) end end describe Stream::Connected do it "has a name matching the class" do - subject.name.should == 'RubyAMI::Stream::Connected' + expect(subject.name).to eq('RubyAMI::Stream::Connected') end end describe Stream::Disconnected do it "has a name matching the class" do - subject.name.should == 'RubyAMI::Stream::Disconnected' + expect(subject.name).to eq('RubyAMI::Stream::Disconnected') end end end From 6f33506bdd4100d0228821acb396d1075759e81a Mon Sep 17 00:00:00 2001 From: Stephen George Date: Sun, 25 Aug 2019 11:26:40 -0500 Subject: [PATCH 18/22] [SPEC] mark one skipped test as expected to fail --- spec/ruby_ami/client_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/ruby_ami/client_spec.rb b/spec/ruby_ami/client_spec.rb index b8aef17..2e7cda3 100644 --- a/spec/ruby_ami/client_spec.rb +++ b/spec/ruby_ami/client_spec.rb @@ -30,7 +30,7 @@ module RubyAMI end it 'should return when the timeout option is specified and reached' do - skip + pending options[:timeout] = 2 options[:host] = '192.0.2.1' # unreachable IP that will generally cause a timeout (RFC 5737) From afd95f36e0f53a3e1c34740e091b5d8af6ecdfaa Mon Sep 17 00:00:00 2001 From: Stephen George Date: Sun, 25 Aug 2019 11:26:44 -0500 Subject: [PATCH 19/22] [SPEC] Replace undocumented, unsupported "feature" of #with ...with a documented, supported argument matcher block to #receive. Unsupported in #with: https://github.com/rspec/rspec-mocks/issues/377#issuecomment-21492096 Supported in #receive: https://github.com/rspec/rspec-mocks#arbitrary-handling --- spec/ruby_ami/stream_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/ruby_ami/stream_spec.rb b/spec/ruby_ami/stream_spec.rb index db8af95..7d6dc26 100644 --- a/spec/ruby_ami/stream_spec.rb +++ b/spec/ruby_ami/stream_spec.rb @@ -29,9 +29,11 @@ def client.messages let(:username) { nil } let(:password) { nil } - def mocked_server(times = nil, fake_client = nil, &block) + def mocked_server(times = nil, fake_client = nil, &argument_matcher) mock_target = MockServer.new - expect(mock_target).to receive(:receive_data).send(*(times ? [:exactly, times] : [:at_least, 1]), &block) + expect(mock_target).to receive(:receive_data) do |*args| + argument_matcher.call *args + end.send(*(times ? [:exactly, times] : [:at_least, 1])) s = ServerMock.new '127.0.0.1', server_port, mock_target @stream = Stream.new '127.0.0.1', server_port, username, password, lambda { |m| client.message_received m } @stream.async.run From 2f41c094c8dc39bbe22edfddd3e7112ea52efcbd Mon Sep 17 00:00:00 2001 From: Stephen George Date: Sun, 25 Aug 2019 11:26:48 -0500 Subject: [PATCH 20/22] [SPEC] Upgrade to RSpec 3.x --- ruby_ami.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruby_ami.gemspec b/ruby_ami.gemspec index b1b7004..aaa5029 100644 --- a/ruby_ami.gemspec +++ b/ruby_ami.gemspec @@ -22,7 +22,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency %q, ["~> 0.16.0"] s.add_development_dependency %q, [">= 1.0"] - s.add_development_dependency %q, ["~> 2.5"] + s.add_development_dependency %q, [">= 3.0"] s.add_development_dependency %q, ["< 3.0"] s.add_development_dependency %q, ["~> 0.6"] s.add_development_dependency %q, ["< 11.0"] From ab343b6046dfb14c27494bcbe46d4967eab4c4f0 Mon Sep 17 00:00:00 2001 From: Stephen George Date: Sun, 25 Aug 2019 11:26:52 -0500 Subject: [PATCH 21/22] [SPEC] Run transpec one more time to fix deprecations Convert specs to RSpec 3.8.2 syntax with Transpec This conversion is done by Transpec 3.4.0 with the following command: transpec -f * 2 conversions from: obj.stub(:message => value) to: allow(obj).to receive_messages(:message => value) For more details: https://github.com/yujinakayama/transpec#supported-conversions --- spec/ruby_ami/event_spec.rb | 2 +- spec/spec_helper.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/ruby_ami/event_spec.rb b/spec/ruby_ami/event_spec.rb index 816759e..e8c0723 100644 --- a/spec/ruby_ami/event_spec.rb +++ b/spec/ruby_ami/event_spec.rb @@ -8,7 +8,7 @@ module RubyAMI describe "#receipt_time" do before do @now = DateTime.now - DateTime.stub now: @now + allow(DateTime).to receive_messages now: @now end it "should be the time the object was created (event receipt time)" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a623668..1e2808e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,6 +13,6 @@ config.before :each do uuid = RubyAMI.new_uuid - RubyAMI.stub :new_uuid => uuid + allow(RubyAMI).to receive_messages :new_uuid => uuid end end From c55ec916025963ffc6d07c41b7ec78bdf4db465d Mon Sep 17 00:00:00 2001 From: Stephen George Date: Sun, 25 Aug 2019 12:36:44 -0500 Subject: [PATCH 22/22] Revert "Use rake < 11.x until we upgrade RSpec past 2.x" This reverts commit a9d85a51ed3917ee5551aaa7f798cde660eaa18d. --- ruby_ami.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruby_ami.gemspec b/ruby_ami.gemspec index aaa5029..b1643ac 100644 --- a/ruby_ami.gemspec +++ b/ruby_ami.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |s| s.add_development_dependency %q, [">= 3.0"] s.add_development_dependency %q, ["< 3.0"] s.add_development_dependency %q, ["~> 0.6"] - s.add_development_dependency %q, ["< 11.0"] + s.add_development_dependency %q, [">= 0"] s.add_development_dependency %q s.add_development_dependency %q s.add_development_dependency %q