Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Commit

Permalink
Merge pull request #71 from st0012/improve-ci-setup
Browse files Browse the repository at this point in the history
Support Ruby 3.0
  • Loading branch information
st0012 committed Apr 25, 2021
2 parents e97cce7 + f908cf3 commit 4b79871
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 98 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
name: Ruby

on: [push, pull_request]
on:
workflow_dispatch:
push:
branches:
- master
pull_request:

jobs:
test:
name: Test on ruby ${{ matrix.ruby_version }} and rails ${{ matrix.rails_version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
rails_version: ['5.2', '6']
ruby_version: ['2.5', '2.6']
rails_version: ['5.2', '6.0.0', '6.1.0']
ruby_version: ['2.7', '3.0']
os: [ubuntu-latest]
exclude:
- ruby_version: '3.0'
rails_version: '5.2'
steps:
- uses: actions/checkout@v1

Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
/spec/reports/
/tmp/

Gemfile.lock

# rspec failure tracking
.rspec_status
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.5
3.0.1
78 changes: 0 additions & 78 deletions Gemfile.lock

This file was deleted.

4 changes: 4 additions & 0 deletions lib/tapping_device/method_hijacker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ def hijack_methods!

def is_writer_method?(method_name)
has_definition_source?(method_name) && method_name.match?(/\w+=/) && target.method(method_name).source.match?(/attr_writer|attr_accessor/)
rescue MethodSource::SourceNotFoundError
false
end

def is_reader_method?(method_name)
has_definition_source?(method_name) && target.method(method_name).source.match?(/attr_reader|attr_accessor/)
rescue MethodSource::SourceNotFoundError
false
end

def has_definition_source?(method_name)
Expand Down
16 changes: 0 additions & 16 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,4 @@
config.after do
TappingDevice.reset!
end

def assert_query_count(number, print_queries = true)
queries = []

ActiveSupport::Notifications.subscribe('sql.active_record') do |_1, _2, _3, _4, payload|
if !["SCHEMA", "TRANSACTION"].include? payload.name
queries << payload.sql
end
end

yield

puts(queries) if print_queries && (number != queries.count)

expect(queries.count).to eq(number), "Expect #{number} queries, got #{queries.count}"
end
end

0 comments on commit 4b79871

Please sign in to comment.