From 788e7399c92fd24c4c83aaf854f9167ac400922e Mon Sep 17 00:00:00 2001 From: Mark Evans Date: Mon, 2 Sep 2024 12:08:03 +0100 Subject: [PATCH] fixed rspec deprecation warnings --- spec/dragonfly/model/active_record_spec.rb | 4 ++-- spec/dragonfly/temp_object_spec.rb | 2 +- spec/spec_helper.rb | 6 ++++++ spec/support/image_matchers.rb | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/spec/dragonfly/model/active_record_spec.rb b/spec/dragonfly/model/active_record_spec.rb index 354f0e38e..1f5edbdd0 100644 --- a/spec/dragonfly/model/active_record_spec.rb +++ b/spec/dragonfly/model/active_record_spec.rb @@ -9,7 +9,7 @@ let! :dragonfly_app do test_app(:test_ar) end before :all do - @connection = ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:") + ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:") ActiveRecord::Migration.verbose = false @@ -27,7 +27,7 @@ class Photo < ActiveRecord::Base after :all do Photo.destroy_all - ActiveRecord::Base.remove_connection(@connection) + ActiveRecord::Base.remove_connection() end describe "destroying" do diff --git a/spec/dragonfly/temp_object_spec.rb b/spec/dragonfly/temp_object_spec.rb index e41ff4060..c8e07294e 100644 --- a/spec/dragonfly/temp_object_spec.rb +++ b/spec/dragonfly/temp_object_spec.rb @@ -145,7 +145,7 @@ def get_parts(temp_object) end it "should allow not creating intermediate subdirs" do filename = 'tmp/gog/mcgee' - expect{ @temp_object.to_file(filename, :mkdirs => false) }.to raise_error() + expect{ @temp_object.to_file(filename, :mkdirs => false) }.to raise_error(/No such file or directory/) end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c3cd3986f..348e0cf5b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -17,6 +17,12 @@ SAMPLES_DIR = Pathname.new(File.expand_path("../../samples", __FILE__)) RSpec.configure do |c| + c.expect_with(:rspec) do |expectations| + expectations.syntax = [:should, :expect] + end + c.mock_with(:rspec) do |mocks| + mocks.syntax = [:should, :expect] + end c.include ModelHelpers c.include RackHelpers end diff --git a/spec/support/image_matchers.rb b/spec/support/image_matchers.rb index b49609d35..96ac7c7ee 100644 --- a/spec/support/image_matchers.rb +++ b/spec/support/image_matchers.rb @@ -22,7 +22,7 @@ def image_properties(image) match do |actual| value.should === image_properties(actual)[property] end - failure_message_for_should do |actual| + failure_message do |actual| "expected image to have #{property} #{value.inspect}, but it had #{image_properties(actual)[property].inspect}" end end