Skip to content

Commit

Permalink
Bump gems and support rails < 8
Browse files Browse the repository at this point in the history
  • Loading branch information
bogderp committed Nov 21, 2024
1 parent 85cc6a5 commit 5f87a5b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 22 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1.152.0
uses: ruby/setup-ruby@v1.202.0
with:
ruby-version: 3.1.4
ruby-version: 3.3.6
bundler-cache: true
- name: Install dependencies
run: bundle install
Expand Down
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.5
10 changes: 5 additions & 5 deletions jsonapi-matchers.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.required_ruby_version = ">= 2.7.7"
spec.required_ruby_version = ">= 3.1.5"

spec.add_dependency "activesupport", ">= 4.0", "< 7.1"
spec.add_dependency "activesupport", ">= 7.0", "< 8"
spec.add_dependency "awesome_print"

spec.add_development_dependency "bump", "~> 0.9.0"
spec.add_development_dependency "bump", "~> 0.10.0"
spec.add_development_dependency "bundler"
spec.add_development_dependency "rake", "~> 13.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "rake", "~> 13.2"
spec.add_development_dependency "rspec", "~> 3.13"
spec.add_development_dependency "pry"
end
2 changes: 1 addition & 1 deletion lib/jsonapi/matchers/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Jsonapi
module Matchers
VERSION = "1.1.0"
VERSION = "1.2.0"
end
end
18 changes: 9 additions & 9 deletions spec/jsonapi/attributes_included_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,14 @@

describe 'with_record' do
context 'record exists' do
let(:record) { OpenStruct.new(id: 'some-car-id') }
let(:record) { Struct.new(:id).new('some-car-id') }

it 'matches' do
expect(have_relationship(:car).with_record(record).matches?(target)).to be_truthy
end

context 'the record id is not a string' do
let(:record) { OpenStruct.new(id: 3) }
let(:record) { Struct.new(:id).new(3) }

it 'matches' do
expect(have_relationship(:bike).with_record(record).matches?(target)).to be_truthy
Expand All @@ -281,7 +281,7 @@
end

context 'record id does not match' do
let(:record) { OpenStruct.new(id: 'not-the-right-car-id') }
let(:record) { Struct.new(:id).new('not-the-right-car-id') }

subject { have_relationship(:car).with_record(record) }

Expand All @@ -296,14 +296,14 @@
end

context 'relationship is array and it matches' do
let(:record) { OpenStruct.new(id: 'some-chair-id-1') }
let(:record) { Struct.new(:id).new('some-chair-id-1') }

it 'matches' do
expect(have_relationship(:chairs).with_record(record).matches?(target)).to be_truthy
end

context 'the record id is not a string' do
let(:record) { OpenStruct.new(id: 4) }
let(:record) { Struct.new(:id).new(4) }

it 'matches' do
expect(have_relationship(:telephones).with_record(record).matches?(target)).to be_truthy
Expand All @@ -312,7 +312,7 @@
end

context 'relationship is array and it does not match' do
let(:record) { OpenStruct.new(id: 'some-chair-id-3') }
let(:record) { Struct.new(:id).new('some-chair-id-3') }

subject { have_relationship(:chairs).with_record(record) }

Expand All @@ -327,7 +327,7 @@
end

context 'relationship does not have an id attribute' do
let(:record) { OpenStruct.new(id: 'some-chair-id-1') }
let(:record) { Struct.new(:id).new('some-chair-id-1') }

subject { have_relationship(:house).with_record(record) }

Expand All @@ -342,7 +342,7 @@
end

context 'relationship is nil' do
let(:record) { OpenStruct.new(id: 'some-chair-id-1') }
let(:record) { Struct.new(:id).new('some-chair-id-1') }

subject { have_relationship(:plane).with_record(record) }

Expand All @@ -357,7 +357,7 @@
end

context 'relationship does not exist' do
let(:record) { OpenStruct.new(id: 'some-chair-id-1') }
let(:record) { Struct.new(:id).new('some-chair-id-1') }

subject { have_relationship(:does_not_exist).with_record(record) }

Expand Down
5 changes: 1 addition & 4 deletions spec/jsonapi/record_included_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,13 @@
let(:subject) { have_record(record) }
let(:response) { ActionDispatch::TestResponse.new(response_data) }
let(:response_data) { '{' }
let(:architecture) { `uname -m`.strip }
let(:arm_expectation) { /Expected response to be json string but was \"{\". JSON::ParserError - unexpected token at '{'/ }
let(:linux_expectation) { /Expected response to be json string but was \"{\". JSON::ParserError - \d\d\d: unexpected token at '{'/ }
let(:expectation) { /Expected response to be json string but was \"{\". JSON::ParserError - unexpected token at '{'/ }

before do
subject.matches?(response)
end

it 'tells you that the response body is not json' do
expectation = architecture == 'arm64' ? arm_expectation : linux_expectation
expect(subject.failure_message).to match(expectation)
end
end
Expand Down

0 comments on commit 5f87a5b

Please sign in to comment.