remockable 0.3.8 → 0.3.10

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: cd890b89ca6632cc7b8461f13e0ef884369eaba7aeeec9a60f9ce7e416d39842
4
- data.tar.gz: c38b42c84ca19e6a25a79583ea485bc5ce2443b18b12a1bc5755942d6cf07bed
3
+ metadata.gz: 5492de95e8e21114d1b6e9561bf73137b943dfabcffe4308ad201d92e966405e
4
+ data.tar.gz: ae94c8bfe61f44b63b85812f3d92527f90fd6f28787e4aa21dbbb549bf6cfee9
5
5
  SHA512:
6
- metadata.gz: db7c72e95d189e453a5d65aad26a11f20d4995e28ca0809d1d821fc232891ef4991d62f4a355df4e5d9ef54072017325aa59bfbcde1258abac04f845c63938c7
7
- data.tar.gz: 908cb59b56057aa44417ed2e6219577cddf7a50607f07afbda28d700b1bece69ec0c3f4c7eb26a9177016f187efd5b92f289873f09e63a7246ba06f3ea3d6544
6
+ metadata.gz: 6acbc06082392f6ca96362bd9082215fd0fdf38eff2f745bcd44faf09245ce18252e7fbf47643b19d7dd0223a9c3700c7d2f16c493f23df9a24d3f11a738d3fe
7
+ data.tar.gz: 24325ec462e5250420f8f6b6f1dda50044c36577dfdc48690560b79651c54d96ec9385e853d1b51eea05ab585712564eae18fb3016cd03b7228ce49dd1a1f24c
@@ -0,0 +1,64 @@
1
+ name: Build
2
+ on:
3
+ - push
4
+ - pull_request
5
+
6
+ jobs:
7
+ build:
8
+ name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }}
9
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
10
+ strategy:
11
+ fail-fast: false
12
+ matrix:
13
+ ruby:
14
+ - "2.5"
15
+ - "2.6"
16
+ - "2.7"
17
+ - "3.0"
18
+ - "3.1"
19
+ rails:
20
+ - "4.2"
21
+ - "5.0"
22
+ - "5.1"
23
+ - "5.2"
24
+ - "6.0"
25
+ - "6.1"
26
+ exclude:
27
+ - ruby: "2.7"
28
+ rails: "4.2"
29
+
30
+ - ruby: "3.0"
31
+ rails: "4.2"
32
+ - ruby: "3.0"
33
+ rails: "5.0"
34
+ - ruby: "3.0"
35
+ rails: "5.1"
36
+ - ruby: "3.0"
37
+ rails: "5.2"
38
+
39
+ - ruby: "3.1"
40
+ rails: "4.2"
41
+ - ruby: "3.1"
42
+ rails: "5.0"
43
+ - ruby: "3.1"
44
+ rails: "5.1"
45
+ - ruby: "3.1"
46
+ rails: "5.2"
47
+ - ruby: "3.1"
48
+ rails: "6.0"
49
+
50
+ runs-on: "ubuntu-latest"
51
+
52
+ env:
53
+ BUNDLE_GEMFILE: gemfiles/rails_${{ matrix.rails }}.gemfile
54
+ RUBYOPT: "--disable-error_highlight"
55
+
56
+ steps:
57
+ - uses: actions/checkout@v2
58
+ - uses: ruby/setup-ruby@v1
59
+ with:
60
+ ruby-version: ${{ matrix.ruby }}
61
+ - name: Setup project
62
+ run: bundle install
63
+ - name: Run tests
64
+ run: bundle exec rspec
data/Appraisals CHANGED
@@ -1,3 +1,10 @@
1
+ appraise 'rails-4.2' do
2
+ gem 'activemodel', '~> 4.2'
3
+ gem 'activerecord', '~> 4.2'
4
+ gem 'activesupport', '~> 4.2'
5
+ gem 'sqlite3', '~> 1.3.6'
6
+ end
7
+
1
8
  appraise 'rails-5.0' do
2
9
  gem 'activemodel', '~> 5.0.0'
3
10
  gem 'activerecord', '~> 5.0.0'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.10 (2024-02-08)
