restpack_serializer 0.6.15 → 0.6.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c2af7afe83c0c640c9085cd34c30f330399878d71f2dea9d879aa4a92074093
4
- data.tar.gz: 41f425d7e75b6d6c2f88ad9e8061c077f9ece21743e7b15ee64285b67e53fb84
3
+ metadata.gz: 84f27b3643c5e1f5edeb5fc3d33fbcf867a7cb77a76a0be7b833f064b6932b9f
4
+ data.tar.gz: be05daf8bca2393be7a09601e736f1728916ee24d269151db30f977bad48f630
5
5
  SHA512:
6
- metadata.gz: d8c496a0cf0e39b32615004ce5288b6301203b15d34be0c69f3f4211db1d81aa63f59028e6a8029a513dba1daa8b50822af4f7b09735a69c6115f2bc1673f685
7
- data.tar.gz: afc2db82579616bf87e19a7fa768713997b37904fffab340e8346d7594d18987edf0acdcdd62c4d9daa6b1407d045a295e00e02c512f54d67bc75d7e47649416
6
+ metadata.gz: 0c58c5caae160d9180f47af9dff1196d368d3dda20ff034aad54dc6beea2f6c20d662a9c1adcdb25a6c1c0e0b4366754d915f8e5f6c91f56561bdfb69b1bba61
7
+ data.tar.gz: 14a8625373457a42b9e29582a25ec0b10826537b5be650c33e725c7d2923b294ba1fb3542f6299b4109aaef0f1272ea1d4af72c48c9070abf3efbf57068f6174
@@ -11,8 +11,6 @@ jobs:
11
11
 
12
12
  matrix:
13
13
  ruby-version:
14
- - 2.1
15
- - 2.2
16
14
  - 2.3
17
15
  - 2.4
18
16
  - 2.5
@@ -21,9 +19,11 @@ jobs:
21
19
  - "3.0"
22
20
  - 3.1
23
21
  - 3.2
22
+ - 3.3
23
+ - 3.4
24
24
 
25
25
  steps:
26
- - uses: actions/checkout@v2
26
+ - uses: actions/checkout@v4
27
27
  - uses: ruby/setup-ruby@v1
28
28
  with:
29
29
  ruby-version: ${{ matrix.ruby-version }}
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.2
1
+ 3.4.4
data/Gemfile CHANGED
@@ -7,4 +7,9 @@ gem 'memory_profiler', require: false
7
7
 
8
8
  if RUBY_VERSION < "2.2"
9
9
  gem "sqlite3", "~> 1.3.0"
10
+ elsif RUBY_VERSION < "3.1"
11
+ gem "sqlite3", "~> 1.4.0"
12
+ gem "term-ansicolor", "< 1.10.3"
13
+ elsif RUBY_VERSION >= "3.4"
14
+ gem "factory_bot", "~> 6.0"
10
15
  end
@@ -1,5 +1,5 @@
1
1
  module RestPack
2
2
  module Serializer
3
- VERSION = '0.6.15'
3
+ VERSION = '0.6.16'
4
4
  end
5
5
  end
@@ -17,15 +17,15 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
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']
22
22
  gem.add_dependency 'kaminari', ['>= 0.17.0', '< 2.0']
23
23
 
24
24
  gem.add_development_dependency 'restpack_gem', '~> 0.0.9'
25
25
  gem.add_development_dependency 'rake', '~> 13'
26
26
  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'
29
29
  gem.add_development_dependency 'database_cleaner'
30
30
  gem.add_development_dependency 'rspec'
31
31
  gem.add_development_dependency 'bump'
@@ -1,4 +1,5 @@
1
1
  require 'spec_helper'
2
+ require 'ostruct'
2
3
 
3
4
  describe RestPack::Serializer::Attributes do
4
5
  class CustomSerializer
@@ -2,8 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe RestPack::Serializer::Paging do
4
4
  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)
7
7
  end
8
8
 
9
9
  context "#page" do
@@ -229,8 +229,8 @@ describe RestPack::Serializer::Paging do
229
229
 
230
230
  context "with custom scope" do
231
231
  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)
234
234
  end
235
235
  let(:page) { MyApp::AlbumSerializer.page(params, scope) }
236
236
  let(:scope) { MyApp::Album.classic }
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe RestPack::Serializer::Resource do
4
4
  before(:each) do
5
- @album = FactoryGirl.create(:album_with_songs, song_count: 11)
5
+ @album = FactoryBot.create(:album_with_songs, song_count: 11)
6
6
  @song = @album.songs.first
7
7
  end
8
8
 
@@ -50,7 +50,7 @@ describe RestPack::Serializer::Resource do
50
50
  end
51
51
 
52
52
  describe "song with no artist" do
53
- let(:song) { FactoryGirl.create(:song, artist: nil) }
53
+ let(:song) { FactoryBot.create(:song, artist: nil) }
54
54
  let(:resource) { MyApp::SongSerializer.resource(id: song.id.to_s) }
