Skip to content

Commit

Permalink
Bugfix/Wrong semantic version comparison in SmtpMock::Dependency (#50)
Browse files Browse the repository at this point in the history
* Updated SmtpMock::Dependency#minimal_version?, tests
* Updated codeclimate/circleci configs
* Updated gem development dependencies
* Updated gem version, changelog
  • Loading branch information
bestwebua authored Oct 5, 2022
1 parent c5c2dd6 commit d04e3a2
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
- checkout
- <<: *use_compatible_gemspec
- ruby/install-deps:
bundler-version: "2.3.18"
bundler-version: "2.3.23"
with-cache: false
path: './vendor/custom_bundle'
- <<: *system_dependencies
Expand Down
10 changes: 5 additions & 5 deletions .circleci/gemspec_latest
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'bundler-audit', '~> 0.9.1'
spec.add_development_dependency 'fasterer', '~> 0.10.0'
spec.add_development_dependency 'ffaker', '~> 2.21'
spec.add_development_dependency 'net-smtp', '~> 0.3.1'
spec.add_development_dependency 'net-smtp', '~> 0.3.2'
spec.add_development_dependency 'overcommit', '~> 0.59.1'
spec.add_development_dependency 'pry-byebug', '~> 3.9'
spec.add_development_dependency 'pry-byebug', '~> 3.10', '>= 3.10.1'
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
spec.add_development_dependency 'reek', '~> 6.1', '>= 6.1.1'
spec.add_development_dependency 'rspec', '~> 3.11'
spec.add_development_dependency 'rubocop', '~> 1.32'
spec.add_development_dependency 'rubocop-performance', '~> 1.14', '>= 1.14.3'
spec.add_development_dependency 'rubocop-rspec', '~> 2.12', '>= 2.12.1'
spec.add_development_dependency 'rubocop', '~> 1.36'
spec.add_development_dependency 'rubocop-performance', '~> 1.15'
spec.add_development_dependency 'rubocop-rspec', '~> 2.13', '>= 2.13.2'
spec.add_development_dependency 'simplecov', '~> 0.21.2'
end
2 changes: 1 addition & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ checks:
plugins:
rubocop:
enabled: true
channel: rubocop-1-32
channel: rubocop-1-36

reek:
enabled: true
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.2.2] - 2022-10-06

### Fixed

- Fixed wrong semantic version comparison in `SmtpMock::Dependency#minimal_version?`

### Updated

- Updated gemspecs
- Updated tests
- Updated codeclimate/circleci configs
- Updated gem development dependencies
- Updated gem version

## [1.2.1] - 2022-07-27

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion lib/smtp_mock/dependency.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def version
private

def minimal_version?(current_version)
!!current_version && current_version >= SmtpMock::SMTPMOCK_MIN_VERSION
!!current_version && ::Gem::Version.new(current_version) >= ::Gem::Version.new(SmtpMock::SMTPMOCK_MIN_VERSION)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/smtp_mock/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module SmtpMock
VERSION = '1.2.1'
VERSION = '1.2.2'
end
2 changes: 1 addition & 1 deletion smtp_mock.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'dry-struct', '~> 1.4'

spec.add_development_dependency 'ffaker', '~> 2.21'
spec.add_development_dependency 'net-smtp', '~> 0.3.1' if ::RUBY_VERSION >= '3.1.0'
spec.add_development_dependency 'net-smtp', '~> 0.3.2' if ::RUBY_VERSION >= '3.1.0'
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
spec.add_development_dependency 'rspec', '~> 3.11'
end
6 changes: 6 additions & 0 deletions spec/smtp_mock/dependency_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
expect(described_class).to receive(:version).and_return(SmtpMock::SMTPMOCK_MIN_VERSION)
expect(verify_dependencies).to match(/(\d+)(\.\g<1>){2}/)
end

it 'not raises SmtpMock::Error::Dependency error in case of comparing greater semantic version' do
expect(described_class).to receive(:smtpmock?).and_return(true)
expect(described_class).to receive(:version).and_return('1.10.0')
expect(verify_dependencies).to match(/(\d+)(\.\g<1>){2}/)
end
end

context 'when not supported smtpmock version installed' do
Expand Down

0 comments on commit d04e3a2

Please sign in to comment.