Skip to content

Commit

Permalink
Merge pull request #1654 from elliterate/rspec-integration-require-rs…
Browse files Browse the repository at this point in the history
…pec-core

Require `rspec-core` for RSpec integration
  • Loading branch information
marcotc committed Aug 18, 2021
2 parents 80fb6e6 + 06c41f5 commit 8b3b389
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/datadog/ci/contrib/rspec/integration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class Integration
register_as :rspec, auto_patch: true

def self.version
Gem.loaded_specs['rspec'] \
&& Gem.loaded_specs['rspec'].version
Gem.loaded_specs['rspec-core'] \
&& Gem.loaded_specs['rspec-core'].version
end

def self.loaded?
Expand Down
16 changes: 8 additions & 8 deletions spec/datadog/ci/contrib/rspec/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
describe '.version' do
subject(:version) { described_class.version }

context 'when the "rspec" gem is loaded' do
include_context 'loaded gems', 'rspec' => described_class::MINIMUM_VERSION
context 'when the "rspec-core" gem is loaded' do
include_context 'loaded gems', 'rspec-core' => described_class::MINIMUM_VERSION
it { is_expected.to be_a_kind_of(Gem::Version) }
end

context 'when "rspec" gem is not loaded' do
include_context 'loaded gems', 'rspec' => nil
context 'when "rspec-core" gem is not loaded' do
include_context 'loaded gems', 'rspec-core' => nil
it { is_expected.to be nil }
end
end
Expand All @@ -33,20 +33,20 @@
describe '.compatible?' do
subject(:compatible?) { described_class.compatible? }

context 'when "rspec" gem is loaded with a version' do
context 'when "rspec-core" gem is loaded with a version' do
context 'that is less than the minimum' do
include_context 'loaded gems', 'rspec' => decrement_gem_version(described_class::MINIMUM_VERSION)
include_context 'loaded gems', 'rspec-core' => decrement_gem_version(described_class::MINIMUM_VERSION)
it { is_expected.to be false }
end

context 'that meets the minimum version' do
include_context 'loaded gems', 'rspec' => described_class::MINIMUM_VERSION
include_context 'loaded gems', 'rspec-core' => described_class::MINIMUM_VERSION
it { is_expected.to be true }
end
end

context 'when gem is not loaded' do
include_context 'loaded gems', 'rspec' => nil
include_context 'loaded gems', 'rspec-core' => nil
it { is_expected.to be false }
end
end
Expand Down

0 comments on commit 8b3b389

Please sign in to comment.