Skip to content

Commit 7913a15

Browse files
ilianaheugeneius
andauthored
Add support for Rails 7.2 and Rails 8.0 (#154)
Co-authored-by: Eugene Kenny <elkenny@gmail.com>
1 parent 1ae376b commit 7913a15

12 files changed

Lines changed: 36 additions & 36 deletions

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ gem 'memory_profiler', require: false
77

88
if RUBY_VERSION < "2.2"
99
gem "sqlite3", "~> 1.3.0"
10-
elsif RUBY_VERSION < "2.5"
10+
elsif RUBY_VERSION < "3.1"
1111
gem "sqlite3", "~> 1.4.0"
1212
gem "term-ansicolor", "< 1.10.3"
1313
elsif RUBY_VERSION >= "3.4"

restpack_serializer.gemspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ Gem::Specification.new do |gem|
1717
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
1818
gem.require_paths = ["lib"]
1919

20-
gem.add_dependency 'activesupport', ['>= 4.0.3', '< 7.2']
21-
gem.add_dependency 'activerecord', ['>= 4.0.3', '< 7.2']
20+
gem.add_dependency 'activesupport', ['>= 4.0.3', '< 8.1']
21+
gem.add_dependency 'activerecord', ['>= 4.0.3', '< 8.1']
2222
gem.add_dependency 'kaminari', ['>= 0.17.0', '< 2.0']
2323

2424
gem.add_development_dependency 'restpack_gem', '~> 0.0.9'
2525
gem.add_development_dependency 'rake', '~> 13'
2626
gem.add_development_dependency 'guard-rspec', '~> 4.7'
27-
gem.add_development_dependency 'factory_girl', '~> 4.7'
28-
gem.add_development_dependency 'sqlite3', '~> 1.3'
27+
gem.add_development_dependency 'sqlite3', '~> 2.1'
28+
gem.add_development_dependency 'factory_bot', '~> 5.0'
2929
gem.add_development_dependency 'database_cleaner'
3030
gem.add_development_dependency 'rspec'
3131
gem.add_development_dependency 'bump'

spec/serializable/paging_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
describe RestPack::Serializer::Paging do
44
before(:each) do
5-
@album1 = FactoryGirl.create(:album_with_songs, song_count: 11)
6-
@album2 = FactoryGirl.create(:album_with_songs, song_count: 7)
5+
@album1 = FactoryBot.create(:album_with_songs, song_count: 11)
6+
@album2 = FactoryBot.create(:album_with_songs, song_count: 7)
77
end
88

99
context "#page" do
@@ -229,8 +229,8 @@
229229

230230
context "with custom scope" do
231231
before do
232-
FactoryGirl.create(:album, year: 1930)
233-
FactoryGirl.create(:album, year: 1948)
232+
FactoryBot.create(:album, year: 1930)
233+
FactoryBot.create(:album, year: 1948)
234234
end
235235
let(:page) { MyApp::AlbumSerializer.page(params, scope) }
236236
let(:scope) { MyApp::Album.classic }

spec/serializable/resource_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
describe RestPack::Serializer::Resource do
44
before(:each) do
5-
@album = FactoryGirl.create(:album_with_songs, song_count: 11)
5+
@album = FactoryBot.create(:album_with_songs, song_count: 11)
66
@song = @album.songs.first
77
end
88

@@ -50,7 +50,7 @@
5050
end
5151

5252
describe "song with no artist" do
53-
let(:song) { FactoryGirl.create(:song, artist: nil) }
53+
let(:song) { FactoryBot.create(:song, artist: nil) }
5454
let(:resource) { MyApp::SongSerializer.resource(id: song.id.to_s) }
5555

5656
it "should not have an artist link" do

spec/serializable/serializer_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def custom_attributes
266266
let(:serializer) { MyApp::SongSerializer.new }
267267

268268
it "includes 'links' data for :belongs_to associations" do
269-
@album1 = FactoryGirl.create(:album_with_songs, song_count: 11)
269+
@album1 = FactoryBot.create(:album_with_songs, song_count: 11)
270270
json = serializer.as_json(@album1.songs.first)
271271
expect(json[:links]).to eq(
272272
artist: @album1.artist_id.to_s,
@@ -276,7 +276,7 @@ def custom_attributes
276276
end
277277

278278
context "with a serializer with has_* associations" do
279-
let(:artist_factory) { FactoryGirl.create :artist_with_fans }
279+
let(:artist_factory) { FactoryBot.create :artist_with_fans }
280280
let(:artist_serializer) { MyApp::ArtistSerializer.new }
281281
let(:json) { artist_serializer.as_json(artist_factory) }
282282
let(:side_load_ids) { artist_has_association.map { |obj| obj.id.to_s } }
@@ -302,7 +302,7 @@ def custom_attributes
302302
end
303303

304304
describe "'has_and_belongs_to_many' associations" do
305-
let(:artist_factory) { FactoryGirl.create :artist_with_stalkers }
305+
let(:artist_factory) { FactoryBot.create :artist_with_stalkers }
306306
let(:artist_has_association) { artist_factory.stalkers }
307307

308308
it "includes 'links' data when there are associated records" do

spec/serializable/side_loading/belongs_to_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
describe ".belongs_to" do
66

77
before(:each) do
8-
FactoryGirl.create(:artist_with_albums, album_count: 2)
9-
FactoryGirl.create(:artist_with_albums, album_count: 1)
8+
FactoryBot.create(:artist_with_albums, album_count: 2)
9+
FactoryBot.create(:artist_with_albums, album_count: 1)
1010
end
1111
let(:side_loads) { MyApp::SongSerializer.side_loads(models, options) }
1212

@@ -68,7 +68,7 @@
6868
end
6969

7070
context 'without an associated model' do
71-
let!(:b_side) { FactoryGirl.create(:song, album: nil) }
71+
let!(:b_side) { FactoryBot.create(:song, album: nil) }
7272
let(:models) { [b_side] }
7373

7474
context 'when including :albums' do

spec/serializable/side_loading/has_and_belongs_many_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
describe ".has_and_belongs_to_many" do
88

99
before(:each) do
10-
@artist1 = FactoryGirl.create(:artist_with_stalkers, stalker_count: 2)
11-
@artist2 = FactoryGirl.create(:artist_with_stalkers, stalker_count: 3)
10+
@artist1 = FactoryBot.create(:artist_with_stalkers, stalker_count: 2)
11+
@artist2 = FactoryBot.create(:artist_with_stalkers, stalker_count: 3)
1212
end
1313

1414
context "with a single model" do

spec/serializable/side_loading/has_many_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
describe ".has_many" do
88

99
before(:each) do
10-
@artist1 = FactoryGirl.create(:artist_with_albums, album_count: 2)
11-
@artist2 = FactoryGirl.create(:artist_with_albums, album_count: 1)
10+
@artist1 = FactoryBot.create(:artist_with_albums, album_count: 2)
11+
@artist2 = FactoryBot.create(:artist_with_albums, album_count: 1)
1212
end
1313

1414
context "with a single model" do
@@ -43,8 +43,8 @@
4343
describe '.has_many through' do
4444
context 'when including :fans' do
4545
let(:options) { RestPack::Serializer::Options.new(MyApp::ArtistSerializer, "include" => "fans") }
46-
let(:artist_1) { FactoryGirl.create :artist_with_fans }
47-
let(:artist_2) { FactoryGirl.create :artist_with_fans }
46+
let(:artist_1) { FactoryBot.create :artist_with_fans }
47+
let(:artist_2) { FactoryBot.create :artist_with_fans }
4848

4949
context "with a single model" do
5050
let(:models) { [artist_1] }

spec/serializable/side_loading/side_loading_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
describe RestPack::Serializer::SideLoading do
44
context "invalid :include" do
55
before(:each) do
6-
FactoryGirl.create(:song)
6+
FactoryBot.create(:song)
77
end
88

99
context "an include to an inexistent model" do
@@ -19,7 +19,7 @@
1919

2020
context "an include to a model which has not been whitelisted with 'can_include'" do
2121
it "raises an exception" do
22-
payment = FactoryGirl.create(:payment)
22+
payment = FactoryBot.create(:payment)
2323
exception = RestPack::Serializer::InvalidInclude
2424
message = ":payments is not a valid include for MyApp::Artist"
2525

spec/serializable/single_spec.rb

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

33
describe RestPack::Serializer::Single do
44
before(:each) do
5-
@album = FactoryGirl.create(:album_with_songs, song_count: 11)
5+
@album = FactoryBot.create(:album_with_songs, song_count: 11)
66
@song = @album.songs.first
77
end
88

0 commit comments

Comments
 (0)