foobara-crud-driver-spec-helpers 1.0.1 → 1.1.1
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/CHANGELOG.md +12 -0
- data/lib/foobara/spec_helpers/it_behaves_like_a_crud_driver.rb +38 -2
- metadata +25 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 642c2212c25d1857a33e7df962a3a5f2c7bba5ec9164c471582d7911c1080644
|
|
4
|
+
data.tar.gz: 1542e01f81896779ce6a011fff77f3c746f580ddf569e6a3ce5c842f10378a00
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b89439db98cc393a67244467f836e2b222915b04780a8ec3c31e6964f58ec6507f9544ce227ea6f59ab5cffce55d0bc7a6c6cdedb65d234286caf18c7e2ef2f8
|
|
7
|
+
data.tar.gz: 82a7ae6b4f42c61126b87434ab0677efc626e733a3681de51b128e4cdf8f092431939b3a249d432f0bd93cd00c07ef4b80af9e9a697829d95d0c93ac982b1176
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [1.1.1] - 2025-10-21
|
|
2
|
+
|
|
3
|
+
- prefix: has been renamed table_prefix:
|
|
4
|
+
|
|
5
|
+
## [1.1.0] - 2025-10-21
|
|
6
|
+
|
|
7
|
+
- Add examples for prefix behavior
|
|
8
|
+
|
|
9
|
+
## [1.0.2] - 2025-08-16
|
|
10
|
+
|
|
11
|
+
- Add missing base64 dependency
|
|
12
|
+
|
|
1
13
|
## [1.0.1] - 2025-06-26
|
|
2
14
|
|
|
3
15
|
- Make sure we hit the Table#find_by code path
|
|
@@ -8,12 +8,50 @@ module RspecHelpers
|
|
|
8
8
|
entity_class.current_transaction_table.entity_attributes_crud_driver_table
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
+
let(:driver) { entity_class.entity_base.entity_attributes_crud_driver }
|
|
12
|
+
let(:driver_class) { driver.class }
|
|
13
|
+
|
|
11
14
|
describe ".has_real_transactions?" do
|
|
12
15
|
it "is a boolean" do
|
|
13
16
|
expect([true, false]).to include(described_class.has_real_transactions?)
|
|
14
17
|
end
|
|
15
18
|
end
|
|
16
19
|
|
|
20
|
+
describe "#table_for" do
|
|
21
|
+
context "when using a table_prefix" do
|
|
22
|
+
let(:table_prefix) { "some_prefix" }
|
|
23
|
+
let(:prefixed_crud_driver) { driver_class.new(table_prefix:) }
|
|
24
|
+
let(:entity_class) do
|
|
25
|
+
stub_module("SomeOrg") { foobara_organization! }
|
|
26
|
+
stub_module("SomeOrg::SomeDomain") { foobara_domain! }
|
|
27
|
+
stub_class("SomeOrg::SomeDomain::SomeEntity", Foobara::Entity) do
|
|
28
|
+
attributes do
|
|
29
|
+
id :integer
|
|
30
|
+
foo :integer
|
|
31
|
+
bar :symbol
|
|
32
|
+
created_at :datetime, :allow_nil
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
primary_key :id
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it "includes the table_prefix in the table name" do
|
|
40
|
+
table = prefixed_crud_driver.table_for(entity_class)
|
|
41
|
+
expect(table.table_name).to eq("some_prefix_some_entity")
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
context "when table_prefix is true" do
|
|
45
|
+
let(:table_prefix) { true }
|
|
46
|
+
|
|
47
|
+
it "uses the org and domain as the table_prefix" do
|
|
48
|
+
table = prefixed_crud_driver.table_for(entity_class)
|
|
49
|
+
expect(table.table_name).to eq("some_org_some_domain_some_entity")
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
17
55
|
context "tests from redis-crud-driver" do
|
|
18
56
|
let(:entity_class) do
|
|
19
57
|
stub_class("SomeEntity", Foobara::Entity) do
|
|
@@ -551,8 +589,6 @@ module RspecHelpers
|
|
|
551
589
|
end
|
|
552
590
|
|
|
553
591
|
describe "#all" do
|
|
554
|
-
let(:driver) { entity_class.entity_base.entity_attributes_crud_driver }
|
|
555
|
-
|
|
556
592
|
context "when using string ids" do
|
|
557
593
|
let(:entity_class) do
|
|
558
594
|
stub_class("SomeEntityStringId", Foobara::Entity) do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foobara-crud-driver-spec-helpers
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Miles Georgi
|
|
@@ -9,20 +9,40 @@ bindir: bin
|
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: base64
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0'
|
|
12
26
|
- !ruby/object:Gem::Dependency
|
|
13
27
|
name: foobara
|
|
14
28
|
requirement: !ruby/object:Gem::Requirement
|
|
15
29
|
requirements:
|
|
16
|
-
- - "
|
|
30
|
+
- - ">="
|
|
17
31
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 0.0
|
|
32
|
+
version: 0.2.0
|
|
33
|
+
- - "<"
|
|
34
|
+
- !ruby/object:Gem::Version
|
|
35
|
+
version: 2.0.0
|
|
19
36
|
type: :runtime
|
|
20
37
|
prerelease: false
|
|
21
38
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
39
|
requirements:
|
|
23
|
-
- - "
|
|
40
|
+
- - ">="
|
|
41
|
+
- !ruby/object:Gem::Version
|
|
42
|
+
version: 0.2.0
|
|
43
|
+
- - "<"
|
|
24
44
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 0.0
|
|
45
|
+
version: 2.0.0
|
|
26
46
|
email:
|
|
27
47
|
- azimux@gmail.com
|
|
28
48
|
executables: []
|