4
+
5
+ * Support symbol values for `:reject_if` option on
6
+ `accept_nested_attributes_for` ([Tyler Hunt][tylerhunt])
7
+
8
+ ## 0.3.9 (2022-05-04)
9
+
10
+ * Allow `:required`/`:optional` aliases with `belongs_to`
11
+ ([Tyler Hunt][tylerhunt])
12
+
3
13
  ## 0.3.8 (2021-07-23)
4
14
 
5
15
  * Add `:where` option to `have_index` ([Tyler Hunt][tylerhunt])
data/README.markdown CHANGED
@@ -1,11 +1,13 @@
1
1
  # Remockable
2
2
 
3
- [![Build Status][travis-image]][travis] [![Dependency Status][gemnasium-image]][gemnasium] [![Gem Version][rubygems-image]][rubygems]
4
-
5
- [travis]: https://travis-ci.org/tylerhunt/remockable
6
- [travis-image]: https://travis-ci.org/tylerhunt/remockable.svg?branch=master
7
- [gemnasium]: https://gemnasium.com/github.com/tylerhunt/remockable
8
- [gemnasium-image]: https://gemnasium.com/badges/github.com/tylerhunt/remockable.svg
3
+ [![Build][build-image]][build]
4
+ [![Maintainability][codeclimate-image]][codeclimate]
5
+ [![Gem Version][rubygems-image]][rubygems]
6
+
7
+ [build]: https://github.com/tylerhunt/remockable/actions/workflows/build.yml?query=branch%3Amaster
8
+ [build-image]: https://github.com/tylerhunt/remockable/actions/workflows/build.yml/badge.svg
9
+ [codeclimate]: https://codeclimate.com/github/tylerhunt/remockable/maintainability
10
+ [codeclimate-image]: https://api.codeclimate.com/v1/badges/c95736ab7cca49228f5c/maintainability
9
11
  [rubygems]: https://badge.fury.io/rb/remockable
10
12
  [rubygems-image]: https://badge.fury.io/rb/remockable.svg
11
13
 
@@ -92,13 +94,13 @@ it { should have_many :subscriptions, through: :customers }
92
94
 
93
95
  ## Contributing
94
96
 
95
- 1. Fork it.
96
- 2. Create your feature branch (`git checkout -b my-new-feature`).
97
- 3. Commit your changes (`git commit -am 'Added some feature'`).
98
- 4. Push to the branch (`git push origin my-new-feature`).
99
- 5. Create a new Pull Request.
97
+ 1. Fork it.
98
+ 2. Create your feature branch (`git checkout -b my-new-feature`).
99
+ 3. Commit your changes (`git commit -am 'Added some feature'`).
100
+ 4. Push to the branch (`git push origin my-new-feature`).
101
+ 5. Create a new Pull Request.
100
102
 
101
103
 
102
104
  ## Copyright
103
105
 
104
- Copyright © 2010-2013 Tyler Hunt. See LICENSE for details.
106
+ Copyright © 2010–2022 Tyler Hunt. See LICENSE for details.
@@ -2,8 +2,9 @@
2
2
 
3
3
  source "https://rubygems.org/"
4
4
 
5
- gem "activemodel", "~> 4.2.0"
6
- gem "activerecord", "~> 4.2.0"
7
- gem "activesupport", "~> 4.2.0"
5
+ gem "activemodel", "~> 4.2"
6
+ gem "activerecord", "~> 4.2"
7
+ gem "activesupport", "~> 4.2"
8
+ gem "sqlite3", "~> 1.3.6"
8
9
 
9
- gemspec path: "../"
10
+ gemspec :path => "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- remockable (0.3.6)
4
+ remockable (0.3.9)
5
5
  activemodel (>= 4.0, < 6.2)
6
6
  activerecord (>= 4.0, < 6.2)
7
7
  activesupport (>= 4.0, < 6.2)
@@ -30,21 +30,21 @@ GEM
30
30
  thor (>= 0.14.0)
31
31
  arel (6.0.4)
32
32
  builder (3.2.4)