55
55
 
56
56
  it "should not have an artist link" do
@@ -266,7 +266,7 @@ describe RestPack::Serializer do
266
266
  let(:serializer) { MyApp::SongSerializer.new }
267
267
 
268
268
  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)
270
270
  json = serializer.as_json(@album1.songs.first)
271
271
  expect(json[:links]).to eq(
272
272
  artist: @album1.artist_id.to_s,
@@ -276,7 +276,7 @@ describe RestPack::Serializer do
276
276
  end
277
277
 
278
278
  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 }
280
280
  let(:artist_serializer) { MyApp::ArtistSerializer.new }
281
281
  let(:json) { artist_serializer.as_json(artist_factory) }
282
282
  let(:side_load_ids) { artist_has_association.map { |obj| obj.id.to_s } }
@@ -302,7 +302,7 @@ describe RestPack::Serializer do
302
302
  end
303
303
 
304
304
  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 }
306
306
  let(:artist_has_association) { artist_factory.stalkers }
307
307
 
308
308
  it "includes 'links' data when there are associated records" do
@@ -5,8 +5,8 @@ describe RestPack::Serializer::SideLoading do
5
5
  describe ".belongs_to" do
6
6
 
7
7
  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)
10
10
  end
11
11
  let(:side_loads) { MyApp::SongSerializer.side_loads(models, options) }
12
12
 
@@ -68,7 +68,7 @@ describe RestPack::Serializer::SideLoading do
68
68
  end
69
69
 
70
70
  context 'without an associated model' do
71
- let!(:b_side) { FactoryGirl.create(:song, album: nil) }
71
+ let!(:b_side) { FactoryBot.create(:song, album: nil) }
72
72
  let(:models) { [b_side] }
73
73
 
74
74
  context 'when including :albums' do
@@ -7,8 +7,8 @@ describe RestPack::Serializer::SideLoading do
7
7
  describe ".has_and_belongs_to_many" do
8
8
 
9
9
  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)
12
12
  end
13
13
 
14
14
  context "with a single model" do
@@ -7,8 +7,8 @@ describe RestPack::Serializer::SideLoading do
7
7
  describe ".has_many" do
8
8
 
9
9
  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)
12
12
  end
13
13
 
14
14
  context "with a single model" do
@@ -43,8 +43,8 @@ describe RestPack::Serializer::SideLoading do
43
43
  describe '.has_many through' do
44
44
  context 'when including :fans' do
45
45
  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 }
48
48
 
49
49
  context "with a single model" do
50
50
  let(:models) { [artist_1] }
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe RestPack::Serializer::SideLoading do
4
4
  context "invalid :include" do
5
5
  before(:each) do
6
- FactoryGirl.create(:song)
6
+ FactoryBot.create(:song)
7
7
  end
8
8
 
9
9
  context "an include to an inexistent model" do
@@ -19,7 +19,7 @@ describe RestPack::Serializer::SideLoading do
19
19
 
20
20
  context "an include to a model which has not been whitelisted with 'can_include'" do
21
21
  it "raises an exception" do
22
- payment = FactoryGirl.create(:payment)
22
+ payment = FactoryBot.create(:payment)
23
23
  exception = RestPack::Serializer::InvalidInclude
24
24
  message = ":payments is not a valid include for MyApp::Artist"
25
25
 
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe RestPack::Serializer::Single do
4
4
  before(:each) do
5
- @album = FactoryGirl.create(:album_with_songs, song_count: 11)
5
+ @album = FactoryBot.create(:album_with_songs, song_count: 11)
6
6
  @song = @album.songs.first
7
7
  end
8
8
 
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'rspec'
2
+ require 'logger'
2
3
  require './lib/restpack_serializer'
3
4
  require './spec/fixtures/db'
4
5
  require './spec/fixtures/serializers'
@@ -8,10 +9,10 @@ require 'coveralls'
8
9
 
9
10
  Coveralls::Output.silent = true unless ENV["CI"]
10
11
  Coveralls.wear!
11
- FactoryGirl.find_definitions
12
+ FactoryBot.find_definitions
12
13
 
13
14
  RSpec.configure do |config|
14
- config.include FactoryGirl::Syntax::Methods
15
+ config.include FactoryBot::Syntax::Methods
15
16
  config.raise_errors_for_deprecations!
16
17
 
17
18
  config.before(:suite) do
@@ -1,12 +1,12 @@
1
- require 'factory_girl'
1
+ require 'factory_bot'
2
2
 
3
- FactoryGirl.define do
3
+ FactoryBot.define do
4
4
  factory :artist, class: MyApp::Artist do
5
5
  sequence(:name) { |n| "Artist ##{n}" }
6
6
  sequence(:website) { |n| "http://website#{n}.com/" }
7
7
 
8
8
  factory :artist_with_albums do
9
- transient { album_count 3 }
9
+ transient { album_count { 3 } }
10
10
 
