cable_ready 5.0.0.pre4 → 5.0.0.pre8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +54 -0
- data/Gemfile.lock +29 -29
- data/README.md +12 -8
- data/Rakefile +3 -1
- data/app/helpers/cable_ready_helper.rb +2 -1
- data/app/models/concerns/cable_ready/updatable/collections_registry.rb +1 -1
- data/app/models/concerns/cable_ready/updatable/model_updatable_callbacks.rb +1 -1
- data/app/models/concerns/cable_ready/updatable.rb +2 -2
- data/lib/cable_ready/channel.rb +12 -2
- data/lib/cable_ready/sanity_checker.rb +0 -58
- data/lib/cable_ready/version.rb +1 -1
- data/test/lib/cable_ready/updatable_test.rb +8 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 876c1dc40f4011627e0b86aeb608639bdb6b462f138a089393b13409138a64e6
|
4
|
+
data.tar.gz: df9910c1cf11d50168daa290bbf5894798a439449efc191a73d701a7dc2960ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6e759fb014ceeaec631f58f156b9e9cc68b3d1803b5ec895c08e1eaedaa075d3f7bd6822c9a3279a434ecf6c9315d99423f402630e416305420720fa2da2568
|
7
|
+
data.tar.gz: 3d1fbbe4b8607d547a2a160ef93e041e935ad3876ffb2cf76f448ece065cd7a22e2935a8fcc4163108d293ddaab708bf5f54348b09e4fcc88c44de2202e80b61
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,59 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v5.0.0.pre7](https://github.com/stimulusreflex/cable_ready/tree/v5.0.0.pre7) (2021-10-26)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/stimulusreflex/cable_ready/compare/v5.0.0.pre6...v5.0.0.pre7)
|
6
|
+
|
7
|
+
**Merged pull requests:**
|
8
|
+
|
9
|
+
- Add custom header to fetch [\#159](https://github.com/stimulusreflex/cable_ready/pull/159) ([julianrubisch](https://github.com/julianrubisch))
|
10
|
+
|
11
|
+
## [v5.0.0.pre6](https://github.com/stimulusreflex/cable_ready/tree/v5.0.0.pre6) (2021-10-14)
|
12
|
+
|
13
|
+
[Full Changelog](https://github.com/stimulusreflex/cable_ready/compare/v5.0.0.pre5...v5.0.0.pre6)
|
14
|
+
|
15
|
+
**Merged pull requests:**
|
16
|
+
|
17
|
+
- Re-export consumer [\#158](https://github.com/stimulusreflex/cable_ready/pull/158) ([julianrubisch](https://github.com/julianrubisch))
|
18
|
+
- Consolidate elements into a base class [\#157](https://github.com/stimulusreflex/cable_ready/pull/157) ([julianrubisch](https://github.com/julianrubisch))
|
19
|
+
|
20
|
+
## [v5.0.0.pre5](https://github.com/stimulusreflex/cable_ready/tree/v5.0.0.pre5) (2021-10-07)
|
21
|
+
|
22
|
+
[Full Changelog](https://github.com/stimulusreflex/cable_ready/compare/v5.0.0.pre4...v5.0.0.pre5)
|
23
|
+
|
24
|
+
**Implemented enhancements:**
|
25
|
+
|
26
|
+
- error handling for updates\_for edge cases [\#155](https://github.com/stimulusreflex/cable_ready/pull/155) ([leastbad](https://github.com/leastbad))
|
27
|
+
- post-pre4 updates [\#154](https://github.com/stimulusreflex/cable_ready/pull/154) ([leastbad](https://github.com/leastbad))
|
28
|
+
|
29
|
+
**Fixed bugs:**
|
30
|
+
|
31
|
+
- Given multiple updates\_for blocks with custom urls, only the first is re-fetched [\#153](https://github.com/stimulusreflex/cable_ready/issues/153)
|
32
|
+
|
33
|
+
**Merged pull requests:**
|
34
|
+
|
35
|
+
- Export elements [\#156](https://github.com/stimulusreflex/cable_ready/pull/156) ([julianrubisch](https://github.com/julianrubisch))
|
36
|
+
|
37
|
+
## [v5.0.0.pre4](https://github.com/stimulusreflex/cable_ready/tree/v5.0.0.pre4) (2021-10-01)
|
38
|
+
|
39
|
+
[Full Changelog](https://github.com/stimulusreflex/cable_ready/compare/v5.0.0.pre3...v5.0.0.pre4)
|
40
|
+
|
41
|
+
**Implemented enhancements:**
|
42
|
+
|
43
|
+
- Receive morph updates from model/PORO callbacks [\#145](https://github.com/stimulusreflex/cable_ready/pull/145) ([leastbad](https://github.com/leastbad))
|
44
|
+
|
45
|
+
**Closed issues:**
|
46
|
+
|
47
|
+
- Uncaught TypeError: operations.forEach is not a function [\#149](https://github.com/stimulusreflex/cable_ready/issues/149)
|
48
|
+
|
49
|
+
**Merged pull requests:**
|
50
|
+
|
51
|
+
- Optionally debounce updates [\#151](https://github.com/stimulusreflex/cable_ready/pull/151) ([julianrubisch](https://github.com/julianrubisch))
|
52
|
+
- Fix updates for lazy loading [\#150](https://github.com/stimulusreflex/cable_ready/pull/150) ([julianrubisch](https://github.com/julianrubisch))
|
53
|
+
- Bump nokogiri from 1.12.3 to 1.12.5 [\#148](https://github.com/stimulusreflex/cable_ready/pull/148) ([dependabot[bot]](https://github.com/apps/dependabot))
|
54
|
+
- \[Readme\] Make badges link to RubyGems and npm packages [\#147](https://github.com/stimulusreflex/cable_ready/pull/147) ([palkan](https://github.com/palkan))
|
55
|
+
- Fix wrong CableReady import [\#146](https://github.com/stimulusreflex/cable_ready/pull/146) ([n-rodriguez](https://github.com/n-rodriguez))
|
56
|
+
|
3
57
|
## [v5.0.0.pre3](https://github.com/stimulusreflex/cable_ready/tree/v5.0.0.pre3) (2021-08-22)
|
4
58
|
|
5
59
|
[Full Changelog](https://github.com/stimulusreflex/cable_ready/compare/v5.0.0.pre2...v5.0.0.pre3)
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cable_ready (5.0.0.
|
4
|
+
cable_ready (5.0.0.pre8)
|
5
5
|
rails (>= 5.2)
|
6
6
|
thread-local (>= 1.1.0)
|
7
7
|
|
@@ -86,7 +86,7 @@ GEM
|
|
86
86
|
faraday
|
87
87
|
async-io (1.32.2)
|
88
88
|
async
|
89
|
-
async-pool (0.3.
|
89
|
+
async-pool (0.3.9)
|
90
90
|
async (>= 1.25)
|
91
91
|
builder (3.2.4)
|
92
92
|
coderay (1.1.3)
|
@@ -95,7 +95,7 @@ GEM
|
|
95
95
|
fiber-local
|
96
96
|
crass (1.0.6)
|
97
97
|
erubi (1.10.0)
|
98
|
-
faraday (1.
|
98
|
+
faraday (1.8.0)
|
99
99
|
faraday-em_http (~> 1.0)
|
100
100
|
faraday-em_synchrony (~> 1.0)
|
101
101
|
faraday-excon (~> 1.1)
|
@@ -128,7 +128,7 @@ GEM
|
|
128
128
|
rake (>= 10.0)
|
129
129
|
globalid (0.5.2)
|
130
130
|
activesupport (>= 5.0)
|
131
|
-
i18n (1.8.
|
131
|
+
i18n (1.8.11)
|
132
132
|
concurrent-ruby (~> 1.0)
|
133
133
|
loofah (2.12.0)
|
134
134
|
crass (~> 1.0.2)
|
@@ -136,9 +136,9 @@ GEM
|
|
136
136
|
magic_frozen_string_literal (1.2.0)
|
137
137
|
mail (2.7.1)
|
138
138
|
mini_mime (>= 0.1.1)
|
139
|
-
marcel (1.0.
|
140
|
-
method_source (0.
|
141
|
-
mini_mime (1.1.
|
139
|
+
marcel (1.0.2)
|
140
|
+
method_source (1.0.0)
|
141
|
+
mini_mime (1.1.2)
|
142
142
|
minitest (5.14.4)
|
143
143
|
mocha (1.13.0)
|
144
144
|
multi_json (1.15.0)
|
@@ -149,23 +149,23 @@ GEM
|
|
149
149
|
octokit (4.21.0)
|
150
150
|
faraday (>= 0.9)
|
151
151
|
sawyer (~> 0.8.0, >= 0.5.3)
|
152
|
-
parallel (1.
|
152
|
+
parallel (1.21.0)
|
153
153
|
parser (3.0.2.0)
|
154
154
|
ast (~> 2.4.1)
|
155
155
|
protocol-hpack (1.4.2)
|
156
156
|
protocol-http (0.22.5)
|
157
|
-
protocol-http1 (0.14.
|
157
|
+
protocol-http1 (0.14.2)
|
158
158
|
protocol-http (~> 0.22)
|
159
159
|
protocol-http2 (0.14.2)
|
160
160
|
protocol-hpack (~> 1.4)
|
161
161
|
protocol-http (~> 0.18)
|
162
|
-
pry (0.
|
163
|
-
coderay (~> 1.1
|
164
|
-
method_source (~>
|
165
|
-
pry-nav (0.
|
166
|
-
pry (>= 0.9.10, < 0.
|
162
|
+
pry (0.14.1)
|
163
|
+
coderay (~> 1.1)
|
164
|
+
method_source (~> 1.0)
|
165
|
+
pry-nav (1.0.0)
|
166
|
+
pry (>= 0.9.10, < 0.15)
|
167
167
|
public_suffix (4.0.6)
|
168
|
-
racc (1.
|
168
|
+
racc (1.6.0)
|
169
169
|
rack (2.2.3)
|
170
170
|
rack-test (1.1.0)
|
171
171
|
rack (>= 1.0, < 3)
|
@@ -199,18 +199,18 @@ GEM
|
|
199
199
|
rake (13.0.6)
|
200
200
|
regexp_parser (2.1.1)
|
201
201
|
rexml (3.2.5)
|
202
|
-
rubocop (1.
|
202
|
+
rubocop (1.22.3)
|
203
203
|
parallel (~> 1.10)
|
204
204
|
parser (>= 3.0.0.0)
|
205
205
|
rainbow (>= 2.2.2, < 4.0)
|
206
206
|
regexp_parser (>= 1.8, < 3.0)
|
207
207
|
rexml
|
208
|
-
rubocop-ast (>= 1.
|
208
|
+
rubocop-ast (>= 1.12.0, < 2.0)
|
209
209
|
ruby-progressbar (~> 1.7)
|
210
210
|
unicode-display_width (>= 1.4.0, < 3.0)
|
211
|
-
rubocop-ast (1.
|
211
|
+
rubocop-ast (1.13.0)
|
212
212
|
parser (>= 3.0.1.1)
|
213
|
-
rubocop-performance (1.11.
|
213
|
+
rubocop-performance (1.11.5)
|
214
214
|
rubocop (>= 1.7.0, < 2.0)
|
215
215
|
rubocop-ast (>= 0.4.0)
|
216
216
|
ruby-progressbar (1.11.0)
|
@@ -221,14 +221,14 @@ GEM
|
|
221
221
|
sprockets (4.0.2)
|
222
222
|
concurrent-ruby (~> 1.0)
|
223
223
|
rack (> 1, < 3)
|
224
|
-
sprockets-rails (3.
|
225
|
-
actionpack (>=
|
226
|
-
activesupport (>=
|
224
|
+
sprockets-rails (3.4.0)
|
225
|
+
actionpack (>= 5.2)
|
226
|
+
activesupport (>= 5.2)
|
227
227
|
sprockets (>= 3.0.0)
|
228
228
|
sqlite3 (1.4.2)
|
229
|
-
standard (1.
|
230
|
-
rubocop (= 1.
|
231
|
-
rubocop-performance (= 1.11.
|
229
|
+
standard (1.4.0)
|
230
|
+
rubocop (= 1.22.3)
|
231
|
+
rubocop-performance (= 1.11.5)
|
232
232
|
standardrb (1.0.0)
|
233
233
|
standard
|
234
234
|
thor (1.1.0)
|
@@ -236,14 +236,14 @@ GEM
|
|
236
236
|
timers (4.3.3)
|
237
237
|
tzinfo (2.0.4)
|
238
238
|
concurrent-ruby (~> 1.0)
|
239
|
-
unicode-display_width (2.
|
239
|
+
unicode-display_width (2.1.0)
|
240
240
|
websocket-driver (0.7.5)
|
241
241
|
websocket-extensions (>= 0.1.0)
|
242
242
|
websocket-extensions (0.1.5)
|
243
|
-
zeitwerk (2.
|
243
|
+
zeitwerk (2.5.1)
|
244
244
|
|
245
245
|
PLATFORMS
|
246
|
-
|
246
|
+
x86_64-linux
|
247
247
|
|
248
248
|
DEPENDENCIES
|
249
249
|
cable_ready!
|
@@ -257,4 +257,4 @@ DEPENDENCIES
|
|
257
257
|
standardrb
|
258
258
|
|
259
259
|
BUNDLED WITH
|
260
|
-
2.2.
|
260
|
+
2.2.27
|
data/README.md
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
<img src="https://gitcdn.link/repo/stimulusreflex/cable_ready/master/assets/cable-ready-logo-with-copy.svg" width="360" />
|
3
3
|
<h1 align="center">Welcome to CableReady 👋</h1>
|
4
4
|
<p align="center">
|
5
|
-
<a href="https://rubygems.org/gems/cable_ready">
|
5
|
+
<a href="https://rubygems.org/gems/cable_ready">
|
6
6
|
<img src="https://img.shields.io/gem/v/cable_ready.svg?color=red" />
|
7
|
-
</a>
|
8
|
-
<a href="https://www.npmjs.com/package/cable_ready">
|
7
|
+
</a>
|
8
|
+
<a href="https://www.npmjs.com/package/cable_ready">
|
9
9
|
<img src="https://img.shields.io/npm/v/cable_ready.svg?color=blue" />
|
10
10
|
</a>
|
11
11
|
<a href="https://www.npmjs.com/package/cable_ready">
|
@@ -82,11 +82,15 @@ Please run `./bin/standardize` prior submitting pull requests.
|
|
82
82
|
|
83
83
|
### 📦 Releasing
|
84
84
|
|
85
|
-
1.
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
85
|
+
1. Make sure that you run `yarn` and `bundle` to pick up the latest.
|
86
|
+
1. Bump version number at `lib/cable_ready/version.rb`. Pre-release versions use `.preN`
|
87
|
+
1. Run `rake build`
|
88
|
+
1. Commit and push changes to github
|
89
|
+
1. Run `rake release`
|
90
|
+
1. Run `yarn publish --no-git-tag-version`
|
91
|
+
1. Yarn will prompt you for the new version. Pre-release versions use `-preN`
|
92
|
+
1. Run `GITHUB_CHANGELOG_GENERATOR_TOKEN=SECRET rake changelog`
|
93
|
+
1. Commit and push changes to github
|
90
94
|
|
91
95
|
## 📝 License
|
92
96
|
|
data/Rakefile
CHANGED
@@ -16,6 +16,8 @@ Rake::TestTask.new(:test) do |t|
|
|
16
16
|
end
|
17
17
|
|
18
18
|
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
19
|
-
config.user = "
|
19
|
+
config.user = "stimulusreflex"
|
20
20
|
config.project = "cable_ready"
|
21
|
+
config.exclude_labels = %w[duplicate question invalid wontfix nodoc]
|
22
|
+
config.token = ENV["GITHUB_CHANGELOG_GENERATOR_TOKEN"]
|
21
23
|
end
|
@@ -8,10 +8,11 @@ module CableReadyHelper
|
|
8
8
|
tag.stream_from(**build_options(*keys, html_options))
|
9
9
|
end
|
10
10
|
|
11
|
-
def updates_for(*keys, url: nil, debounce: nil, html_options: {}, &block)
|
11
|
+
def updates_for(*keys, url: nil, debounce: nil, only: nil, html_options: {}, &block)
|
12
12
|
options = build_options(*keys, html_options)
|
13
13
|
options[:url] = url if url
|
14
14
|
options[:debounce] = debounce if debounce
|
15
|
+
options[:only] = only if only
|
15
16
|
tag.updates_for(**options) { capture(&block) }
|
16
17
|
end
|
17
18
|
|
@@ -15,7 +15,7 @@ module CableReady
|
|
15
15
|
resource = find_resource_for_update(collection, model)
|
16
16
|
next if resource.nil?
|
17
17
|
|
18
|
-
collection[:klass].cable_ready_update_collection(resource, collection[:name]) if collection[:options][:if].call(resource)
|
18
|
+
collection[:klass].cable_ready_update_collection(resource, collection[:name], model) if collection[:options][:if].call(resource)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -21,7 +21,7 @@ module CableReady
|
|
21
21
|
|
22
22
|
def broadcast_update(model)
|
23
23
|
ActionCable.server.broadcast(model.class, {})
|
24
|
-
ActionCable.server.broadcast(model.to_global_id, {})
|
24
|
+
ActionCable.server.broadcast(model.to_global_id, model.respond_to?(:previous_changes) ? {changed: model.previous_changes.keys} : {})
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -43,9 +43,9 @@ module CableReady
|
|
43
43
|
@cable_ready_collections ||= CollectionsRegistry.new
|
44
44
|
end
|
45
45
|
|
46
|
-
def cable_ready_update_collection(resource, name)
|
46
|
+
def cable_ready_update_collection(resource, name, model)
|
47
47
|
identifier = resource.to_global_id.to_s + ":" + name.to_s
|
48
|
-
ActionCable.server.broadcast(identifier, {})
|
48
|
+
ActionCable.server.broadcast(identifier, model.respond_to?(:previous_changes) ? {changed: model.previous_changes.keys} : {})
|
49
49
|
end
|
50
50
|
|
51
51
|
def enrich_association_with_updates(name, option)
|
data/lib/cable_ready/channel.rb
CHANGED
@@ -5,13 +5,23 @@ module CableReady
|
|
5
5
|
attr_reader :identifier
|
6
6
|
|
7
7
|
def broadcast(clear: true)
|
8
|
-
ActionCable.server.broadcast identifier, {
|
8
|
+
clients_received = ActionCable.server.broadcast identifier, {
|
9
|
+
"cableReady" => true,
|
10
|
+
"operations" => operations_payload,
|
11
|
+
"version" => CableReady::VERSION
|
12
|
+
}
|
9
13
|
reset! if clear
|
14
|
+
clients_received
|
10
15
|
end
|
11
16
|
|
12
17
|
def broadcast_to(model, clear: true)
|
13
|
-
identifier.broadcast_to model, {
|
18
|
+
clients_received = identifier.broadcast_to model, {
|
19
|
+
"cableReady" => true,
|
20
|
+
"operations" => operations_payload,
|
21
|
+
"version" => CableReady::VERSION
|
22
|
+
}
|
14
23
|
reset! if clear
|
24
|
+
clients_received
|
15
25
|
end
|
16
26
|
|
17
27
|
def broadcast_later(clear: true)
|
@@ -2,8 +2,6 @@
|
|
2
2
|
|
3
3
|
class CableReady::SanityChecker
|
4
4
|
LATEST_VERSION_FORMAT = /^(\d+\.\d+\.\d+)$/
|
5
|
-
NODE_VERSION_FORMAT = /(\d+\.\d+\.\d+.*):/
|
6
|
-
JSON_VERSION_FORMAT = /(\d+\.\d+\.\d+.*)"/
|
7
5
|
|
8
6
|
class << self
|
9
7
|
def check!
|
@@ -13,7 +11,6 @@ class CableReady::SanityChecker
|
|
13
11
|
return if called_by_rake?
|
14
12
|
|
15
13
|
instance = new
|
16
|
-
instance.check_package_versions_match
|
17
14
|
instance.check_new_version_available
|
18
15
|
end
|
19
16
|
|
@@ -28,28 +25,6 @@ class CableReady::SanityChecker
|
|
28
25
|
end
|
29
26
|
end
|
30
27
|
|
31
|
-
def check_package_versions_match
|
32
|
-
if npm_version.nil?
|
33
|
-
warn_and_exit <<~WARN
|
34
|
-
👉 Can't locate the cable_ready npm package.
|
35
|
-
|
36
|
-
yarn add cable_ready@#{gem_version}
|
37
|
-
|
38
|
-
Either add it to your package.json as a dependency or use "yarn link cable_ready" if you are doing development.
|
39
|
-
WARN
|
40
|
-
end
|
41
|
-
|
42
|
-
if package_version_mismatch?
|
43
|
-
warn_and_exit <<~WARN
|
44
|
-
👉 The cable_ready npm package version (#{npm_version}) does not match the Rubygem version (#{gem_version}).
|
45
|
-
|
46
|
-
To update the cable_ready npm package:
|
47
|
-
|
48
|
-
yarn upgrade cable_ready@#{gem_version}
|
49
|
-
WARN
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
28
|
def check_new_version_available
|
54
29
|
return if CableReady.config.on_new_version_available == :ignore
|
55
30
|
return if Rails.env.development? == false
|
@@ -75,45 +50,12 @@ class CableReady::SanityChecker
|
|
75
50
|
|
76
51
|
private
|
77
52
|
|
78
|
-
def package_version_mismatch?
|
79
|
-
npm_version != gem_version
|
80
|
-
end
|
81
|
-
|
82
53
|
def using_preview_release?
|
83
54
|
preview = CableReady::VERSION.match?(LATEST_VERSION_FORMAT) == false
|
84
55
|
puts "👉 CableReady #{CableReady::VERSION} update check skipped: pre-release build" if preview
|
85
56
|
preview
|
86
57
|
end
|
87
58
|
|
88
|
-
def gem_version
|
89
|
-
@_gem_version ||= CableReady::VERSION.gsub(".pre", "-pre")
|
90
|
-
end
|
91
|
-
|
92
|
-
def npm_version
|
93
|
-
@_npm_version ||= find_npm_version
|
94
|
-
end
|
95
|
-
|
96
|
-
def find_npm_version
|
97
|
-
if (match = search_file(package_json_path, regex: /version/))
|
98
|
-
match[JSON_VERSION_FORMAT, 1]
|
99
|
-
elsif (match = search_file(yarn_lock_path, regex: /^cable_ready/))
|
100
|
-
match[NODE_VERSION_FORMAT, 1]
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
def search_file(path, regex:)
|
105
|
-
return if File.exist?(path) == false
|
106
|
-
File.foreach(path).grep(regex).first
|
107
|
-
end
|
108
|
-
|
109
|
-
def package_json_path
|
110
|
-
Rails.root.join("node_modules", "cable_ready", "package.json")
|
111
|
-
end
|
112
|
-
|
113
|
-
def yarn_lock_path
|
114
|
-
Rails.root.join("yarn.lock")
|
115
|
-
end
|
116
|
-
|
117
59
|
def initializer_missing?
|
118
60
|
File.exist?(Rails.root.join("config", "initializers", "cable_ready.rb")) == false
|
119
61
|
end
|
data/lib/cable_ready/version.rb
CHANGED
@@ -13,7 +13,7 @@ class CableReady::UpdatableTest < ActiveSupport::TestCase
|
|
13
13
|
test "updates the collection when an item is added" do
|
14
14
|
mock_server = mock("server")
|
15
15
|
mock_server.expects(:broadcast).with(User, {}).once
|
16
|
-
mock_server.expects(:broadcast).with("gid://dummy/User/1:posts", {}).once
|
16
|
+
mock_server.expects(:broadcast).with("gid://dummy/User/1:posts", {changed: ["id", "title", "user_id", "created_at", "updated_at"]}).once
|
17
17
|
|
18
18
|
ActionCable.stubs(:server).returns(mock_server)
|
19
19
|
user = User.create(name: "John Doe")
|
@@ -26,7 +26,7 @@ class CableReady::UpdatableTest < ActiveSupport::TestCase
|
|
26
26
|
post = user.posts.create(title: "Lorem")
|
27
27
|
|
28
28
|
mock_server = mock("server")
|
29
|
-
mock_server.expects(:broadcast).with("gid://dummy/User/1:posts", {}).once
|
29
|
+
mock_server.expects(:broadcast).with("gid://dummy/User/1:posts", {changed: ["id", "title", "user_id", "created_at", "updated_at"]}).once
|
30
30
|
|
31
31
|
ActionCable.stubs(:server).returns(mock_server)
|
32
32
|
|
@@ -38,7 +38,7 @@ class CableReady::UpdatableTest < ActiveSupport::TestCase
|
|
38
38
|
post = user.posts.create(title: "Lorem")
|
39
39
|
|
40
40
|
mock_server = mock("server")
|
41
|
-
mock_server.expects(:broadcast).with("gid://dummy/User/1:posts", {}).once
|
41
|
+
mock_server.expects(:broadcast).with("gid://dummy/User/1:posts", {changed: ["title", "updated_at"]}).once
|
42
42
|
|
43
43
|
ActionCable.stubs(:server).returns(mock_server)
|
44
44
|
|
@@ -50,7 +50,7 @@ class CableReady::UpdatableTest < ActiveSupport::TestCase
|
|
50
50
|
|
51
51
|
mock_server = mock("server")
|
52
52
|
mock_server.expects(:broadcast).with(User, {}).once
|
53
|
-
mock_server.expects(:broadcast).with(user.to_global_id, {}).once
|
53
|
+
mock_server.expects(:broadcast).with(user.to_global_id, {changed: ["name", "updated_at"]}).once
|
54
54
|
|
55
55
|
ActionCable.stubs(:server).returns(mock_server)
|
56
56
|
|
@@ -63,10 +63,10 @@ class CableReady::UpdatableTest < ActiveSupport::TestCase
|
|
63
63
|
|
64
64
|
mock_server = mock("server")
|
65
65
|
mock_server.expects(:broadcast).with(User, {}).once
|
66
|
-
mock_server.expects(:broadcast).with(user.to_global_id, {}).once
|
67
|
-
mock_server.expects(:broadcast).with("gid://dummy/Team/1:users", {}).once
|
66
|
+
mock_server.expects(:broadcast).with(user.to_global_id, {changed: ["name", "updated_at"]}).once
|
67
|
+
mock_server.expects(:broadcast).with("gid://dummy/Team/1:users", {changed: ["name", "updated_at"]}).once
|
68
68
|
mock_server.expects(:broadcast).with(Team, {}).once
|
69
|
-
mock_server.expects(:broadcast).with(team.to_global_id, {}).once
|
69
|
+
mock_server.expects(:broadcast).with(team.to_global_id, {changed: ["id", "created_at", "updated_at"]}).once
|
70
70
|
|
71
71
|
ActionCable.stubs(:server).returns(mock_server)
|
72
72
|
|
@@ -94,7 +94,7 @@ class CableReady::UpdatableTest < ActiveSupport::TestCase
|
|
94
94
|
section.updates_enabled = true
|
95
95
|
|
96
96
|
mock_server.expects(:broadcast).with(Section, {}).once
|
97
|
-
mock_server.expects(:broadcast).with(section.to_global_id, {}).once
|
97
|
+
mock_server.expects(:broadcast).with(section.to_global_id, {changed: ["title", "updated_at", "updates_enabled"]}).once
|
98
98
|
section.update(title: "First Section")
|
99
99
|
end
|
100
100
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cable_ready
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.0.
|
4
|
+
version: 5.0.0.pre8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Hopkins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|