Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 40 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,53 @@ jobs:
task:
- internal_investigation
- spec
rubocop_version:
- gem
include:
- rubocop_version: edge
ruby: 2.7
task: internal_investigation
- rubocop_version: edge
ruby: 2.7
task: spec
name: ${{ matrix.task }}, Ruby ${{ matrix.ruby }} (${{ matrix.rubocop_version }})
name: ${{ matrix.task }}, Ruby ${{ matrix.ruby }} (gem)
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: "${{ matrix.ruby }}"
bundler-cache: true
- run: bundle exec rake ${{ matrix.task }}

edge-rubocop:
runs-on: ubuntu-latest
strategy:
matrix:
ruby:
- 2.7
task:
- internal_investigation
- spec
name: ${{ matrix.task }} Ruby ${{ matrix.ruby }} (edge)
steps:
- uses: actions/checkout@v2
- name: Use latest RuboCop from `master`
run: |
echo "gem 'rubocop', github: 'rubocop-hq/rubocop'" > Gemfile.local
if: matrix.rubocop_version == 'edge'
- uses: ruby/setup-ruby@v1
with:
ruby-version: "${{ matrix.ruby }}"
bundler-cache: true
- run: bundle exec rake ${{ matrix.task }}

rspec4:
runs-on: ubuntu-latest
name: RSpec 4
steps:
- uses: actions/checkout@v2
- name: Use latest RSpec 4 from `4-0-dev` branch
run: |
sed -e '/rspec/d' -i Gemfile
cat << EOF > Gemfile.local
gem 'rspec', github: 'rspec/rspec', branch: '4-0-dev'
gem 'rspec-core', github: 'rspec/rspec-core', branch: '4-0-dev'
gem 'rspec-expectations', github: 'rspec/rspec-expectations', branch: '4-0-dev'
gem 'rspec-mocks', github: 'rspec/rspec-mocks', branch: '4-0-dev'
gem 'rspec-support', github: 'rspec/rspec-support', branch: '4-0-dev'
EOF
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- run: bundle exec rake spec
1 change: 0 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
--require spec_helper
--color
Copy link
Member Author

@pirj pirj Jul 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--format documentation
7 changes: 7 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ source 'https://rubygems.org'

gemspec

gem 'rack'
gem 'rake'
gem 'rspec', '~> 3.11'
gem 'rubocop-performance', '~> 1.7'
gem 'rubocop-rake', '~> 0.6'
gem 'yard'

local_gemfile = 'Gemfile.local'

if File.exist?(local_gemfile)
Expand Down
7 changes: 0 additions & 7 deletions rubocop-rspec.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,4 @@ Gem::Specification.new do |spec|
}

spec.add_runtime_dependency 'rubocop', '~> 1.31'

spec.add_development_dependency 'rack'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec', '>= 3.4'
spec.add_development_dependency 'rubocop-performance', '~> 1.7'
spec.add_development_dependency 'rubocop-rake', '~> 0.6'
spec.add_development_dependency 'yard'
end
4 changes: 3 additions & 1 deletion spec/rubocop/cli/autocorrect_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# frozen_string_literal: true

RSpec.describe 'RuboCop::CLI --autocorrect', :isolated_environment do # rubocop:disable RSpec/DescribeClass
RSpec.describe 'RuboCop::CLI --autocorrect' do # rubocop:disable RSpec/DescribeClass
subject(:cli) { RuboCop::CLI.new }

include_context 'isolated environment'

include_context 'when cli spec behavior'

context 'when corrects `RSpec/Capybara/CurrentPathExpectation` with ' \
Expand Down
2 changes: 1 addition & 1 deletion spec/smoke_tests/weird_rspec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
end

it_behaves_like :something
it_should_behave_like :something
it_should_behave_like :something if RSpec::Core::Version::STRING < '4.0'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we not only parse those weird specs, but also actually run them with rake spec, we have to conditionally call it_should_behave_like as this alias has been removed from RSpec 4.


it_behaves_like :something do
let(:foo) { 'bar' }
Expand Down
10 changes: 5 additions & 5 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ module SpecHelper
config.order = :random

# Run focused tests with `fdescribe`, `fit`, `:focus` etc.
config.filter_run focus: true
config.run_all_when_everything_filtered = true
Comment on lines -27 to -28
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# Forbid RSpec from monkey patching any of our objects
config.disable_monkey_patching!
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config.filter_run_when_matching :focus

# We should address configuration warnings when we upgrade
config.raise_errors_for_deprecations!
Expand All @@ -38,6 +34,10 @@ module SpecHelper
config.raise_on_warning = true

config.include(ExpectOffense)

config.include_context 'with default RSpec/Language config', :config
config.include_context 'config', :config
Copy link
Member Author

@pirj pirj Jul 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this PR is merged (and released, and we bump our rubocop dependency, and we remove the :config from our 'with default RSpec/Language config' shared context), this line becomes redundant.

config.include_context 'smoke test', type: :cop_spec
end

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
Expand Down