33
- concurrent-ruby (1.1.7)
34
- diff-lcs (1.4.4)
33
+ concurrent-ruby (1.1.10)
34
+ diff-lcs (1.5.0)
35
35
  i18n (0.9.5)
36
36
  concurrent-ruby (~> 1.0)
37
- minitest (5.14.3)
37
+ minitest (5.15.0)
38
38
  rake (13.0.3)
39
- rspec-core (3.10.1)
40
- rspec-support (~> 3.10.0)
41
- rspec-expectations (3.10.1)
39
+ rspec-core (3.11.0)
40
+ rspec-support (~> 3.11.0)
41
+ rspec-expectations (3.11.0)
42
42
  diff-lcs (>= 1.2.0, < 2.0)
43
- rspec-support (~> 3.10.0)
44
- rspec-mocks (3.10.1)
43
+ rspec-support (~> 3.11.0)
44
+ rspec-mocks (3.11.1)
45
45
  diff-lcs (>= 1.2.0, < 2.0)
46
- rspec-support (~> 3.10.0)
47
- rspec-support (3.10.1)
46
+ rspec-support (~> 3.11.0)
47
+ rspec-support (3.11.0)
48
48
  sqlite3 (1.3.13)
49
49
  thor (1.0.1)
50
50
  thread_safe (0.3.6)
@@ -55,13 +55,13 @@ PLATFORMS
55
55
  ruby
56
56
 
57
57
  DEPENDENCIES
58
- activemodel (~> 4.2.0)
59
- activerecord (~> 4.2.0)
60
- activesupport (~> 4.2.0)
58
+ activemodel (~> 4.2)
59
+ activerecord (~> 4.2)
60
+ activesupport (~> 4.2)
61
61
  appraisal (~> 2.1)
62
62
  rake
63
63
  remockable!
64
- sqlite3 (~> 1.3.4)
64
+ sqlite3 (~> 1.3.6)
65
65
 
66
66
  BUNDLED WITH
67
- 2.1.4
67
+ 2.3.6
@@ -7,4 +7,4 @@ gem "activerecord", "~> 5.0.0"
7
7
  gem "activesupport", "~> 5.0.0"
8
8
  gem "sqlite3", "~> 1.3.6"
9
9
 
10
- gemspec path: "../"
10
+ gemspec :path => "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- remockable (0.3.7)
4
+ remockable (0.3.9)
5
5
  activemodel (>= 4.0, < 6.2)
6
6
  activerecord (>= 4.0, < 6.2)
7
7
  activesupport (>= 4.0, < 6.2)
@@ -28,21 +28,21 @@ GEM
28
28
  rake
29
29
  thor (>= 0.14.0)
30
30
  arel (7.1.4)
31
- concurrent-ruby (1.1.7)
32
- diff-lcs (1.4.4)
33
- i18n (1.8.7)
31
+ concurrent-ruby (1.1.10)
32
+ diff-lcs (1.5.0)
33
+ i18n (1.10.0)
34
34
  concurrent-ruby (~> 1.0)
35
- minitest (5.14.3)
35
+ minitest (5.15.0)
36
36
  rake (13.0.3)
37
- rspec-core (3.10.1)
38
- rspec-support (~> 3.10.0)
39
- rspec-expectations (3.10.1)
37
+ rspec-core (3.11.0)
38
+ rspec-support (~> 3.11.0)
39
+ rspec-expectations (3.11.0)
40
40
  diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.10.0)
42
- rspec-mocks (3.10.1)
41
+ rspec-support (~> 3.11.0)
42
+ rspec-mocks (3.11.1)
43
43
  diff-lcs (>= 1.2.0, < 2.0)
44
- rspec-support (~> 3.10.0)
45
- rspec-support (3.10.1)
44
+ rspec-support (~> 3.11.0)
45
+ rspec-support (3.11.0)
46
46
  sqlite3 (1.3.13)
47
47
  thor (1.0.1)
48
48
  thread_safe (0.3.6)
@@ -62,4 +62,4 @@ DEPENDENCIES
62
62
  sqlite3 (~> 1.3.6)
63
63
 
64
64
  BUNDLED WITH
