Skip to content

Commit

Permalink
Fix RSpec 4 build: trigger_inclusion changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pirj committed Aug 9, 2024
1 parent 3ba9393 commit 2b067fe
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions spec/rubocop/cop/rspec_rails/timecop_spec.rb
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::RSpecRails::Timecop, :config do
shared_context 'with Rails 5.1', :rails51 do
shared_context 'with Rails 5.1' do
let(:rails_version) { 5.1 }
end

shared_context 'with Rails 5.2', :rails52 do
shared_context 'with Rails 5.2' do
let(:rails_version) { 5.2 }
end

shared_context 'with Rails 6.0', :rails60 do
shared_context 'with Rails 6.0' do
let(:rails_version) { 6.0 }
end

shared_context 'with Rails 7.0', :rails70 do
shared_context 'with Rails 6.1' do
let(:rails_version) { 6.1 }
end

shared_context 'with Rails 7.0' do
let(:rails_version) { 7.0 }
end

Expand Down Expand Up @@ -102,12 +106,14 @@
end
end

context 'when Rails < 5.2', :rails51 do
context 'when Rails < 5.2' do
include_context 'with Rails 5.1'
include_examples 'flags and corrects to',
replacement: 'travel_to(Time.now)'
end

context 'with Rails 5.2+', :rails52 do
context 'with Rails 5.2+' do
include_context 'with Rails 5.2'
include_examples 'flags and corrects to',
replacement: 'freeze_time'
end
Expand All @@ -134,7 +140,8 @@
end

describe '.return' do
context 'with Rails < 6.1', :rails60 do
context 'with Rails < 6.1' do
include_context 'with Rails 6.0'
include_examples 'return prefers'

it 'flags, but does not correct return with a block' do
Expand All @@ -147,7 +154,8 @@
end
end

context 'with Rails 6.1+', :rails61 do
context 'with Rails 6.1+' do
include_context 'with Rails 6.1'
include_examples 'return prefers'

it 'flags, and corrects return with a block' do
Expand Down

0 comments on commit 2b067fe

Please sign in to comment.