lazy_global_record 1.1.0 → 1.2.0
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 +4 -4
- data/README.md +15 -0
- data/lib/lazy_global_record.rb +5 -0
- data/lib/lazy_global_record/version.rb +1 -1
- data/test/dummy/log/test.log +1316 -0
- data/test/lazy_global_record_test.rb +18 -2
- metadata +2 -2
@@ -132,8 +132,24 @@ class LazyGlobalRecordTest < ActiveSupport::TestCase
|
|
132
132
|
filter: lambda { |original| raise ArgumentError, "intentional" }
|
133
133
|
)
|
134
134
|
|
135
|
-
assert_raise(ArgumentError) {
|
135
|
+
assert_raise(ArgumentError) { lazy.value }
|
136
136
|
# and ensure a second time please
|
137
|
-
assert_raise(ArgumentError) {
|
137
|
+
assert_raise(ArgumentError) { lazy.value }
|
138
|
+
end
|
139
|
+
|
140
|
+
test "FROZEN_MODEL filter" do
|
141
|
+
Value.create(value: "one")
|
142
|
+
|
143
|
+
lazy = LazyGlobalRecord.new(
|
144
|
+
relation: -> { Value.where(value: "one") },
|
145
|
+
filter: LazyGlobalRecord::FROZEN_MODEL
|
146
|
+
)
|
147
|
+
|
148
|
+
value = lazy.value
|
149
|
+
|
150
|
+
assert value.present?
|
151
|
+
assert_kind_of Value, value
|
152
|
+
assert value.frozen?
|
153
|
+
assert value.readonly?
|
138
154
|
end
|
139
155
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazy_global_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Friends of the Web
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|