Skip to content

Commit 496c931

Browse files
committed
Added support for Ruby 3.1.
1 parent c3cc94d commit 496c931

File tree

9 files changed

+22
-15
lines changed

9 files changed

+22
-15
lines changed

.github/workflows/test-mongodb.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
- { ruby: 2.6.2, mongoid: 6.4.8, mongodb: 4.4 }
1111
- { ruby: 2.6.2, mongoid: 7.2.3, mongodb: 4.4 }
1212
- { ruby: 2.6.2, mongoid: 7.3.0, mongodb: 4.4 }
13+
- { ruby: 3.1.1, mongoid: 7.3.0, mongodb: 4.4 }
1314
name: test (ruby=${{ matrix.entry.ruby }}, mongoid=${{ matrix.entry.mongoid }}, mongodb=${{ matrix.entry.mongodb }})
1415
steps:
1516
- uses: actions/checkout@v2

.github/workflows/test-postgresql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ jobs:
88
matrix:
99
entry:
1010
- { ruby: 2.6.2, postgresql: 11 }
11+
- { ruby: 3.1.1, postgresql: 11 }
1112
name: test (ruby=${{ matrix.entry.ruby }}, postgresql=${{ matrix.entry.postgresql }})
1213
steps:
1314
- uses: actions/checkout@v2

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ log
66
.env
77
*.swp
88
Gemfile.lock
9+
Gemfile.danger.lock
910
.ruby-version
1011
pkg

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
#### 1.2.2 (Next)
44

5+
* [#145](https://github.com/slack-ruby/slack-ruby-bot-server/pull/145): Added support for ruby 3.1 - [@dblock](https://github.com/dblock).
56
* Your contribution here.
67

78
#### 1.2.1 (2022/03/06)

Gemfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ when 'mongoid' then
77
gem 'mongoid-scroll'
88
gem 'mongoid-shell'
99
when 'activerecord' then
10-
gem 'activerecord', '~> 5.0.0'
11-
gem 'otr-activerecord', '~> 1.2.1'
12-
gem 'cursor_pagination' # rubocop:disable Bundler/OrderedGems
10+
gem 'activerecord', '~> 6.0.0'
11+
gem 'otr-activerecord'
12+
gem 'cursor_pagination', github: 'dblock/cursor_pagination', branch: 'misc' # rubocop:disable Bundler/OrderedGems
1313
gem 'pg'
1414
when nil
1515
warn "Missing ENV['DATABASE_ADAPTER']."
@@ -22,7 +22,7 @@ gemspec
2222
group :development, :test do
2323
gem 'bundler'
2424
gem 'byebug'
25-
gem 'capybara', '~> 2.15.1'
25+
gem 'capybara', '~> 3.36.0'
2626
gem 'database_cleaner', '~> 1.8.5'
2727
gem 'fabrication'
2828
gem 'faker'
@@ -33,7 +33,7 @@ group :development, :test do
3333
gem 'rake'
3434
gem 'rspec'
3535
gem 'rubocop', '0.81.0'
36-
gem 'selenium-webdriver', '~> 3.4.4'
36+
gem 'selenium-webdriver', '~> 4.1.0'
3737
gem 'vcr'
3838
gem 'webmock'
3939
gem 'webrick', '~> 1.6.1'

spec/api/endpoints/teams_endpoint_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
end
8686

8787
it 'includes optional state parameter' do
88-
expect(SlackRubyBotServer::Service.instance).to receive(:create!).with(instance_of(Team), state: 'property')
88+
expect(SlackRubyBotServer::Service.instance).to receive(:create!).with(instance_of(Team), { state: 'property' })
8989
client.teams._post(code: 'code', state: 'property')
9090
end
9191

@@ -194,7 +194,7 @@
194194
end
195195

196196
it 'includes optional state parameter' do
197-
expect(SlackRubyBotServer::Service.instance).to receive(:create!).with(instance_of(Team), state: 'property')
197+
expect(SlackRubyBotServer::Service.instance).to receive(:create!).with(instance_of(Team), { state: 'property' })
198198
client.teams._post(code: 'code', state: 'property')
199199
end
200200

@@ -307,7 +307,7 @@
307307
end
308308

309309
it 'includes optional state parameter' do
310-
expect(SlackRubyBotServer::Service.instance).to receive(:create!).with(instance_of(Team), state: 'property')
310+
expect(SlackRubyBotServer::Service.instance).to receive(:create!).with(instance_of(Team), { state: 'property' })
311311
client.teams._post(code: 'code', state: 'property')
312312
end
313313

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
db_config = YAML.safe_load(
2-
ERB.new(File.read(
3-
File.expand_path('config/postgresql.yml', __dir__)
4-
)).result, [], [], true
5-
)[ENV['RACK_ENV']]
1+
yml = ERB.new(File.read(File.expand_path('config/postgresql.yml', __dir__))).result
2+
db_config = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0.pre1')
3+
::YAML.safe_load(yml, aliases: true)[ENV['RACK_ENV']]
4+
else
5+
::YAML.safe_load(yml, [], [], true)[ENV['RACK_ENV']]
6+
end
67
ActiveRecord::Tasks::DatabaseTasks.create(db_config)
78
ActiveRecord::Base.establish_connection(db_config)
9+
ActiveRecord::Base.logger ||= Logger.new(STDOUT)
810
ActiveRecord::Base.logger.level = :info

spec/integration/teams_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
end.to change(Team, :count).by(1)
2929
end
3030
it 'includes optional parameter' do
31-
expect(SlackRubyBotServer::Service.instance).to receive(:create!).with(instance_of(Team), state: 'property')
31+
expect(SlackRubyBotServer::Service.instance).to receive(:create!).with(instance_of(Team), { state: 'property' })
3232
visit '/?v1&code=code&state=property'
3333
end
3434
end
@@ -58,7 +58,7 @@
5858
end.to change(Team, :count).by(1)
5959
end
6060
it 'includes optional parameter' do
61-
expect(SlackRubyBotServer::Service.instance).to receive(:create!).with(instance_of(Team), state: 'property')
61+
expect(SlackRubyBotServer::Service.instance).to receive(:create!).with(instance_of(Team), { state: 'property' })
6262
visit '/?v2&code=code&state=property'
6363
end
6464
end

spec/support/capybara.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
Capybara.configure do |config|
44
config.app = SlackRubyBotServer::Api::Middleware.instance
55
config.server_port = 9293
6+
config.server = :webrick
67
end

0 commit comments

Comments
 (0)