Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require rspec-core for RSpec integration #1654

Merged
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
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