Skip to content
Draft
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
7 changes: 3 additions & 4 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,19 @@ jobs:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.1"
ruby-version: "3.2"
bundler-cache: true
- run: bundle exec standardrb --parallel --format github
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby:
[2.7, 3.0, 3.1, head, debug, jruby-9.4, jruby-head, truffleruby-head]
ruby: [3.2, 3.3, head, debug, jruby-head, truffleruby-head]
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- run: bundle install
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
inherit_gem:
standard: config/ruby-3.1.yml
standard: config/ruby-3.2.yml
6 changes: 3 additions & 3 deletions active_remote.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
s.require_paths = ["lib"]

s.required_ruby_version = ">= 2.7.0"
s.required_ruby_version = ">= 3.2.0"

##
# Dependencies
#
s.add_dependency "activemodel", "~> 7.0", "< 7.1"
s.add_dependency "activesupport", "~> 7.0", "< 7.1"
s.add_dependency "activemodel", "~> 8.0.0"
s.add_dependency "activesupport", "~> 8.0.0"
s.add_dependency "protobuf", ">= 3.0"

##
Expand Down
2 changes: 1 addition & 1 deletion lib/active_remote/rpc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module RPC

module ClassMethods
# Builds an attribute hash that be assigned directly
# to an object from an rpc response
# to an object from an RPC response
def build_from_rpc(values)
values = values.stringify_keys

Expand Down
10 changes: 4 additions & 6 deletions spec/lib/active_remote/rpc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,28 @@
let(:new_attributes) { {name: "test"} }

it "dups the default attributes" do
expect { ::Tag.build_from_rpc(new_attributes) }.to_not change { ::Tag._default_attributes["name"] }
expect { ::Tag.build_from_rpc(new_attributes).to_h }.to_not change { ::Tag._default_attributes["name"] }
end

context "missing attributes from rpc" do
it "initializes to nil" do
expect(::Tag.build_from_rpc(new_attributes)).to include("guid" => nil)
expect(::Tag.build_from_rpc(new_attributes).to_h).to include("guid" => nil)
end
end

context "extra attributes from rpc" do
let(:new_attributes) { {foobar: "test"} }

it "ignores unknown attributes" do
expect(::Tag.build_from_rpc(new_attributes)).to_not include("foobar" => "test")
expect(::Tag.build_from_rpc(new_attributes).to_h).to_not include("foobar" => "test")
end
end

context "typecasted attributes" do
let(:new_attributes) { {birthday: "2017-01-01"} }

it "calls the typecasters" do
expect(
::Author.build_from_rpc(new_attributes)
).to include({"birthday" => "2017-01-01".to_datetime})
expect(::Author.build_from_rpc(new_attributes).to_h).to include({"birthday" => "2017-01-01".to_datetime})
end
end
end
Expand Down