diff --git a/Gemfile b/Gemfile index 94fbf44c2..934a0a9aa 100644 --- a/Gemfile +++ b/Gemfile @@ -162,7 +162,7 @@ group :test do gem "pundit-matchers", "~> 1.7" # A set of RSpec matchers for testing Pundit authorisation policies gem "rspec-retry", "~> 0.6" # retry intermittently failing rspec examples gem "ruby-prof", "~> 1.4", require: false # ruby-prof is a fast code profiler for Ruby - gem "shoulda-matchers", "~> 5.1.0", require: false # Simple one-liner tests for common Rails functionality + gem "shoulda-matchers", "~> 5.3", require: false # Simple one-liner tests for common Rails functionality gem "simplecov", "~> 0.21.2", require: false # Code coverage with a powerful configuration library and automatic merging of coverage across test suites gem "stackprof", "~> 0.2", require: false, platforms: :ruby # stackprof is a fast sampling profiler for ruby code, with cpu, wallclock and object allocation samplers gem "stripe-ruby-mock", "3.1.0.rc3", require: "stripe_mock" # A drop-in library to test stripe without hitting their servers diff --git a/Gemfile.lock b/Gemfile.lock index 22a44a886..5d89d4043 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -805,7 +805,7 @@ GEM semantic_range (3.0.0) sexp_processor (4.16.1) shellany (0.0.1) - shoulda-matchers (5.1.0) + shoulda-matchers (5.3.0) activesupport (>= 5.2.0) sidekiq (6.5.8) connection_pool (>= 2.2.5, < 3) @@ -1075,7 +1075,7 @@ DEPENDENCIES rubyzip (~> 2.3) s3_direct_upload (~> 0.1) sassc-rails (~> 2.1.2) - shoulda-matchers (~> 5.1.0) + shoulda-matchers (~> 5.3) sidekiq (~> 6.5.3) sidekiq-cron (~> 1.7) sidekiq-unique-jobs (~> 7.1.27) diff --git a/spec/models/user_subscription_spec.rb b/spec/models/user_subscription_spec.rb index 051703af6..7111e7865 100644 --- a/spec/models/user_subscription_spec.rb +++ b/spec/models/user_subscription_spec.rb @@ -1,23 +1,18 @@ require "rails_helper" -RSpec.describe UserSubscription, type: :model do - subject { build(:user_subscription) } - +RSpec.describe UserSubscription do let(:subscriber) { create(:user) } let(:source) { create(:article, :with_user_subscription_tag_role_user, with_user_subscription_tag: true) } describe "validations" do it { is_expected.to validate_presence_of(:user_subscription_sourceable_type) } it { is_expected.to validate_presence_of(:subscriber_email) } - # Disabled to Rails 7 compatibility. See https://github.com/thoughtbot/shoulda-matchers/issues/1433 - xit { is_expected.to validate_inclusion_of(:user_subscription_sourceable_type).in_array(%w[Article]) } + it { is_expected.to validate_inclusion_of(:user_subscription_sourceable_type).in_array(%w[Article]) } - # rubocop:disable RSpec/NamedSubject it { - expect(subject).to validate_uniqueness_of(:subscriber_id) + expect(build(:user_subscription)).to validate_uniqueness_of(:subscriber_id) .scoped_to(%i[subscriber_email user_subscription_sourceable_type user_subscription_sourceable_id]) } - # rubocop:enable RSpec/NamedSubject it "validates the source is active" do unpublished_source = create(:article, :with_user_subscription_tag_role_user, with_user_subscription_tag: true, diff --git a/vendor/cache/shoulda-matchers-5.1.0.gem b/vendor/cache/shoulda-matchers-5.1.0.gem deleted file mode 100644 index f27db7466..000000000 Binary files a/vendor/cache/shoulda-matchers-5.1.0.gem and /dev/null differ diff --git a/vendor/cache/shoulda-matchers-5.3.0.gem b/vendor/cache/shoulda-matchers-5.3.0.gem new file mode 100644 index 000000000..e764fcf6c Binary files /dev/null and b/vendor/cache/shoulda-matchers-5.3.0.gem differ