Skip to content

Commit

Permalink
Merge pull request #420 from marlinpierce/expect-block-deprecation
Browse files Browse the repository at this point in the history
Change expect for raising to block from advice of deprecation warning.
  • Loading branch information
bobbrodie authored Apr 1, 2024
2 parents 4cffe6b + efa48fc commit 6d276e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions spec/jira/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ class JIRA::Resource::HasManyExample < JIRA::Base # :nodoc:
response = instance_double('Response', body: '{"errorMessages":["blah"]}', status: 400)
allow(subject).to receive(:new_record?) { false }
expect(client).to receive(:put).with('/foo/bar', '{"invalid_field":"foobar"}').and_raise(JIRA::HTTPError.new(response))
expect(-> { subject.save!('invalid_field' => 'foobar') }).to raise_error(JIRA::HTTPError)
expect{ subject.save!('invalid_field' => 'foobar') }.to raise_error(JIRA::HTTPError)
end
end

Expand Down Expand Up @@ -579,9 +579,9 @@ class JIRA::Resource::BelongsToExample < JIRA::Base
end

it 'raises an exception when initialized without a belongs_to instance' do
expect(lambda {
expect{
JIRA::Resource::BelongsToExample.new(client, attrs: { 'id' => '123' })
}).to raise_exception(ArgumentError, 'Required option :deadbeef missing')
}.to raise_exception(ArgumentError, 'Required option :deadbeef missing')
end

it 'returns the right url' do
Expand Down
12 changes: 6 additions & 6 deletions spec/support/shared_examples/integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def build_receiver
stub_request(:put, site_url + subject.url)
.to_return(status: 405, body: '<html><body>Some HTML</body></html>')
expect(subject.save('foo' => 'bar')).to be_falsey
expect(lambda do
expect do
expect(subject.save!('foo' => 'bar')).to be_falsey
end).to raise_error(JIRA::HTTPError)
end.to raise_error(JIRA::HTTPError)
end
end

Expand Down Expand Up @@ -115,9 +115,9 @@ def build_receiver
it 'handles a 404' do
stub_request(:get, site_url + described_class.singular_path(client, '99999', prefix))
.to_return(status: 404, body: '{"errorMessages":["' + class_basename + ' Does Not Exist"],"errors": {}}')
expect(lambda do
expect do
client.send(class_basename).find('99999', options)
end).to raise_exception(JIRA::HTTPError)
end.to raise_exception(JIRA::HTTPError)
end
end

Expand Down Expand Up @@ -170,8 +170,8 @@ def build_receiver
subject.fetch

expect(subject.save('fields' => { 'invalid' => 'field' })).to be_falsey
expect(lambda do
expect do
subject.save!('fields' => { 'invalid' => 'field' })
end).to raise_error(JIRA::HTTPError)
end.to raise_error(JIRA::HTTPError)
end
end

0 comments on commit 6d276e7

Please sign in to comment.