65
- 2.1.4
65
+ 2.3.6
@@ -6,4 +6,4 @@ gem "activemodel", "~> 5.1.0"
6
6
  gem "activerecord", "~> 5.1.0"
7
7
  gem "activesupport", "~> 5.1.0"
8
8
 
9
- gemspec path: "../"
9
+ gemspec :path => "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- remockable (0.3.7)
4
+ remockable (0.3.9)
5
5
  activemodel (>= 4.0, < 6.2)
6
6
  activerecord (>= 4.0, < 6.2)
7
7
  activesupport (>= 4.0, < 6.2)
@@ -28,21 +28,21 @@ GEM
28
28
  rake
29
29
  thor (>= 0.14.0)
30
30
  arel (8.0.0)
31
- concurrent-ruby (1.1.7)
32
- diff-lcs (1.4.4)
33
- i18n (1.8.7)
31
+ concurrent-ruby (1.1.10)
32
+ diff-lcs (1.5.0)
33
+ i18n (1.10.0)
34
34
  concurrent-ruby (~> 1.0)
35
- minitest (5.14.3)
35
+ minitest (5.15.0)
36
36
  rake (13.0.3)
37
- rspec-core (3.10.1)
38
- rspec-support (~> 3.10.0)
39
- rspec-expectations (3.10.1)
37
+ rspec-core (3.11.0)
38
+ rspec-support (~> 3.11.0)
39
+ rspec-expectations (3.11.0)
40
40
  diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.10.0)
42
- rspec-mocks (3.10.1)
41
+ rspec-support (~> 3.11.0)
42
+ rspec-mocks (3.11.1)
43
43
  diff-lcs (>= 1.2.0, < 2.0)
44
- rspec-support (~> 3.10.0)
45
- rspec-support (3.10.1)
44
+ rspec-support (~> 3.11.0)
45
+ rspec-support (3.11.0)
46
46
  sqlite3 (1.4.2)
47
47
  thor (1.0.1)
48
48
  thread_safe (0.3.6)
@@ -62,4 +62,4 @@ DEPENDENCIES
62
62
  sqlite3 (~> 1.4.2)
63
63
 
64
64
  BUNDLED WITH
65
- 2.1.4
65
+ 2.3.6
@@ -6,4 +6,4 @@ gem "activemodel", "~> 5.2.0"
6
6
  gem "activerecord", "~> 5.2.0"
7
7
  gem "activesupport", "~> 5.2.0"
8
8
 
9
- gemspec path: "../"
9
+ gemspec :path => "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- remockable (0.3.7)
4
+ remockable (0.3.9)
5
5
  activemodel (>= 4.0, < 6.2)
6
6
  activerecord (>= 4.0, < 6.2)
7
7
  activesupport (>= 4.0, < 6.2)
@@ -12,13 +12,13 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activemodel (5.2.4.4)
16
- activesupport (= 5.2.4.4)
17
- activerecord (5.2.4.4)
18
- activemodel (= 5.2.4.4)
19
- activesupport (= 5.2.4.4)
15
+ activemodel (5.2.7.1)
16
+ activesupport (= 5.2.7.1)
17
+ activerecord (5.2.7.1)
18
+ activemodel (= 5.2.7.1)
19
+ activesupport (= 5.2.7.1)
20
20
  arel (>= 9.0)
21
- activesupport (5.2.4.4)
21
+ activesupport (5.2.7.1)
22
22
  concurrent-ruby (~> 1.0, >= 1.0.2)
23
23
  i18n (>= 0.7, < 2)
24
24
  minitest (~> 5.1)
@@ -28,21 +28,21 @@ GEM
28
28
  rake
29
29
  thor (>= 0.14.0)
30
30
  arel (9.0.0)
31
- concurrent-ruby (1.1.7)
32
- diff-lcs (1.4.4)
33
- i18n (1.8.7)
31
+ concurrent-ruby (1.1.10)
32
+ diff-lcs (1.5.0)
33
+ i18n (1.10.0)
34
34
  concurrent-ruby (~> 1.0)
35
- minitest (5.14.3)
35
+ minitest (5.15.0)
36
36
  rake (13.0.3)