11
11
  after(:create) do |artist, evaluator|
12
12
  create_list(:album_with_songs, evaluator.album_count, artist: artist)
@@ -14,7 +14,7 @@ FactoryGirl.define do
14
14
  end
15
15
 
16
16
  factory :artist_with_fans do
17
- transient { fans_count 3 }
17
+ transient { fans_count { 3 } }
18
18
 
19
19
  after(:create) do |artist, evaluator|
20
20
  create_list(:payment, evaluator.fans_count, artist: artist)
@@ -22,7 +22,7 @@ FactoryGirl.define do
22
22
  end
23
23
 
24
24
  factory :artist_with_stalkers do
25
- transient { stalker_count 2 }
25
+ transient { stalker_count { 2 } }
26
26
 
27
27
  after(:create) do |artist, evaluator|
28
28
  create_list(:stalker, evaluator.stalker_count, artists: [artist])
@@ -36,7 +36,7 @@ FactoryGirl.define do
36
36
  artist
37
37
 
38
38
  factory :album_with_songs do
39
- transient { song_count 10 }
39
+ transient { song_count { 10 } }
40
40
 
41
41
  after(:create) do |album, evaluator|
42
42
  create_list(:song, evaluator.song_count, album: album, artist: album.artist)
@@ -51,7 +51,7 @@ FactoryGirl.define do
51
51
  end
52
52
 
53
53
  factory :payment, class: MyApp::Payment do
54
- amount 999
54
+ amount { 999 }
55
55
  artist
56
56
  fan
57
57
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restpack_serializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.15
4
+ version: 0.6.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Joyce
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-10-12 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -19,7 +18,7 @@ dependencies:
19
18
  version: 4.0.3
20
19
  - - "<"
21
20
  - !ruby/object:Gem::Version
22
- version: '7.2'
21
+ version: '8.1'
23
22
  type: :runtime
24
23
  prerelease: false
25
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +28,7 @@ dependencies:
29
28
  version: 4.0.3
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
- version: '7.2'
31
+ version: '8.1'
33
32
  - !ruby/object:Gem::Dependency
34
33
  name: activerecord
35
34
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +38,7 @@ dependencies:
39
38
  version: 4.0.3
40
39
  - - "<"
41
40
  - !ruby/object:Gem::Version
42
- version: '7.2'
41
+ version: '8.1'
43
42
  type: :runtime
44
43
  prerelease: false
45
44
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +48,7 @@ dependencies:
49
48
  version: 4.0.3
50
49
  - - "<"
51
50
  - !ruby/object:Gem::Version
52
- version: '7.2'
51
+ version: '8.1'
53
52
  - !ruby/object:Gem::Dependency
54
53
  name: kaminari
55
54
  requirement: !ruby/object:Gem::Requirement
@@ -113,33 +112,33 @@ dependencies:
113
112
  - !ruby/object:Gem::Version
114
113
  version: '4.7'
115
114
  - !ruby/object:Gem::Dependency
116
- name: factory_girl
115
+ name: sqlite3
117
116
  requirement: !ruby/object:Gem::Requirement
118
117
  requirements:
119
118
  - - "~>"
120
119
  - !ruby/object:Gem::Version
121
- version: '4.7'
120
+ version: '2.1'
122
121
  type: :development
123
122
  prerelease: false
124
123
  version_requirements: !ruby/object:Gem::Requirement
125
124
  requirements:
126
125
  - - "~>"
127
126
  - !ruby/object:Gem::Version
128
- version: '4.7'
127
+ version: '2.1'
129
128
  - !ruby/object:Gem::Dependency
130
- name: sqlite3
129
+ name: factory_bot
131
130
  requirement: !ruby/object:Gem::Requirement
132
131
  requirements:
133
132
  - - "~>"
134
133
  - !ruby/object:Gem::Version
135
- version: '1.3'
134
+ version: '5.0'
136
135
  type: :development
137
136
  prerelease: false
138
137
  version_requirements: !ruby/object:Gem::Requirement
139
138
  requirements:
140
139
  - - "~>"
141
140
  - !ruby/object:Gem::Version
142
- version: '1.3'
141
+ version: '5.0'
143
142
  - !ruby/object:Gem::Dependency
144
143
  name: database_cleaner
145
144
  requirement: !ruby/object:Gem::Requirement
@@ -238,7 +237,6 @@ files:
238
237
  homepage: https://github.com/RestPack
239
238
  licenses: []
240
239
  metadata: {}
241
- post_install_message:
242
240
  rdoc_options: []
243
241
  require_paths:
244
242
  - lib
@@ -253,8 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
253
251
  - !ruby/object:Gem::Version
254
252
  version: '0'
255
253
  requirements: []
256
- rubygems_version: 3.4.10
257
- signing_key:
254
+ rubygems_version: 3.6.7
258
255
  specification_version: 4
259
256
  summary: Model serialization, paging, side-loading and filtering
260
257
  test_files: