Skip to content

Commit

Permalink
Test with Ruby 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmior committed Mar 11, 2024
1 parent 4db11f3 commit 5944433
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 11 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.5.3', '2.6.1']
ruby-version: ['3.1.4', '3.2.3', '3.3.0']
services:
mysql:
image: mysql:5.6
Expand Down Expand Up @@ -61,3 +61,8 @@ jobs:
run: |
sed -i '/^--tag/d' .rspec
bundle exec rspec
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
1 change: 0 additions & 1 deletion .rspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
--color
--format documentation
--require spec_helper
--tag ~cassandra
--tag ~mongo
--tag ~mysql
1 change: 1 addition & 0 deletions lib/nose/backend/cassandra.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require 'sorted_set'
require 'cassandra'
require 'zlib'

Expand Down
4 changes: 3 additions & 1 deletion lib/nose/backend/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def initialize(model, indexes, plans, update_plans, config)
# Save data when the object is destroyed
def self.finalize(index_data, file)
proc do
Marshal.dump(index_data, File.open(file, 'w'))
if !file.nil?
Marshal.dump(index_data, File.open(file, 'w'))
end
end
end

Expand Down
9 changes: 5 additions & 4 deletions nose.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ Gem::Specification.new do |s|
s.add_dependency 'ruby-mysql', '~> 2.9.14', '>= 2.9.0' # for the proxy because it's pure Ruby
s.add_dependency 'sequel', '~> 5.41.0', '>= 4.46.0'
s.add_dependency 'smarter_csv', '1.10.2'
s.add_dependency 'sorted_set', '~> 1.0', '>= 1.0.3'

# Required for Cassandra backend
s.add_dependency 'cassandra-driver', '~> 3.2.3', '>= 3.1.0'
s.add_dependency 'cassandra-driver', '~> 3.2.5', '>= 3.1.0'

# Required for MongoDB backend
s.add_dependency 'mongo', '>= 2.14', '< 2.20'

s.add_development_dependency 'codecov', '~> 0.4.3'
s.add_development_dependency 'fakefs', '~> 1.3.2'
s.add_development_dependency 'fakefs', '~> 2.5.0'
s.add_development_dependency 'memory_profiler', '~> 1.0.0'
s.add_development_dependency 'pry-byebug', '~> 3.9.0'
s.add_development_dependency 'pry-doc', '~> 1.1.0'
Expand All @@ -47,7 +47,8 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rspec-core', '~> 3.10.0'
s.add_development_dependency 'rspec-collection_matchers', '~> 1.2.0', '>= 1.1.0'
s.add_development_dependency 'ruby-prof', '~> 1.4.2'
s.add_development_dependency 'simplecov', '~> 0.21.2'
s.add_development_dependency 'simplecov', '~> 0.22.0'
s.add_development_dependency 'simplecov-cobertura', '~> 2.1'
s.add_development_dependency 'yard', '~> 0.9.4'

# Below for MRI only (TODO JRuby gemspec)
Expand Down
4 changes: 2 additions & 2 deletions spec/backend/cassandra_backend_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ module Backend

# Validate the expected CQL query
client = double('client')
backend_query = 'SELECT "User_Username", "Tweet_Timestamp", ' \
'"Tweet_Body" ' + "FROM \"#{index.key}\" " \
backend_query = 'SELECT "Tweet_Body", "User_Username", ' \
'"Tweet_Timestamp" ' + "FROM \"#{index.key}\" " \
'WHERE "User_Username" = ? ' \
'ORDER BY "Tweet_Timestamp" LIMIT 10'
expect(client).to receive(:prepare).with(backend_query) \
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
require 'simplecov'
SimpleCov.start

require 'codecov'
SimpleCov.formatter = SimpleCov::Formatter::Codecov
require 'simplecov-cobertura'
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter

require 'rspec/collection_matchers'
require 'fakefs/safe'
Expand Down

0 comments on commit 5944433

Please sign in to comment.