37
- rspec-core (3.10.1)
38
- rspec-support (~> 3.10.0)
39
- rspec-expectations (3.10.1)
37
+ rspec-core (3.11.0)
38
+ rspec-support (~> 3.11.0)
39
+ rspec-expectations (3.11.0)
40
40
  diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.10.0)
42
- rspec-mocks (3.10.1)
41
+ rspec-support (~> 3.11.0)
42
+ rspec-mocks (3.11.1)
43
43
  diff-lcs (>= 1.2.0, < 2.0)
44
- rspec-support (~> 3.10.0)
45
- rspec-support (3.10.1)
44
+ rspec-support (~> 3.11.0)
45
+ rspec-support (3.11.0)
46
46
  sqlite3 (1.4.2)
47
47
  thor (1.0.1)
48
48
  thread_safe (0.3.6)
@@ -62,4 +62,4 @@ DEPENDENCIES
62
62
  sqlite3 (~> 1.4.2)
63
63
 
64
64
  BUNDLED WITH
65
- 2.1.4
65
+ 2.3.6
@@ -6,4 +6,4 @@ gem "activemodel", "~> 6.0.0"
6
6
  gem "activerecord", "~> 6.0.0"
7
7
  gem "activesupport", "~> 6.0.0"
8
8
 
9
- gemspec path: "../"
9
+ gemspec :path => "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- remockable (0.3.7)
4
+ remockable (0.3.9)
5
5
  activemodel (>= 4.0, < 6.2)
6
6
  activerecord (>= 4.0, < 6.2)
7
7
  activesupport (>= 4.0, < 6.2)
@@ -12,12 +12,12 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activemodel (6.0.3.4)
16
- activesupport (= 6.0.3.4)
17
- activerecord (6.0.3.4)
18
- activemodel (= 6.0.3.4)
19
- activesupport (= 6.0.3.4)
20
- activesupport (6.0.3.4)
15
+ activemodel (6.0.4.8)
16
+ activesupport (= 6.0.4.8)
17
+ activerecord (6.0.4.8)
18
+ activemodel (= 6.0.4.8)
19
+ activesupport (= 6.0.4.8)
20
+ activesupport (6.0.4.8)
21
21
  concurrent-ruby (~> 1.0, >= 1.0.2)
22
22
  i18n (>= 0.7, < 2)
23
23
  minitest (~> 5.1)
@@ -27,27 +27,27 @@ GEM
27
27
  bundler
28
28
  rake
29
29
  thor (>= 0.14.0)
30
- concurrent-ruby (1.1.7)
31
- diff-lcs (1.4.4)
32
- i18n (1.8.7)
30
+ concurrent-ruby (1.1.10)
31
+ diff-lcs (1.5.0)
32
+ i18n (1.10.0)
33
33
  concurrent-ruby (~> 1.0)
34
- minitest (5.14.3)
34
+ minitest (5.15.0)
35
35
  rake (13.0.3)
36
- rspec-core (3.10.1)
37
- rspec-support (~> 3.10.0)
38
- rspec-expectations (3.10.1)
36
+ rspec-core (3.11.0)
37
+ rspec-support (~> 3.11.0)
38
+ rspec-expectations (3.11.0)
39
39
  diff-lcs (>= 1.2.0, < 2.0)
40
- rspec-support (~> 3.10.0)
41
- rspec-mocks (3.10.1)
40
+ rspec-support (~> 3.11.0)
41
+ rspec-mocks (3.11.1)
42
42
  diff-lcs (>= 1.2.0, < 2.0)
43
- rspec-support (~> 3.10.0)
44
- rspec-support (3.10.1)
43
+ rspec-support (~> 3.11.0)
44
+ rspec-support (3.11.0)
45
45
  sqlite3 (1.4.2)
46
46
  thor (1.0.1)
47
47
  thread_safe (0.3.6)
48
48
  tzinfo (1.2.9)
49
49
  thread_safe (~> 0.1)
50
- zeitwerk (2.4.2)
50
+ zeitwerk (2.5.4)
51
51
 
52
52
  PLATFORMS
53
53
  ruby
@@ -62,4 +62,4 @@ DEPENDENCIES
62
62
  sqlite3 (~> 1.4.2)
63
63
 
64
64
  BUNDLED WITH
65
- 2.1.4
65
+ 2.3.6
@@ -6,4 +6,4 @@ gem "activemodel", "~> 6.1.0"
6
6
  gem "activerecord", "~> 6.1.0"
7
7
  gem "activesupport", "~> 6.1.0"
8
8
 
9
- gemspec path: "../"
9
+ gemspec :path => "../"
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- remockable (0.3.7)
4
+ remockable (0.3.9)
5
5
  activemodel (>= 4.0, < 6.2)
6
6
  activerecord (>= 4.0, < 6.2)
7
7
  activesupport (>= 4.0, < 6.2)
@@ -12,12 +12,12 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activemodel (6.1.1)
16
- activesupport (= 6.1.1)
17
- activerecord (6.1.1)
18
- activemodel (= 6.1.1)
19
- activesupport (= 6.1.1)
20
- activesupport (6.1.1)
15
+ activemodel (6.1.5.1)
16
+ activesupport (= 6.1.5.1)
17
+ activerecord (6.1.5.1)
18
+ activemodel (= 6.1.5.1)
19
+ activesupport (= 6.1.5.1)
20
+ activesupport (6.1.5.1)
21
21
  concurrent-ruby (~> 1.0, >= 1.0.2)
22
22
  i18n (>= 1.6, < 2)
23
23
  minitest (>= 5.1)
@@ -27,26 +27,26 @@ GEM
27
27
  bundler
28
28
  rake
29
29
  thor (>= 0.14.0)
30
- concurrent-ruby (1.1.7)
31
- diff-lcs (1.4.4)
32
- i18n (1.8.7)
30
+ concurrent-ruby (1.1.10)
31
+ diff-lcs (1.5.0)
32
+ i18n (1.10.0)
33
33
  concurrent-ruby (~> 1.0)
34
- minitest (5.14.3)
34
+ minitest (5.15.0)
35
35
  rake (13.0.3)
36
- rspec-core (3.10.1)
37
- rspec-support (~> 3.10.0)
38
- rspec-expectations (3.10.1)
36
+ rspec-core (3.11.0)
37
+ rspec-support (~> 3.11.0)
38
+ rspec-expectations (3.11.0)
39
39
  diff-lcs (>= 1.2.0, < 2.0)
40
- rspec-support (~> 3.10.0)
41
- rspec-mocks (3.10.1)
40
+ rspec-support (~> 3.11.0)
41
+ rspec-mocks (3.11.1)
42
42
  diff-lcs (>= 1.2.0, < 2.0)
43
- rspec-support (~> 3.10.0)
44
- rspec-support (3.10.1)
43
+ rspec-support (~> 3.11.0)
44
+ rspec-support (3.11.0)
45
45
  sqlite3 (1.4.2)
46
46
  thor (1.0.1)
47
47
  tzinfo (2.0.4)
48
48
  concurrent-ruby (~> 1.0)
49
- zeitwerk (2.4.2)
49
+ zeitwerk (2.5.4)
50
50
 
51
51
  PLATFORMS
52
52
  ruby
@@ -61,4 +61,4 @@ DEPENDENCIES
61
61
  sqlite3 (~> 1.4.2)
62
62
 
63
63
  BUNDLED WITH
64
- 2.1.4
64
+ 2.3.6
@@ -1,12 +1,32 @@
1
+ all_blank_proc =
2
+ ActiveRecord::NestedAttributes::ClassMethods::REJECT_ALL_BLANK_PROC
3
+
1
4
  RSpec::Matchers.define(:accept_nested_attributes_for) do
2
5
  include Remockable::ActiveRecord::Helpers
3
6
 
4
- unsupported_options %w(reject_if)
5
- valid_options %w(allow_destroy limit update_only)
7
+ valid_options %w(allow_destroy limit reject_if update_only)
6
8
 
7
9
  match do |actual|
8
10
  if actual_options = subject.class.nested_attributes_options[attribute]
9
- actual_options.slice(*options.keys) == options
11
+ options_without_reject_if = options.except(:reject_if)
12
+
13
+ reject_if_matches =
14
+ case options[:reject_if]
15
+ when :all_blank
16
+ all_blank_proc == actual_options[:reject_if]
17
+ when Symbol
18
+ options[:reject_if] == actual_options[:reject_if]
19
+ when nil
20
+ true
21
+ else
22
+ raise ArgumentError, 'cannot compare proc values for :reject_if'
23
+ end
24
+
25
+ other_options_match =
26
+ actual_options.slice(*options_without_reject_if.keys) ==
27
+ options_without_reject_if
28
+
29
+ reject_if_matches && other_options_match
10
30
  end
11
31
  end
12
32
 
@@ -19,8 +19,19 @@ RSpec::Matchers.define(:belong_to) do
19
19
 
20
20
  match do |actual|
21
21
  if association = subject.class.reflect_on_association(attribute)
22
+ if ActiveRecord.version > Gem::Version.new('5.0')
23
+ if options.key?(:required)
24
+ options[:optional] = !options.delete(:required)
25
+ end
26
+ else
27
+ if options.key?(:optional)
28
+ options[:required] = !options.delete(:optional)
29
+ end
30
+ end
31
+
22
32
  macro_matches = association.macro == :belongs_to
23
33
  options_match = association.options.slice(*options.keys) == options
34
+
24
35
  macro_matches && options_match
25
36
  end
26
37
  end
@@ -1,3 +1,3 @@
1
1
  module Remockable
2
- VERSION = '0.3.8'
2
+ VERSION = '0.3.10'
3
3
  end
@@ -44,8 +44,11 @@ describe :accept_nested_attributes_for do
44
44
 
45
45
  with_option :allow_destroy, true, false
46
46
  with_option :limit, 1, 2
47
- with_option :update_only, true, false
48
47
 
49
- with_unsupported_option :reject_if, :all_blank
48
+ with_option :reject_if, :all_blank, :all_empty do
49
+ raise_on_invalid_value -> {}, /cannot compare proc values/
50
+ end
51
+
52
+ with_option :update_only, true, false
50
53
  end
51
54
  end
@@ -44,7 +44,10 @@ describe :belong_to do
44
44
 
45
45
  with_option :class_name, 'Company', 'Organization'
46
46
  with_option :foreign_key, :company_id, :organization_id
47
- with_option :foreign_type, :company_type, :organization_type, polymorphic: true
47
+ with_option :foreign_type,
48
+ :company_type,
49
+ :organization_type,
50
+ polymorphic: true
48
51
  with_option :primary_key, :id, :company_id
49
52
  with_option :dependent, :destroy, :nullify
50
53
  with_option :counter_cache, true, false
@@ -55,9 +58,11 @@ describe :belong_to do
55
58
  with_option :inverse_of, :users, :employees
56
59
 
57
60
  if ActiveRecord.version > Gem::Version.new('5.0')
61
+ with_option :required, false, true
58
62
  with_option :optional, true, false
59
63
  else
60
64
  with_option :required, true, false
65
+ with_option :optional, false, true, {}, required: true
61
66
  end
62
67
  end
63
68
  end
@@ -1,5 +1,5 @@
1
1
  shared_examples_for 'an Active Record matcher' do
2
- let(:matcher_name) do
2
+ let(:matcher_name) do
3
3
  if self.class.respond_to?(:module_parent)
4
4
  self.class.module_parent.module_parent.description
5
5
  else
@@ -7,9 +7,19 @@ shared_examples_for 'an Active Record matcher' do
7
7
  end
8
8
  end
9
9
 
10
- def self.with_option(option_name, positive, negative, context={})
10
+ def self.with_option(
11
+ option_name,
12
+ positive,
13
+ negative,
14
+ context={},
15
+ macro_option=nil,
16
+ &block
17
+ )
11
18
  context "with option #{option_name.inspect}" do
12
- let(:options) { context.merge(option_name => positive) }
19
+ let(:option_name) { option_name }
20
+ let(:value) { positive }
21
+
22
+ let(:options) { context.merge(macro_option || { option_name => value }) }
13
23
 
14
24
  before do
15
25
  model.send macro, :company, **options
@@ -22,6 +32,21 @@ shared_examples_for 'an Active Record matcher' do
22
32
  it 'does not match if the options do not match' do
23
33
  should_not send(matcher_name, :company, option_name => negative)
24
34
  end
35
+
36
+ instance_exec &block if block_given?
37
+ end
38
+ end
39
+
40
+ def self.raise_on_invalid_value(value, error_message)
41
+ value_description = value.is_a?(Proc) ? 'proc' : value.inspect
42
+
43
+ context "with #{value_description} value" do
44
+ let(:value) { value }
45
+
46
+ it 'raises an error' do
47
+ expect { should send(matcher_name, :company, option_name => value) }
48
+ .to raise_error ArgumentError, error_message
49
+ end
25
50
  end
26
51
  end
27
52
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remockable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Hunt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-23 00:00:00.000000000 Z
11
+ date: 2024-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -160,9 +160,9 @@ executables: []
160
160
  extensions: []
161
161
  extra_rdoc_files: []
162
162
  files:
163
+ - ".github/workflows/build.yml"
163
164
  - ".gitignore"
164
165
  - ".rspec"
165
- - ".travis.yml"
166
166
  - Appraisals
167
167
  - CHANGELOG.md
168
168
  - Gemfile
@@ -253,7 +253,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
253
253
  - !ruby/object:Gem::Version
254
254
  version: '0'
255
255
  requirements: []
256
- rubygems_version: 3.1.6
256
+ rubyforge_project:
257
+ rubygems_version: 2.7.6.3
257
258
  signing_key:
258
259
  specification_version: 4
259
260
  summary: A collection of RSpec matchers for web apps.
data/.travis.yml DELETED
@@ -1,57 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- before_install: gem install bundler:2.1.4
4
- script: bundle exec rspec
5
- sudo: false
6
-
7
- gemfile:
8
- - gemfiles/rails_5.0.gemfile
9
- - gemfiles/rails_5.1.gemfile
10
- - gemfiles/rails_5.2.gemfile
11
- - gemfiles/rails_6.0.gemfile
12
- - gemfiles/rails_6.1.gemfile
13
-
14
- rvm:
15
- - 2.3.8
16
- - 2.4.10
17
- - 2.5.8
18
- - 2.6.6
19
- - 2.7.2
20
- - 3.0.0
21
-
22
- matrix:
23
- exclude:
24
- - rvm: 2.5.8
25
- gemfile: gemfiles/rails_5.0.gemfile
26
- - rvm: 2.6.6
27
- gemfile: gemfiles/rails_5.0.gemfile
28
- - rvm: 2.7.2
29
- gemfile: gemfiles/rails_5.0.gemfile
30
- - rvm: 3.0.0
31
- gemfile: gemfiles/rails_5.0.gemfile
32
-
33
- - rvm: 2.6.6
34
- gemfile: gemfiles/rails_5.1.gemfile
35
- - rvm: 2.7.2
36
- gemfile: gemfiles/rails_5.1.gemfile
37
- - rvm: 3.0.0
38
- gemfile: gemfiles/rails_5.1.gemfile
39
-
40
- - rvm: 2.6.6
41
- gemfile: gemfiles/rails_5.2.gemfile
42
- - rvm: 2.7.2
43
- gemfile: gemfiles/rails_5.2.gemfile
44
- - rvm: 3.0.0
45
- gemfile: gemfiles/rails_5.2.gemfile
46
-
47
- - rvm: 2.3.8
48
- gemfile: gemfiles/rails_6.0.gemfile
49
- - rvm: 2.4.10
50
- gemfile: gemfiles/rails_6.0.gemfile
51
- - rvm: 3.0.0
52
- gemfile: gemfiles/rails_6.0.gemfile
53
-
54
- - rvm: 2.3.8
55
- gemfile: gemfiles/rails_6.1.gemfile
56
- - rvm: 2.4.10
57
- gemfile: gemfiles/rails_6.1.gemfile